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

The following examples show how to use org.apache.jena.riot.system.PrefixMapFactory. 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: RDFChangesWriteUpdate.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
public RDFChangesWriteUpdate(AWriter out) {
    this.out = out;
    this.pmap = PrefixMapFactory.create();
    // Without prefixes on output - set pmap to null.
    // Avoid Jena 3.10.0 and earlier error that deleting prefixes does not stop abbreviation.
    // Fixes in Jena 3.11.0 when "pmap" can be used.
    this.formatter = new NodeFormatterTTL(null, /*pmap*/null) {
        @Override
        // Fix NodeFormatterTTL in Jena.
        public void formatBNode(AWriter w, Node n) {
            formatBNode(w, n.getBlankNodeLabel());
        }
        
        // Write as a URI.
        @Override
        public void formatBNode(AWriter w, String label) {
            w.print("<_:");
            String lab = NodeFmtLib.encodeBNodeLabel(label);
            w.print(lab);
            w.print(">");
        }
    };
}
 
Example #2
Source File: TokenWriterText.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
public TokenWriterText(String label, NodeFormatter formatter, AWriter out) {
    if ( formatter == null )
        // For the number abbreviations.
        formatter = new NodeFormatterTTL(null, PrefixMapFactory.emptyPrefixMap());
    // Must write bNodes as <_:....>
    formatter = new NodeFormatterBNode(formatter);
    this.fmt = formatter;
    this.out = out;
    this.label = label;
}
 
Example #3
Source File: SinkTripleStarOutput.java    From RDFstarTools with Apache License 2.0 4 votes vote down vote up
public SinkTripleStarOutput(OutputStream out, Prologue prologue, NodeToLabel labels) {
this( out,
      (prologue!=null) ? prologue.getBaseURI()   : null ,
      (prologue!=null) ? prologue.getPrefixMap() : PrefixMapFactory.emptyPrefixMap(),
      labels );
  }
 
Example #4
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 #5
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;
}