本文介绍了DBpedia数据集中的哪个.nt文件包含有关DBpedia类的三元组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在研究DBpedia数据集,并使用Apache Jena对本地Jena TDB数据集执行SPARQL。我从 DBpedia下载中仅下载了一些文件,以便可以将数据集的大小保持为最小值,但执行以下类型的SPARQL查询时没有结果:I am working on a DBpedia dataset and using Apache Jena to execute SPARQL over a local Jena TDB dataset. I have downloaded only some of the files from DBpedia Downloads so that I could keep the size of my dataset to a minimum, but I get no results when I execute a SPARQL query of the kind: Select distinct * WHERE {<http://dbpedia.org/ontology/Person> ?x ?y} LIMIT 5但是,如果我在 Virtuoso客户,我得到了有效的结果。However, if I run the same query on the Virtuoso client, I get valid results.哪个。 nt文件包含以下格式的URI三元组:Which .nt file contains the URI triple of the form: http://dbpedia.org/ontology/Person http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Class 含义,即.nt文件在下载中,需要添加到我的本地Jena TDB数据集中吗?Meaning, which .nt file in Downloads, needs to be added in my local Jena TDB dataset? PS我的数据集中已经有本体信息框类型,其中包含三元形式的$ object rdf:type $ class。P.S. I already have Ontology Infobox Types in my dataset which contains triples of the form $object rdf:type $class .推荐答案您可以找出 三元组的来源是使用 GRAPH ,例如One thing you can do to figure out where triple are coming from is to use a GRAPH, as in SELECT DISTINCT * WHERE {GRAPH ?g { <http://dbpedia.org/ontology/Person> ?x ?y }}LIMIT 20使用维塔索客户端,找到与没有查询的查询相同的三元组,但是会向您显示从中获得了哪些图形三元组,例如which, using the Virtuoso client, finds the same triples as the query without them, but will show you which graph triples were obtained from, e.g., http://dbpedia.org rdf:type owl:Classhttp://dbpedia.org/resource/classes# rdf:type owl:Class现在,我想 http://dbpedia.com 是一个默认图形,其中包含所有其他图形的三元组,因此有趣的地方可能是 http://dbpedia.org/resource/classes# 。基于Ben Companjen的回答,我尝试使用本体数据集,并在运行以下查询(如您的查询,但没有 LIMIT 5 )时Now, I imagine that http://dbpedia.com is a default graph that contains the triples from all the others, so the interesting one here is probably http://dbpedia.org/resource/classes#. Based on Ben Companjen's answer, I tried using the Ontology dataset, and when I run the following query (like yours, but without the LIMIT 5)PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX owl: <http://www.w3.org/2002/07/owl#>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>SELECT DISTINCT * WHERE { <http://dbpedia.org/ontology/Person> ?p ?o} 我得到的结果是< ; http://dbpedia.org/ontology/Person> owl:Class (这是最后一行的下一行)。如果原始查询中存在 LIMIT 5 ,则可能看不到该特定结果。I get the result that <http://dbpedia.org/ontology/Person> a owl:Class (it's the next to last row). If the LIMIT 5 is present in the original query, you may not be seeing that particular result.$ /usr/local/lib/apache-jena-2.10.0/bin/arq \ --data ~/Downloads/dbpedia_3.8.owl \ --query dbpedia.sparql -------------------------------------------------------------| p | o |=============================================================| rdfs:label | "person"@en || rdfs:label | "persona"@es || rdfs:label | "Person"@de || rdfs:label | "pessoa"@pt || rdfs:label | "personne"@fr || owl:equivalentClass | <http://schema.org/Person> || rdfs:label | "Πληροφορίες προσώπου"@el || rdfs:label | "Oseba"@sl || owl:equivalentClass | <http://xmlns.com/foaf/0.1/Person> || rdf:type | owl:Class || rdfs:subClassOf | <http://dbpedia.org/ontology/Agent> |------------------------------------------------------------- 这篇关于DBpedia数据集中的哪个.nt文件包含有关DBpedia类的三元组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-30 18:55