Java Code Examples for org.apache.jena.sparql.sse.SSE#write()

The following examples show how to use org.apache.jena.sparql.sse.SSE#write() . 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: UpdateReadFromFile.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public static void main(String []args)
{
    // Create an empty GraphStore (has an empty default graph and no named graphs) 
    Dataset dataset = DatasetFactory.createTxnMem() ;
    
    // ---- Read and update script in one step.
    UpdateAction.readExecute("update.ru", dataset) ;
    
    // ---- Reset.
    UpdateAction.parseExecute("DROP ALL", dataset) ;
    
    // ---- Read the update script, then execute, in separate two steps
    UpdateRequest request = UpdateFactory.read("update.ru") ;
    UpdateAction.execute(request, dataset) ;

    // Write in debug format.
    System.out.println("# Debug format");
    SSE.write(dataset) ;
    
    System.out.println();
    
    System.out.println("# N-Quads: S P O G") ;
    RDFDataMgr.write(System.out, dataset, Lang.NQUADS) ;
}
 
Example 2
Source File: UpdateExecuteOperations.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public static void ex3(Dataset dataset)
{
    // Build up the request then execute it.
    // This is the preferred way for complex sequences of operations. 
    UpdateRequest request = UpdateFactory.create() ;
    request.add("DROP ALL")
           .add("CREATE GRAPH <http://example/g2>") ;
    // Different style.
    // Equivalent to request.add("...")
    UpdateFactory.parse(request, "LOAD <file:etc/update-data.ttl> INTO GRAPH <http://example/g2>") ;
    
    // And perform the operations.
    UpdateAction.execute(request, dataset) ;
    
    System.out.println("# Debug format");
    SSE.write(dataset) ;
    
    System.out.println();
    
    System.out.println("# N-Quads: S P O G") ;
    RDFDataMgr.write(System.out, dataset, Lang.NQUADS) ;
}
 
Example 3
Source File: UpdateProgrammatic.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public static void main(String []args)
{
    Dataset dataset = DatasetFactory.createTxnMem() ;
    
    UpdateRequest request = UpdateFactory.create() ;
    
    request.add(new UpdateDrop(Target.ALL)) ;
    request.add(new UpdateCreate("http://example/g2")) ;
    request.add(new UpdateLoad("file:etc/update-data.ttl", "http://example/g2")) ;
    UpdateAction.execute(request, dataset) ;
    
    System.out.println("# Debug format");
    SSE.write(dataset) ;
    
    System.out.println();
    
    System.out.println("# N-Quads: S P O G") ;
    RDFDataMgr.write(System.out, dataset, Lang.NQUADS) ;
}
 
Example 4
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 5
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) ;
}