如何选择 rdf 可能的标签之一将其发送到联合搜索?
我有一个 rdf 记录,它有几个指向另一个数据库的链接:
<owl:sameAs rdf:resource="http://cantic.bnc.cat/registres/CUCId/a10035400"/>
<owl:sameAs rdf:resource="http://viaf.org/viaf/61502721"/>
<owl:sameAs rdf:resource="http://dbpedia.org/resource/Delfi_Abella"/>
<owl:sameAs rdf:resource="http://id.loc.gov/authorities/names/nr2005020137"/>
<owl:sameAs rdf:resource="http://d-nb.info/gnd/158288475"/>
我只是得到了 dbpedia 链接来使用它在 dbpedia 中询问一些信息。
我创建了这个联合搜索,但它不起作用:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl/>
PREFIX rdaGr2: <http://rdvocab.info/ElementsGr2/>
PREFIX dbo:<http://dbpedia.org/ontology/>
SELECT *
WHERE {
?autid rdaGr2:dateOfBirth "1991" .
?autid owl:sameAs ?dbpediaid
FILTER regex(?dbpediaid,'dbpedia','i') .
SERVICE <http://dbpedia.org/sparql>
{
?dbpediaid dbo:birthPlace ?naixement
}
}
我做错了什么?
如果我使用单一搜索:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl/>
PREFIX rdaGr2: <http://rdvocab.info/ElementsGr2/>
PREFIX dbo:<http://dbpedia.org/ontology/>
SELECT *
WHERE {
?autid rdaGr2:dateOfBirth "1991" .
?autid owl:sameAs ?dbpediaid
FILTER regex(?dbpediaid,'dbpedia','i') .
}
我得到了 autid 和 dbpedia 链接。
autid dbpediaid
http://arties.cbuc.cat/openccuc/a10985256/ http://dbpedia.org/resource/Emma_Roberts
我怎么能告诉 SERVIE 只是使用它。
问候
更新(最初作为答案发布)
也许我问的问题很糟糕:
我尝试在一个中做两种不同的 sparql。使用问题第一部分的结果(已应用过滤器)我尝试询问 DBPEDIA 以获得我需要的结果。
从没有任何过滤器的第一部分
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX void: <http://rdfs.org/ns/void#>
PREFIX owl: <http://www.w3.org/2002/07/owl/>
PREFIX rdaGr2: <http://rdvocab.info/ElementsGr2/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbo:<http://dbpedia.org/ontology/>
SELECT *
WHERE {
?autid rdaGr2:dateOfBirth "1991" .
?autid owl:sameAs ?dbpediaid
}
我得到这个结果:
http://arties.cbuc.cat/openccuc/a10603050/ http://cantic.bnc.cat/registres/CUCId/a10603050
http://arties.cbuc.cat/openccuc/a10603050/ http://viaf.org/viaf/169463957
http://arties.cbuc.cat/openccuc/a10667283/ http://cantic.bnc.cat/registres/CUCId/a10667283
http://arties.cbuc.cat/openccuc/a10667283/ http://viaf.org/viaf/303916880
http://arties.cbuc.cat/openccuc/a10895814/ http://cantic.bnc.cat/registres/CUCId/a10895814
http://arties.cbuc.cat/openccuc/a10895814/ http://viaf.org/viaf/107201286
http://arties.cbuc.cat/openccuc/a10895814/ http://d-nb.info/gnd/140511695
http://arties.cbuc.cat/openccuc/a10895814/ http://id.loc.gov/authorities/names/no2010103795
http://arties.cbuc.cat/openccuc/a10985256/ http://cantic.bnc.cat/registres/CUCId/a10985256
http://arties.cbuc.cat/openccuc/a10985256/ http://viaf.org/viaf/85925873
http://arties.cbuc.cat/openccuc/a10985256/ http://id.loc.gov/authorities/names/no2005021393
http://arties.cbuc.cat/openccuc/a10985256/ http://d-nb.info/gnd/141167203
http://arties.cbuc.cat/openccuc/a10985256/ http://dbpedia.org/resource/Emma_Roberts
http://arties.cbuc.cat/openccuc/a11019682/ http://cantic.bnc.cat/registres/CUCId/a11019682
http://arties.cbuc.cat/openccuc/a11019682/ http://viaf.org/viaf/157747131
http://arties.cbuc.cat/openccuc/a11045553/ http://cantic.bnc.cat/registres/CUCId/a11045553
http://arties.cbuc.cat/openccuc/a11045553/ http://viaf.org/viaf/126161085
我应用过滤器
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX void: <http://rdfs.org/ns/void#>
PREFIX owl: <http://www.w3.org/2002/07/owl/>
PREFIX rdaGr2: <http://rdvocab.info/ElementsGr2/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbo:<http://dbpedia.org/ontology/>
SELECT *
WHERE {
?autid rdaGr2:dateOfBirth "1991" .
?autid owl:sameAs ?dbpediaid
FILTER regex(?dbpediaid,'dbpedia','i') .
}
只得到一个结果:
http://arties.cbuc.cat/openccuc/a10985256/ http://dbpedia.org/resource/Emma_Roberts
我想将它发送到 DBPEDIA 的服务,但只需发送此 URL: http ://dbpedia.org/resource/Emma_Roberts
不是我从第一部分获得的所有 URL:
http://cantic.bnc.cat/registres/CUCId/a10603050
http://viaf.org/viaf/169463957
http://cantic.bnc.cat/registres/CUCId/a10667283
http://viaf.org/viaf/303916880
http://cantic.bnc.cat/registres/CUCId/a10895814
http://viaf.org/viaf/107201286
http://d-nb.info/gnd/140511695
http://id.loc.gov/authorities/names/no2010103795
http://cantic.bnc.cat/registres/CUCId/a10985256
http://viaf.org/viaf/85925873
http://id.loc.gov/authorities/names/no2005021393
http://d-nb.info/gnd/141167203
http://dbpedia.org/resource/Emma_Roberts
因为其中一些与 Dbpedia 无关,然后 DBPEDIA 向我发送如下错误:
Virtuoso RDFZZ Error DB.DBA.SPARQL_REXEC('http://dbpedia.org/sparql', ...) returned Content-Type 'text/plain' status 'HTTP/1.1 400 Bad Request
'
Virtuoso 37000 Error SP030: SPARQL compiler, line 3: syntax error at '_' before ':'
SPARQL query:
define sql:big-data-const 0 SELECT ?naixement
WHERE { <http://dbpedia.org/resource/Emma_Roberts> <http://dbpedia.org/ontology/birthPlace> ?naixement .
FILTER (_::default-20-7 = <http://arties.cbuc.es:8990/CCUCAF>) }
SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define sql:signal-void-variables 1 define get:soft "soft" define input:default-graph-uri <http://arties.cbuc.es:8990/CCUCAF> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX void: <http://rdfs.org/ns/void#>
PREFIX owl: <http://www.w3.org/2002/07/owl/>
PREFIX rdaGr2: <http://rdvocab.info/ElementsGr2/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbo:<http://dbpedia.org/ontology/>
SELECT ?naixement
WHERE {
?autid rdaGr2:dateOfBirth "1991" .
?autid owl:sameAs ?dbpediaid
filter regex( str(?dbpediaid),'dbpedia','i')
SERVICE <http://dbpedia.org/sparql>
{
?dbpediaid dbo:birthPlace ?naixement
}