Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

sparql - Get all properties for a DBpedia class

How to get a list of properties for a specific class? Consider the class dbpedia-owl:Person. All instances of the Person class have some properties prefixed with dbpprop:. How can I get all the dbpprop: properties that we may find for all the instance of the Person class?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The one that works is:

select distinct ?property where { 
   ?property <http://www.w3.org/2000/01/rdf-schema#domain> 
                             <http://dbpedia.org/ontology/Person> . }

In this query you are asking for all the properties that have dbpedia:Person as rdfs:domain. This query requires a schema definition to work and sometime datasets don't really follow perfectly the schemas. For those datasets you would try this other query

select distinct ?property where {
         ?instance a <http://dbpedia.org/ontology/Person> . 
         ?instance ?property ?obj . }

This query looks at every instance of person binding every property that comes out of it. It is much harder than the first one, and in the dbpedia public instance you will get a time out. So you are better off with the first one if you want to use the public endpoint.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...