如果它包含文字
,我正试图通过名字获得公司示例:本田汽车有限公司
地图到:https://www.wikidata.org/wiki/Q9584
我有这个成功找到苹果的查询
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/property/>
select distinct ?iri ?logo ?description {
?iri a dbpedia-owl:Company ;
dbpedia-owl:abstract ?description ;
rdfs:label ?lbl ;
foaf:depiction|dbpedia-owl:thumbnail ?logo .
?lbl bif:contains "'apple'"@en .
filter( langMatches(lang(?description),"en") )
}
返回结果,因为它匹配'Apple Inc' http://dbpedia.org/page/Apple_Inc
但下面的查询与埃森哲不匹配
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/property/>
select distinct ?iri ?logo ?description {
?iri a dbpedia-owl:Company ;
dbpedia-owl:abstract ?description ;
rdfs:label ?lbl ;
foaf:depiction|dbpedia-owl:thumbnail ?logo .
?lbl bif:contains "'accenture'"@en .
filter( langMatches(lang(?description),"en") )
}
我希望:http://dbpedia.org/page/Accenture 但什么都没得到
答案 0 :(得分:4)
并非RDF中的每个资源都必须包含所有属性!在您的情况下,徽标不存在,这意味着您应该将其作为可选功能:
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?iri ?logo ?description {
?iri a dbpedia-owl:Company ;
dbpedia-owl:abstract ?description ;
rdfs:label ?lbl .
?lbl bif:contains "'accenture'"@en .
FILTER( langMatches(lang(?description),"en") )
OPTIONAL {?iri foaf:depiction|dbpedia-owl:thumbnail ?logo }
}