0

我对 SPARQL 很陌生,所以请多多包涵。我正在使用 Apache Jena 将我的 RDF 存储在不同的命名图中,我有这些 RDF 命名图:

端点名称:http://localhost:3030/2012-2013/query

命名图:

<http://localhost:3030/2012-2013/data/2012-2013_62DAYBYCANCER>
<http://localhost:3030/2012-2013/data/2012-2013_62_DAY_CANCER_PLAN_ALL_CANCER>
<http://localhost:3030/2012-2013/data/2012-2013_62_DAY_CRS_SCEENING>

在另一个端点我有这些命名图:

端点名称: http://localhost:3030/2013-2014/query

命名图:

<http://localhost:3030/2013-2014/data/2013-2014_62DAYBYCANCER>
<http://localhost:3030/2013-2014/data/2013-2014_62_DAY_CANCER_PLAN_ALL_CANCER>
<http://localhost:3030/2013-2014/data/2013-2014_62_DAY_CRS_SCEENING>

我想访问图中的三元组2012-2013_62DAYBYCANCER并将它们加入到三元组中2013-2014_62DAYBYCANCER。是否可以同时使用命名图和服务?

图表的结构如下所示。我想和他们provider一起period-type获得total.

对于图2012-2013_62DAYBYCANCER,结构是:

<rdf:Description rdf:about="http://mastersrdf.org/dataset/2012_2013_62DAYBYCANCER/1"> 
    <qb:dataSet rdf:resource="http://mastersrdf.org/dataset/2012_2013_62DAYBYCANCER"/>
    <provider xmlns="http://mastersrdf.org/def/statistical-dimension/" rdf:resource="http://mastersrdf.org/hull-and-east-yorkshire-hospitals-nhs-trust"/>
    <total xmlns="http://mastersrdf.org/def/statistical-dimension/">4</total>
    <period-type xmlns="http://mastersrdf.org/def/statistical-dimension/" rdf:resource="http://mastersrdf.org/q1"/>
</rdf:Description>

对于图2013-2014_62DAYBYCANCER,结构是:

<rdf:Description rdf:about="http://mastersrdf.org/dataset/2013_2014_62DAYBYCANCER/1"> 
    <qb:dataSet rdf:resource="http://mastersrdf.org/dataset/2013_2014_62DAYBYCANCER"/>
    <provider xmlns="http://mastersrdf.org/def/statistical-dimension/" rdf:resource="http://mastersrdf.org/hull-and-east-yorkshire-hospitals-nhs-trust"/>
    <total xmlns="http://mastersrdf.org/def/statistical-dimension/">50</total>
    <period-type xmlns="http://mastersrdf.org/def/statistical-dimension/" rdf:resource="http://mastersrdf.org/q1"/>
</rdf:Description>
4

1 回答 1

2

是否可以同时使用命名图和服务?

是的。子句中的模式SERVICE需要包含一个GRAPH子句。SERVICE(子句在子句中不会获得所需的结果GRAPH。)

于 2017-12-22T14:48:34.273 回答