On 14/04/16 20:35, Jonathan Camilleri wrote:
What is a unionized graph, is it a graph that joins two data sets which are
common in set theory?

Yes. An RDF graph is a set of RDF triples (in the set theoretic sense), a union graph is a union of those triple sets.

Dave

On 28 March 2016 at 19:46, Woodward, Arthur E CTR (US) <
[email protected]> wrote:

Hello Users,



I have been having difficulty finding a solution to the problem of
building a modular system for ontological query expansion in Fuseki.



My goal is to be able to run a query over a unionized default graph, while
maintaining the ability to edit the individual named graphs either from the
same dataset or a different dataset.



I have tried many variations of the Fuseki assembler, and after combing
through the documentation and previous e-mails I believe I have constructed
an assembler specification that should be working, but it is not. From an
e-mail by Rohana Rajapakse on Jan 24, 2014 1:52 am it was indicated that a
structure like the one in my file below should allow for an inference
engine to be run over a unionized default graph.



Data added via Fuseki GUI::

DID NOT WORK

Dataset -- Data

Graphs -- default -- (empty, with unionDefaultGraph:true in the Data.ttl
and Reasoner.ttl assembler files)

               Entities --

                             @prefix ex:    <http://example.org/> .
                             @prefix owl:   <http://www.w3.org/2002/07/owl#>
.
                             @prefix rdf:   <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
                             @prefix rdfs:  <
http://www.w3.org/2000/01/rdf-schema#> .
                             @prefix zoo:   <http://example.org/zoo/> .



                             ex:dog1  a      ex:animal .

                             ex:cat1  a      ex:cat .

                             ex:zoo1  zoo:host  ex:cat2 .

                             ex:cat3  owl:sameAs  ex:cat2 .



             Ontology --

                             @prefix ex:    <http://example.org/> .
                             @prefix owl:   <http://www.w3.org/2002/07/owl#>
.
                             @prefix rdf:   <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
                             @prefix rdfs:  <
http://www.w3.org/2000/01/rdf-schema#> .
                             @prefix zoo:   <http://example.org/zoo/> .



                             ex:cat  rdfs:subClassOf  ex:animal .

                             zoo:host  rdfs:range  ex:animal .

Dataset -- Reasoner

             default - (no manually entered data)



Query -- Run over the Reasoner Dataset

PREFIX ex: <http://example.org/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://localhost:3030/Test/data/>
PREFIX http: <http://www.w3.org/2011/http#>

SELECT ?animal
WHERE {
   ?animal a ex:animal .
}
LIMIT 10



0 Results.



If the data in the "Data" dataset is moved from the named graphs to the
default graph and the unionDefaultGraph:true option is commented out from
the Data.ttl file, and the same query above is run, there are 4 results.

{
   "head": {
     "vars": [ "animal" ]
   } ,
   "results": {
     "bindings": [
       {
         "animal": { "type": "uri" , "value": "http://example.org/dog1"; }
       } ,
       {
         "animal": { "type": "uri" , "value": "http://example.org/cat1"; }
       } ,
       {
         "animal": { "type": "uri" , "value": "http://example.org/cat2"; }
       } ,
       {
         "animal": { "type": "uri" , "value": "http://example.org/cat3"; }
       }
     ]
   }
}



Data.ttl::

       1 @prefix :      <http://base/#> .
       2 @prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
       3 @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
       4 @prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
       5 @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
       6 @prefix fuseki: <http://jena.apache.org/fuseki#> .
       7
       8 :service_tdb_all  a                   fuseki:Service ;
       9         rdfs:label                    "TDB Data" ;
      10         fuseki:dataset                :tdb_dataset_readwrite ;
      11         fuseki:name                   "Data" ;
      12         fuseki:serviceQuery           "query" , "sparql" ;
      13         fuseki:serviceReadGraphStore  "get" ;
      14         fuseki:serviceReadWriteGraphStore
      15                 "data" ;
      16         fuseki:serviceUpdate          "update" ;
      17         fuseki:serviceUpload          "upload" .
      18
      19 :tdb_dataset_readwrite
      20         a             tdb:DatasetTDB ;
      21         tdb:location
"/home/evan/Documents/apache-jena-fuseki-2.3.1/run/databases/Data" ;
      22        tdb:unionDefaultGraph true ;
      23         .
      24



Reasoner.ttl::

@prefix :      <http://base/#> .
       2 @prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
       3 @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
       4 @prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
       5 @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
       6 @prefix fuseki: <http://jena.apache.org/fuseki#> .
       7
       8 :service1  a                          fuseki:Service ;
       9         fuseki:dataset                :tdb_dataset_readwrite ;
      10         fuseki:name                   "Reasoner" ;
      11         fuseki:serviceQuery           "query" , "sparql" ;
      12         fuseki:serviceReadGraphStore  "get" ;
      13         fuseki:serviceReadWriteGraphStore
      14                 "data" ;
      15         fuseki:serviceUpdate          "update" ;
      16         fuseki:serviceUpload          "upload" .
      17
      18 tdb:GraphTDB rdfs:subClassOf ja:Model .
      19 tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
      20
      21 :tdb_dataset_readwrite  a          ja:RDFDataset ;
      22         ja:defaultGraph :model2 ;
      23         ja:namedGraph
      24            [ ja:graphName "Data" ;
      25              ja:graph     :graph ] ;
      26         .
      27
      28 :tdb_intermediate_dataset a tdb:DatasetTDB ;
      29     tdb:location
"/home/evan/Documents/apache-jena-fuseki-2.3.1/run/databases/Data";
      30     tdb:unionDefaultGraph true ;
      31     .
      32
      33 :graph rdf:type tdb:GraphTDB ;
      34     tdb:dataset :tdb_intermediate_dataset
      35     .
      36
      37 :model2 a ja:InfModel ;
      38         ja:reasoner  [ ja:reasonerURL <
http://jena.hpl.hp.com/2003/OWLFBRuleReasoner> ] ;
      39         ja:baseModel :graph ;
      40         .
      41
      42



What I have found is that if data is entered into the default graph in the
"Data" dataset without the unionDefaultGraph option, this "Reasoner"
dataset (above) will find the information and perform inferences over it.
However, if the data is instead entered into two named graphs, with the
unionDefaultGraph:true option selected, the "Reasoner" dataset is unable to
find the information in "Data". Additionally, the "Reasoner" dataset has no
access to read or write to the "Data" dataset, which is why I set up a
separate end-point to be able to manipulate the data in "Data".



The goal of this experiment is to be able to run different Owl ontologies
over the same entity data, so ideally there would be a way to create a
unionized graph from two named graphs in "Data" and query time, and then
run the inference engine over this graph. So my questions are,



1) Is there a way to create a unionized graph at query time? If yes, is
there a way to run an inference engine over this query-time-created
unionized graph?



2) If the above is not an option, is there a way have an inference engine
run over the unionized default graph from a set of named graphs?



If you have any questions or need more information please feel free to
reach out to me at any time.





Thank you for your help,

Evan Woodward








Reply via email to