命名图表v Apache Jena Fuseki中的默认图表行为

时间:2017-11-30 08:13:41

标签: jena fuseki

我们正在运行Apache Jena Fuseki。

如果我们上传graphA和graphB

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

给出100

如果我们将A和B中的三元组上传到默认

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

给出200

似乎在FROM示例中graphA和graphB之间没有进行推理?

我们如何解决这个问题?

找到Reasoning with Fuseki, TDB and named graphs?,但不明白是否是同一个问题。

示例数据: 图A:

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

图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" .

查询:

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

没有给出推断     Mddemobank:Sub_Account_Balance subClassOf Mdworking:Measure

尝试了查询

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

从A,B和默认值返回三元组,但不显示被感染的三元组。

环境:

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

这是汇编程序文件

@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" .

0 个答案:

没有答案