获取所有 dbpedia 谓词列表

getting all dbpedia predicate list

我正在尝试获取所有 dbpedia 谓词(属性 的标签)。检查这个 link

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-owldcfoafrdfs

这是基于 my answer to 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

SPARQL results

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