You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/02/02 17:37:16 UTC
svn commit: r1239717 -
/incubator/jena/Scratch/AFS/Dev/trunk/src-dev/dev/UpdateProcessRemote.java
Author: andy
Date: Thu Feb 2 16:37:16 2012
New Revision: 1239717
URL: http://svn.apache.org/viewvc?rev=1239717&view=rev
Log: (empty)
Added:
incubator/jena/Scratch/AFS/Dev/trunk/src-dev/dev/UpdateProcessRemote.java
Added: incubator/jena/Scratch/AFS/Dev/trunk/src-dev/dev/UpdateProcessRemote.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src-dev/dev/UpdateProcessRemote.java?rev=1239717&view=auto
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src-dev/dev/UpdateProcessRemote.java (added)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src-dev/dev/UpdateProcessRemote.java Thu Feb 2 16:37:16 2012
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev;
+
+import org.openjena.riot.WebContent ;
+import org.openjena.riot.web.HttpOp ;
+
+import com.hp.hpl.jena.query.QueryExecution ;
+import com.hp.hpl.jena.query.QueryExecutionFactory ;
+import com.hp.hpl.jena.query.QuerySolution ;
+import com.hp.hpl.jena.query.ResultSetFormatter ;
+import com.hp.hpl.jena.sparql.ARQException ;
+import com.hp.hpl.jena.update.GraphStore ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateProcessor ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+
+public class UpdateProcessRemote implements UpdateProcessor
+{
+ public static void main(String ... argv)
+ {
+ //UpdateExecutionFactory.createRemote()
+
+ UpdateRequest req = UpdateFactory.read("U.ru") ;
+ UpdateProcessor proc = new UpdateProcessRemote("http://localhost:3030/ds/update", req) ;
+ proc.execute() ;
+ QueryExecution qExec = QueryExecutionFactory.sparqlService("http://localhost:3030/ds/sparql", "SELECT * { ?s ?p ?o}") ;
+ ResultSetFormatter.out(qExec.execSelect()) ;
+ }
+
+ private final String endpoint ;
+ private final UpdateRequest request ;
+
+ public UpdateProcessRemote(String endpoint, UpdateRequest request)
+ {
+ this.endpoint = endpoint ;
+ this.request = request ;
+ }
+
+ @Override
+ public void setInitialBinding(QuerySolution binding)
+ {
+ throw new ARQException("Initial bindings for a remote update execution request not supported") ;
+ }
+
+ @Override
+ public GraphStore getGraphStore()
+ {
+ return null ;
+ }
+
+ @Override
+ public void execute()
+ {
+ String reqStr = request.toString() ;
+ HttpOp.execHttpPost(endpoint, WebContent.contentTypeSPARQLUpdate, reqStr) ;
+ }
+
+}
+