org.apache.jena.riot.system.PrefixMap Java Examples

The following examples show how to use org.apache.jena.riot.system.PrefixMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExRIOT_out3.java    From xcurator with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
{
    // Writers are discouraged : just hope the charset is UTF-8.
    IndentedWriter x = RiotLib.create(out) ;
    SSE.write(x, graph) ;
}
 
Example #2
Source File: SHACLCWriter.java    From shacl with Apache License 2.0 5 votes vote down vote up
private void writePrefixes(IndentedWriter out, PrefixMap prefixMap) {
	List<String> prefixes = new LinkedList<String>(prefixMap.getMapping().keySet());
	if(!prefixes.isEmpty()) {
		Collections.sort(prefixes);
		for(String prefix : prefixes) {
			if(SHACLC.getDefaultPrefixURI(prefix) == null) {
				out.println("PREFIX " + prefix + ": <" + prefixMap.expand(prefix + ":") + ">");
			}
		}
		out.println();
	}
}
 
Example #3
Source File: SHACLCWriter.java    From shacl with Apache License 2.0 5 votes vote down vote up
private void write(IndentedWriter out, Graph graph, PrefixMap prefixMap, String baseURI, Context context) {
	Model model = ModelFactory.createModelForGraph(graph);
	if(baseURI != null) {
		out.println("BASE <" + baseURI + ">");
		out.println();
	}
	writeImports(out, model.getResource(baseURI));
	writePrefixes(out, prefixMap);
	writeShapes(out, model);
	out.flush();
}
 
Example #4
Source File: SHACLCWriter.java    From shacl with Apache License 2.0 5 votes vote down vote up
@Override
public void write(OutputStream out, Graph graph, PrefixMap prefixMap, String baseURI, Context context) {
       IndentedWriter iOut = new IndentedWriter(out);
       iOut.setUnitIndent(1);
       iOut.setPadChar('\t');
	write(iOut, graph, prefixMap, baseURI, context);
}
 
Example #5
Source File: SHACLCWriter.java    From shacl with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context context) {
       IndentedWriter iOut = RiotLib.create(out);
       iOut.setUnitIndent(1);
       iOut.setPadChar('\t');
	write(iOut, graph, prefixMap, baseURI, context);
}
 
Example #6
Source File: RdflintParserTurtle.java    From rdflint with MIT License 5 votes vote down vote up
public RdflintParseProfile(FactoryRDF factory, ErrorHandler errorHandler, IRIResolver resolver,
    PrefixMap prefixMap, Context context, boolean checking, boolean strictMode,
    List<RdfValidator> validationModels, List<LintProblem> diagnosticList) {
  super(factory, errorHandler, resolver, prefixMap, context, checking, strictMode);
  this.validationModels = validationModels;
  this.diagnosticList = diagnosticList;
}
 
Example #7
Source File: SinkTripleStarOutputTest.java    From RDFstarTools with Apache License 2.0 5 votes vote down vote up
public String serialize( Triple t, String base, PrefixMap pmap ) {
    try ( ByteArrayOutputStream outstream = new ByteArrayOutputStream() ) {
        final SinkTripleStarOutput out = new SinkTripleStarOutput(
            outstream,
            base,
            pmap,
            NodeToLabel.createScopeByDocument());
        out.send( t );
        out.close();
        return outstream.toString();
	}         catch ( IOException e ) {
           throw new IllegalStateException("closing the output stream failed", e);
       }
}
 
Example #8
Source File: SinkTripleStarOutputTest.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
static public PrefixMap getPrefixMapForTests() {
	final PrefixMap pmap = PrefixMapFactory.createForOutput();
	pmap.add("ex", "http://example.com/");
	return pmap;
}
 
Example #9
Source File: ExRIOT_out3.java    From xcurator with Apache License 2.0 4 votes vote down vote up
@Override
public void write(OutputStream out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
{
    SSE.write(out, graph) ;
}
 
Example #10
Source File: SinkTripleStarOutputTest.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public String serialize( Node s, Node p, Node o, String base, PrefixMap pmap ) {
	return serialize( new Triple(s, p, o), base, pmap );
}
 
Example #11
Source File: ParserProfileTurtleStarWrapperImpl.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
@Override
public PrefixMap getPrefixMap() {
    return profile.getPrefixMap();
}
 
Example #12
Source File: AbstractParserProfileTurtleStarTest.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
static public PrefixMap getPrefixMap() {
	final PrefixMap pmap = PrefixMapFactory.createForInput();
       pmap.add("" , "http://example/");
       return pmap;
}
 
Example #13
Source File: NodeFormatterTurtleStarExtImpl.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public NodeFormatterTurtleStarExtImpl(String baseIRI, PrefixMap prefixMap, NodeToLabel nodeToLabel) {
    super(baseIRI, prefixMap, nodeToLabel);
}
 
Example #14
Source File: NodeFormatterTurtleStarExtImpl.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public NodeFormatterTurtleStarExtImpl(String baseIRI, PrefixMap prefixMap) {
    super(baseIRI, prefixMap) ;
}
 
Example #15
Source File: SinkTripleStarOutput.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public SinkTripleStarOutput(OutputStream out, String baseIRI, PrefixMap prefixMap, NodeToLabel labels) {
	writer = IO.wrapUTF8(out);
    labelPolicy = labels;        
    nodeFmt = new NodeFormatterTurtleStarExtImpl(baseIRI, prefixMap, labels);
}
 
Example #16
Source File: RDFStar2RDF.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public FileConverter( String inputFilename, OutputStream outStream, String baseIRI, PrefixMap pm ) {
	this.inputFilename = inputFilename;
	this.outStream = outStream;
	this.baseIRI = baseIRI;
	this.pmap = pm;
}
 
Example #17
Source File: ParserProfileTurtleStarExtImpl.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public ParserProfileTurtleStarExtImpl(FactoryRDF factory, ErrorHandler errorHandler, 
        IRIResolver resolver, PrefixMap prefixMap,
        Context context, boolean checking, boolean strictMode) {
	super(factory,errorHandler,resolver,prefixMap,context, checking, strictMode );
}
 
Example #18
Source File: RDFStar2RDF.java    From RDFstarTools with Apache License 2.0 votes vote down vote up
public PrefixMap getPrefixMap() { return pmap; } 
Example #19
Source File: RDF2RDFStar.java    From RDFstarTools with Apache License 2.0 votes vote down vote up
public PrefixMap getPrefixMap() { return pmap; }