jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1141148 - in /incubator/jena/Jena2/ARQ/trunk: ./ src/com/hp/hpl/jena/sparql/pfunction/library/ testing/ARQ/PropertyFunctions/
Date Wed, 29 Jun 2011 16:25:35 GMT
Author: andy
Date: Wed Jun 29 16:25:34 2011
New Revision: 1141148

URL: http://svn.apache.org/viewvc?rev=1141148&view=rev
Log:
rdfs:member calculation - look in graph for concrete triples as well
JENA-77

Added:
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.rq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.srx
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/data-6.ttl   (with props)
Modified:
    incubator/jena/Jena2/ARQ/trunk/D.ttl
    incubator/jena/Jena2/ARQ/trunk/Q.rq
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/pfunction/library/container.java
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/manifest.ttl

Modified: incubator/jena/Jena2/ARQ/trunk/D.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/D.ttl?rev=1141148&r1=1141147&r2=1141148&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/jena/Jena2/ARQ/trunk/Q.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Q.rq?rev=1141148&r1=1141147&r2=1141148&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/Q.rq (original)
+++ incubator/jena/Jena2/ARQ/trunk/Q.rq Wed Jun 29 16:25:34 2011
@@ -1,21 +1,8 @@
-PREFIX skos:  <http://www.w3.org/2004/02/skos/core#>
-SELECT DISTINCT ?stw ?stw_pref ?rel ?thesoz_pref ?thesoz
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX :    <http://example/>
+
+SELECT *
 WHERE {
-  {
-    SELECT DISTINCT ?stw ('=' as ?rel) ?thesoz
-    WHERE {
-      ?stw skos:exactMatch ?thesoz .
-      ?stw skos:inScheme <http://zbw.eu/stw> .
-      ?thesoz skos:inScheme <http://lod.gesis.org/thesoz/> .
-    }
-  } UNION {
-    SELECT DISTINCT ?stw ('<' as ?rel) ?thesoz
-    WHERE  {
-      ?stw skos:broadMatch ?thesoz .
-      ?stw skos:inScheme <http://zbw.eu/stw> .
-      ?thesoz skos:inScheme <http://lod.gesis.org/thesoz/> .
-    }
-  } .
-  ?stw skos:prefLabel ?stw_pref .
-  ?thesoz skos:prefLabel ?thesoz_pref 
+    ?x rdfs:member ?y .
 }

Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/pfunction/library/container.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/pfunction/library/container.java?rev=1141148&r1=1141147&r2=1141148&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/pfunction/library/container.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/pfunction/library/container.java
Wed Jun 29 16:25:34 2011
@@ -23,6 +23,8 @@ import com.hp.hpl.jena.sparql.engine.bin
 import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
 import com.hp.hpl.jena.sparql.engine.iterator.QueryIterConcat ;
 import com.hp.hpl.jena.sparql.engine.iterator.QueryIterPlainWrapper ;
+import com.hp.hpl.jena.sparql.engine.iterator.QueryIterRoot ;
+import com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern ;
 import com.hp.hpl.jena.sparql.engine.iterator.QueryIterYieldN ;
 import com.hp.hpl.jena.sparql.pfunction.PFuncSimple ;
 import com.hp.hpl.jena.sparql.util.IterLib ;
@@ -44,8 +46,27 @@ public class container extends PFuncSimp
     @Override
     public QueryIterator execEvaluated(Binding binding, Node containerNode, Node predicate,
Node member, ExecutionContext execCxt)
     {
+        QueryIterator qIter1 = execEvaluatedConcrete(binding, containerNode, predicate, member,
execCxt) ;
+        QueryIterator qIter2 = execEvaluatedCalc(binding, containerNode, predicate, member,
execCxt) ;
+        QueryIterConcat concat = new QueryIterConcat(execCxt) ;
+        concat.add(qIter1) ;
+        concat.add(qIter2) ;
+        return concat ;
+    }
+    
+    // Ask directly.
+    private QueryIterator execEvaluatedConcrete(Binding binding, Node containerNode, Node
predicate, Node member,
+                                                ExecutionContext execCxt)
+    {
+        Graph graph = execCxt.getActiveGraph() ;
+        QueryIterator qIter = new QueryIterTriplePattern(QueryIterRoot.create(execCxt), new
Triple(containerNode, predicate, member), execCxt) ;
+        return qIter ;
+    }
+
+    // Ask by finding all the rdf:_N + rdf:type  
+    private QueryIterator execEvaluatedCalc(Binding binding, Node containerNode, Node predicate,
Node member, ExecutionContext execCxt)
+    {    
         Graph graph = execCxt.getActiveGraph() ;
-        
         if ( ! containerNode.isVariable() )
         {
             // Container a ground term.

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.rq?rev=1141148&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.rq (added)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.rq Wed Jun 29
16:25:34 2011
@@ -0,0 +1,8 @@
+PREFIX  rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX  :       <http://example/>
+
+SELECT ?x ?y
+{ 
+  ?x rdfs:member ?y
+}

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.srx
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.srx?rev=1141148&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.srx (added)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/container-9.srx Wed Jun 29
16:25:34 2011
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+  <head>
+    <variable name="x"/>
+    <variable name="y"/>
+  </head>
+  <results>
+    <result>
+      <binding name="x">
+        <uri>http://example/x12</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x11</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x5</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x5</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">10</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x10</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x10</uri>
+      </binding>
+      <binding name="y">
+        <uri>http://example/x6</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x3</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">5</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x6</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x6</uri>
+      </binding>
+      <binding name="y">
+        <uri>http://example/x6</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x11</uri>
+      </binding>
+      <binding name="y">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+  </results>
+</sparql>

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/data-6.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/data-6.ttl?rev=1141148&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/data-6.ttl
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/manifest.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/manifest.ttl?rev=1141148&r1=1141147&r2=1141148&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/manifest.ttl (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/PropertyFunctions/manifest.ttl Wed Jun 29 16:25:34
2011
@@ -197,6 +197,13 @@
         mf:result  <container-8.srx>
       ]
 
+      [  mf:name    "Property Function - container 9" ;
+         mf:action
+            [ qt:query  <container-9.rq> ;
+              qt:data   <data-6.ttl> ] ;
+        mf:result  <container-9.srx>
+      ]
+
       [  mf:name    "Property Function - sequence 1" ;
          mf:action
             [ qt:query  <seq-1.rq> ;



Mime
View raw message