jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1509639 - in /jena/trunk/jena-fuseki: src-dev/dev/ src/main/java/org/apache/jena/fuseki/ src/main/java/org/apache/jena/fuseki/migrate/ src/main/java/org/apache/jena/fuseki/server/ src/main/java/org/apache/jena/fuseki/servlets/
Date Fri, 02 Aug 2013 11:31:34 GMT
Author: andy
Date: Fri Aug  2 11:31:34 2013
New Revision: 1509639

URL: http://svn.apache.org/r1509639
Log:
JENA-497
Create a proper dummy dataset for general SPARQL query.
Improve conneg when loading data via daatset description or protocol parameters.

Modified:
    jena/trunk/jena-fuseki/src-dev/dev/RunFuseki.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java

Modified: jena/trunk/jena-fuseki/src-dev/dev/RunFuseki.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src-dev/dev/RunFuseki.java?rev=1509639&r1=1509638&r2=1509639&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src-dev/dev/RunFuseki.java (original)
+++ jena/trunk/jena-fuseki/src-dev/dev/RunFuseki.java Fri Aug  2 11:31:34 2013
@@ -52,6 +52,7 @@ public class RunFuseki
     private static void main1()
     {
         FusekiCmd.main(
+                     //  "-v",
                      "--update", "--mem", "--mgtPort=3131", "/ds"
                      
                      //"--update", "--mem", "/ds"
@@ -59,7 +60,6 @@ public class RunFuseki
                      //"--update", "--loc=/home/afs/tmp/DB", "--set=tdb:unionDefaultGraph=true",
"--update", "/ds"
                      //"--update", "--memtdb", "--set=tdb:unionDefaultGraph=true", "--update",
"/ds"
                      
-                    //"-v", 
                     //"--debug",
                     //"--update",
                     //"--timeout=1000,5000",

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java?rev=1509639&r1=1509638&r2=1509639&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/HttpNames.java Fri Aug  2
11:31:34 2013
@@ -79,11 +79,12 @@ public class HttpNames
     public static final String HEADER_LASTMOD       = "Last-Modified";
     
     // Names for services in the default configuration
-    public static final String ServiceQuery     = "query" ;
-    public static final String ServiceQueryAlt  = "sparql" ;
-    public static final String ServiceUpdate    = "update" ;
-    public static final String ServiceData      = "data" ;
-    public static final String ServiceUpload    = "upload" ;
+    public static final String ServiceQuery         = "query" ;
+    public static final String ServiceQueryAlt      = "sparql" ;
+    public static final String ServiceUpdate        = "update" ;
+    public static final String ServiceData          = "data" ;
+    public static final String ServiceUpload        = "upload" ;
+    public static final String ServiceGeneralQuery  = "sparql" ;
     
     // Posisble values of fields.
     // TODO Pull in from results writer.

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java?rev=1509639&r1=1509638&r2=1509639&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
(original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
Fri Aug  2 11:31:34 2013
@@ -19,12 +19,9 @@
 
 package org.apache.jena.fuseki.migrate;
 
-import java.io.InputStream ;
-
+import org.apache.jena.atlas.web.TypedInputStream ;
 import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.riot.system.StreamRDF ;
 import org.apache.jena.riot.system.StreamRDFLib ;
 
@@ -69,11 +66,11 @@ public class GraphLoadUtils
     // ** Worker.
     private static void readUtil(Graph graph, String uri, int limit)
     {
-        Lang lang = RDFLanguages.filenameToLang(uri, RDFLanguages.RDFXML) ;
+        // We need to do this ourselves, not via riot, to use the webStreamManager
         StreamRDF sink = StreamRDFLib.graph(graph) ;
         sink = new SinkRDFLimited(sink, limit) ;
 
-        InputStream input = Fuseki.webStreamManager.open(uri) ;
-        RDFDataMgr.parse(sink, input, uri, lang, null) ;
+        TypedInputStream input = Fuseki.webStreamManager.open(uri) ;
+        RDFDataMgr.parse(sink, input, uri) ;
     }
 }

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java?rev=1509639&r1=1509638&r2=1509639&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java Fri
Aug  2 11:31:34 2013
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServlet ;
 
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.HttpNames ;
 import org.apache.jena.fuseki.mgt.ActionDataset ;
 import org.apache.jena.fuseki.mgt.MgtFunctions ;
 import org.apache.jena.fuseki.mgt.PageNames ;
@@ -225,7 +226,6 @@ public class SPARQLServer {
         boolean installServices = true ;
 
         String validationRoot = "/validate" ;
-        String sparqlProcessor = "/sparql" ;
 
         // Should all services be /_/.... or some such?
 
@@ -263,7 +263,7 @@ public class SPARQLServer {
             addServlet(context, validateIRI, validationRoot + "/iri", false) ;
 
             // general query processor.
-            addServlet(context, generalQueryService, sparqlProcessor, enableCompression)
;
+            addServlet(context, generalQueryService, HttpNames.ServiceGeneralQuery, enableCompression)
;
         }
 
         if ( installManager || installServices ) {

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java?rev=1509639&r1=1509638&r2=1509639&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
(original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST_R.java
Fri Aug  2 11:31:34 2013
@@ -30,8 +30,6 @@ import org.apache.jena.fuseki.HttpNames 
 import org.apache.jena.riot.* ;
 
 import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
 
 /** Only the READ operations */
 public class SPARQL_REST_R extends SPARQL_REST
@@ -75,12 +73,10 @@ public class SPARQL_REST_R extends SPARQ
             String ct = WebContent.mapLangToContentType(lang) ;
             action.response.setContentType(ct) ;
             Graph g = target.graph() ;
-            Model model = ModelFactory.createModelForGraph(g) ;
-            
             //Special case RDF/XML to be the plain (faster, less readable) form
             RDFFormat fmt = 
                 ( lang == Lang.RDFXML ) ? RDFFormat.RDFXML_PLAIN : RDFWriterRegistry.defaultSerialization(lang)
;  
-            RDFDataMgr.write(out, model, fmt) ;
+            RDFDataMgr.write(out, g, fmt) ;
             success(action) ;
         } finally { action.endRead() ; }
     }

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java?rev=1509639&r1=1509638&r2=1509639&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
(original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
Fri Aug  2 11:31:34 2013
@@ -137,10 +137,13 @@ public abstract class SPARQL_ServletBase
             }
         } else {
             // General SPARQL processor
-            // - is this the right way to do it?
-            // = or make it a completely separate servlet. 
+            // Kludgy - is this the right way to do it?
+            //        - or make it a completely separate servlet.
+            //        - is it important enough to worry?
             dsRef = new DatasetRef();
             dsRef.dataset = dummyDSG;
+            dsRef.name = "" ;
+            dsRef.query.endpoints.add(HttpNames.ServiceGeneralQuery) ;
             dsRef.init() ;
         }
         
@@ -314,11 +317,10 @@ public abstract class SPARQL_ServletBase
         return uri.substring(dsname.length()+1) ;   // Skip the separating "/"
     }
 
-    
-
-    
     protected static String mapRequestToService(DatasetRef dsRef, String uri, String serviceName)
     {
+        if ( dsRef == null )
+            return "" ;
         if ( dsRef.name.length() >= uri.length() )
             return "" ;
         return uri.substring(dsRef.name.length()+1) ;   // Skip the separating "/"



Mime
View raw message