Named Graphs v Default Graph behaviour in Apache Jena Fuseki
Asked Answered
F

0

9

We are running Apache Jena Fuseki.

If we upload graphA and graphB

SELECT (COUNT(*) as ?count) 
FROM <graphA> 
FROM <graphB> 
WHERE { ?s ?p ?o . }

gives 100

If we upload triples in A and B into Default

SELECT (COUNT(*) as ?count) 
WHERE { ?s ?p ?o . }

gives 200

It seems there is no inferencing happening between graphA and graphB in the FROM example?

How do we fix this?

Found Reasoning with Fuseki, TDB and named graphs? but dont understand if it is the same problem.

Example data: Graph A:

Mdworking:Measure
  a       owl:Class ;
  mdmm:elementName "Measure" .

Graph B:

Mddemobank:Account_Balance
  a       owl:Class ;
  rdfs:subClassOf Mdworking:Measure ;
  mdmm:elementName "Account_Balance" .

Mddemobank:Sub_Account_Balance
  a       owl:Class ;
  rdfs:subClassOf Mddemobank:Account_Balance ;
  mdmm:elementName "Sub_Account_Balance" .

Query:

SELECT ?subject ?predicate ?object
FROM <A>
FROM <B>    
WHERE {
  ?subject ?predicate ?object
}

does not give the inferred Mddemobank:Sub_Account_Balance subClassOf Mdworking:Measure

Tried the query

SELECT *
{
    { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }  
}

which returns triples from A, B and default, but does not show infered tripples.

Environment:

* Tested version 2.6.0 on Ubuntu
* Tested version 3.4.0. on Windows 10
* Loaded the test files using the browser 

Here is the assembler file

@prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

@prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .


# THE SERVICE
<service1>        a                        fuseki:Service ;
        fuseki:dataset                    <#dataset> ;
        fuseki:name                       "xxx" ;
        fuseki:serviceQuery               "query" , "sparql" ;
        fuseki:serviceReadGraphStore      "get" ;
        fuseki:serviceReadWriteGraphStore "data" ;
        fuseki:serviceUpdate              "update" ;
        fuseki:serviceUpload              "upload" .

# DATASET for the service
<#dataset>         rdf:type ja:RDFDataset ;
    rdfs:label "xxx" ;
    ja:defaultGraph <#model_inf> 
     .

# MODEL for dataset
<#model_inf> a ja:InfModel ;
     ja:baseModel <#tdbGraph> ;
     ja:reasoner [
         ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner>
     ] .


# Graph for the default Model
<#tdbGraph> rdf:type tdb:GraphTDB;
    tdb:dataset <#tdb_dataset_readwrite> .

# Dataset for the Graph
<#tdb_dataset_readwrite>
        a             tdb:DatasetTDB ;
        tdb:unionDefaultGraph true ; 
        #if you want all data to available in the default graph
        #without 'FROM-NAMing them' in the SPARQL query
        tdb:location  "C:\\Programs_other\\apache-jena-fuseki-3.4.0\\apache-jena-fuseki-3.4.0\\run/databases/xxx" .
Foyer answered 30/11, 2017 at 8:13 Comment(1)
Depends on the data, how it was loaded and whether blank nodes are involved. Please provide a Minimal, Complete, Verifiable Example: stackoverflow.com/help/mcve and system details (versions etc)Gouge

© 2022 - 2024 — McMap. All rights reserved.