SPARQL - learning by example

十年热恋 提交于 2019-12-11 09:42:45

问题


In short, if someone instructs me, "Get a list of databases which include Oracle, Mysql, DB2, MSSQL, etc.," how can I actually establish which fields and information I need to create the query? I downloaded DBpedia and grepped the triples, e.g.,

$ `grep 'Oracle' * | grep 'Database'
article_categories_en.nt:<http://dbpedia.org/resource/Oracle_Database> <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Relational_database_management_systems> .`

How do I create a SPARQL query from that initial question? Using that snippet above, I know Oracle is a company and one of its products is an RDBMS by the same name. I tried the lookup tool and searching the web but did not get far enough with this and need some direction.


回答1:


In this particular case, I'd start by visiting the DBpedia page corresponding to one of the things that you know you'd like in your result. A good instance is http://dbpedia.org/page/MySQL. On that page, you can start to look for properties that might help you find other related systems. One property listed on the page is

dbpedia-owl:genre dbpedia:Relational_database_management_system

Then I'd go the DBpedia SPARQL endpoint and try searching for other things that have this same property and value. In this case, I can run the following query:

SELECT * WHERE { 
  ?rdbms dbpedia-owl:genre dbpedia:Relational_database_management_system .
}

SPARQL results

The results are pretty promising; there are 38 results. The first few are:

rdbms
http://dbpedia.org/resource/MySQL_Cluster
http://dbpedia.org/resource/MSQL
http://dbpedia.org/resource/OpenEdge_Advanced_Business_Language
http://dbpedia.org/resource/Adaptive_Server_Enterprise
…

In general, I find it much easier to locate an instance of the sort of thing that I'm looking for in Wikipedia, then visit the corresponding DBpedia page and look at the properties, and then formulate some exploratory queries based on that.



来源:https://stackoverflow.com/questions/17221869/sparql-learning-by-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!