jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject [36/50] [abbrv] jena git commit: JENA-1022 : Handle models.
Date Wed, 09 Sep 2015 07:44:47 GMT
JENA-1022 : Handle models.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/af1697ac
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/af1697ac
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/af1697ac

Branch: refs/heads/JENA-507
Commit: af1697aca1c0ea9dc9b55966baebb5ee755233d5
Parents: 06e1641
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Sep 5 17:57:38 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Sep 5 17:57:38 2015 +0100

----------------------------------------------------------------------
 .../jena/fuseki/servlets/SPARQL_Query.java      |  2 +-
 .../java/org/apache/jena/fuseki/TestQuery.java  | 41 +++++++++++++++++++-
 2 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/af1697ac/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
index 6d7e8a6..55225c9 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
@@ -382,7 +382,7 @@ public abstract class SPARQL_Query extends SPARQL_Protocol
             // CONSTRUCT is processed as a extended CONSTRUCT - result is a dataset. 
             ResponseDataset.doResponseDataset(action, result.getDataset());
         else if ( result.isModel() )
-            // DESCRIBE rsults are models
+            // DESCRIBE results are models
             ResponseDataset.doResponseModel(action, result.getModel());
         else if ( result.isBoolean() )
             ResponseResultSet.doResponseResultSet(action, result.getBooleanResult()) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/af1697ac/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestQuery.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestQuery.java
b/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestQuery.java
index dabe10d..08c837d 100644
--- a/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestQuery.java
+++ b/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestQuery.java
@@ -18,7 +18,12 @@
 
 package org.apache.jena.fuseki ;
 
-import static org.apache.jena.fuseki.ServerTest.* ;
+import static org.apache.jena.fuseki.ServerTest.gn1 ;
+import static org.apache.jena.fuseki.ServerTest.gn2 ;
+import static org.apache.jena.fuseki.ServerTest.model1 ;
+import static org.apache.jena.fuseki.ServerTest.model2 ;
+import static org.apache.jena.fuseki.ServerTest.serviceQuery ;
+import static org.apache.jena.fuseki.ServerTest.serviceREST ;
 
 import java.io.IOException ;
 import java.net.HttpURLConnection ;
@@ -190,6 +195,24 @@ public class TestQuery extends BaseTest {
         }
     }
     
+    @Test
+    public void query_describe_01() {
+        String query = "DESCRIBE ?s WHERE {?s ?p ?o}" ;
+        try ( QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, query)
) {
+            Model result = qExec.execDescribe();
+            assertFalse(result.isEmpty()) ;
+        }
+    }
+
+    @Test
+    public void query_describe_02() {
+        String query = "DESCRIBE <http://example/somethingelse> WHERE { }" ;
+        try ( QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, query)
) {
+            Model result = qExec.execDescribe();
+            assertTrue(result.isEmpty()) ;
+        }
+    }
+
     private static final AcceptList rdfOfferTest = DEF.rdfOffer ;
     private static final AcceptList quadsOfferTest = DEF.quadsOffer ;
     
@@ -223,6 +246,22 @@ public class TestQuery extends BaseTest {
             }
         }
     }
+    
+    @Test
+    public void query_describe_conneg() {
+        String query = "DESCRIBE ?s WHERE {?s ?p ?o}" ;
+        for (MediaType type: rdfOfferTest.entries()){
+            String contentType = type.toHeaderString();
+            try ( QueryEngineHTTP qExec = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(serviceQuery,
query) ) {
+                qExec.setModelContentType( contentType );
+                Model m = qExec.execDescribe() ;
+                String x = qExec.getHttpResponseContentType() ;
+                assertEquals( contentType , x ) ;
+                assertFalse(m.isEmpty()) ;
+            }
+        }
+    }
+
 
     private void execQuery(String queryString, int exceptedRowCount) {
         QueryExecution qExec = QueryExecutionFactory.sparqlService(serviceQuery, queryString)
;


Mime
View raw message