Search in sources :

Example 1 with UpdateSink

use of org.apache.jena.sparql.modify.UpdateSink in project jena by apache.

the class UpdateAction method parseExecute.

/**
     * Parse update operations into a GraphStore by parsing from an InputStream.
     * @param usingList    A list of USING or USING NAMED statements that be added to all {@link UpdateWithUsing} queries
     * @param dataset      The dataset to apply the changes to
     * @param input        The source of the update request (must be UTF-8). 
     * @param inputBinding Initial binding to be applied to Update operations that can apply an initial binding
     *                     (i.e. UpdateDeleteWhere, UpdateModify).  May be <code>null</code>
     * @param baseURI      The base URI for resolving relative URIs (may be <code>null</code>)
     * @param syntax       The update language syntax 
     */
public static void parseExecute(UsingList usingList, DatasetGraph dataset, InputStream input, Binding inputBinding, String baseURI, Syntax syntax) {
    UpdateProcessorStreaming uProc = UpdateExecutionFactory.createStreaming(dataset, inputBinding);
    if (uProc == null)
        throw new ARQException("No suitable update procesors are registered/able to execute your updates");
    uProc.startRequest();
    try {
        UpdateSink sink = new UsingUpdateSink(uProc.getUpdateSink(), usingList);
        try {
            UpdateParser parser = UpdateFactory.setupParser(sink.getPrologue(), baseURI, syntax);
            parser.parse(sink, input);
        } finally {
            sink.close();
        }
    } finally {
        uProc.finishRequest();
    }
}
Also used : UsingUpdateSink(org.apache.jena.sparql.modify.UsingUpdateSink) UpdateSink(org.apache.jena.sparql.modify.UpdateSink) UsingUpdateSink(org.apache.jena.sparql.modify.UsingUpdateSink) ARQException(org.apache.jena.sparql.ARQException) UpdateParser(org.apache.jena.sparql.lang.UpdateParser)

Example 2 with UpdateSink

use of org.apache.jena.sparql.modify.UpdateSink in project jena by apache.

the class UpdateFactory method make.

/** Append update operations to a request */
private static void make(UpdateRequest request, UsingList usingList, InputStream input, String baseURI, Syntax syntax) {
    UpdateParser parser = setupParser(request, baseURI, syntax);
    UpdateSink sink = new UsingUpdateSink(new UpdateRequestSink(request), usingList);
    try {
        parser.parse(sink, input);
    } finally {
        sink.close();
    }
}
Also used : UsingUpdateSink(org.apache.jena.sparql.modify.UsingUpdateSink) UpdateSink(org.apache.jena.sparql.modify.UpdateSink) UsingUpdateSink(org.apache.jena.sparql.modify.UsingUpdateSink) UpdateRequestSink(org.apache.jena.sparql.modify.UpdateRequestSink) UpdateParser(org.apache.jena.sparql.lang.UpdateParser)

Aggregations

UpdateParser (org.apache.jena.sparql.lang.UpdateParser)2 UpdateSink (org.apache.jena.sparql.modify.UpdateSink)2 UsingUpdateSink (org.apache.jena.sparql.modify.UsingUpdateSink)2 ARQException (org.apache.jena.sparql.ARQException)1 UpdateRequestSink (org.apache.jena.sparql.modify.UpdateRequestSink)1