我正在尝试获取所有dbpedia谓词(属性标签)。检查此链接
http://dbpedia.org/page/Akshay_Kumar
我想得到,
dbpedia-owl:abstract
dbpedia-owl:birthDate
dcterms:subject
dc:description
rdfs:label
owl:sameAs
foaf:givenName
简而言之,左列的所有属性。不仅仅是这个实体,而是整个列表。
请注意,只能使用以下方式恢复属性:
select distinct ?property where {
?instance a <http://dbpedia.org/ontology/Person> .
?instance ?property ?obj . }
或
SELECT * { ?x a rdf:Property }
但我希望使用prefix
,dbpedia-owl
,dc
,foaf
,rdfs
等
答案 0 :(得分:3)
这是基于对my answer到SPARQL query to get all class label with namespace prefix defined的修改。
select distinct ?prettyName ?property where {
#-- get distinct properties that are used on Persons
{ select distinct ?property where {
[ a dbpedia-owl:Person ; ?property [] ]
} }
#-- specify some URIs that are used as
#-- prefixes and the prefix name that
#-- gets used
values (?prefixURI ?prefixName) {
(dbpedia-owl: "dbpedia-owl")
(dbpprop: "dbpprop")
(foaf: "foaf")
#-- ...more...
}
#-- only consider those properties that
#-- begin with one of the prefixes
filter strstarts(str(?property),str(?prefixURI))
#-- generate the pretty name
bind(concat(?prefixName,":",strafter(str(?property),str(?prefixURI))) as ?prettyName)
}
limit 1000
prettyName property
-------------------------------------------------------
dbpprop:hasPhotoCollection http://dbpedia.org/property/hasPhotoCollection
dbpprop:subWins http://dbpedia.org/property/subWins
foaf:homepage http://xmlns.com/foaf/0.1/homepage
dbpedia-owl:wikiPageExternalLink http://dbpedia.org/ontology/wikiPageExternalLink
...