如何使用Sparql查询在dbpedia中选择具有特定属性的资源?
我有疑问--如何使用Sparql查询在dbpedia中选择具有特定属性的资源?,sparql,rdf,semantic-web,dbpedia,apache-jena,Sparql,Rdf,Semantic Web,Dbpedia,Apache Jena,我有疑问-- 如您所见,所有主题都是您在查询中混合了不同的实体:实例通过rdf:type断言到类,属性确实有域和范围,类通过rdfs:subassof与其他类相关。我认为您的查询需要进行重大更改才能获得所需的结果。像这样的实体不具有rdfs:domain或rdfs:range,尽管它们通常具有rdf:type。也许你应该让我们更好地了解你想要达到的目标以及原因(因为这对我来说更像是一个家庭作业)。 PREFIX rdf: <http://www.w3.org/1999/02/22-r
如您所见,所有主题都是
您在查询中混合了不同的实体:实例通过rdf:type断言到类,属性确实有域和范围,类通过rdfs:subassof
与其他类相关。我认为您的查询需要进行重大更改才能获得所需的结果。像
这样的实体不具有rdfs:domain
或rdfs:range
,尽管它们通常具有rdf:type
。也许你应该让我们更好地了解你想要达到的目标以及原因(因为这对我来说更像是一个家庭作业)。
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
#select count(DISTINCT ?instance) # The number of suitable instances
#select DISTINCT ?instance ?type # Full Ground-truth dataset
select DISTINCT ?instance ?domain ?range ?subClassOf # Full Algorithm input dataset (sampling might be required)
where {
?instance rdf:type ?type;
rdfs:domain ?domain;
rdfs:range ?range;
rdfs:subClassOf* ?subClassOf.
}
ORDER BY ?instance
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/2000/01/rdf-schema#domain> <http://dbpedia.org/ontology/AutomobileEngine> .
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#FunctionalProperty> .
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/2001/XMLSchema#double> .
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/ns/prov#wasDerivedFrom> <http://mappings.dbpedia.org/index.php/OntologyProperty:torqueOutput> .
<http://dbpedia.org/ontology/torqueOutput> <http://www.w3.org/2000/01/rdf-schema#label> "torque output (Nm)"@en .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/2000/01/rdf-schema#domain> <http://dbpedia.org/ontology/AutomobileEngine> .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#FunctionalProperty> .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/2001/XMLSchema#double> .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/ns/prov#wasDerivedFrom> <http://mappings.dbpedia.org/index.php/OntologyProperty:displacement> .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/2000/01/rdf-schema#label> "cilindrada (μ³)"@es .
<http://dbpedia.org/ontology/displacement> <http://www.w3.org/2000/01/rdf-schema#label> "displacement (μ³)"@en .
<http://dbpedia.org/resource/Otto_Georg_Thierack> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://dbpedia.org/resource/Otto_Georg_Thierack> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Person> .
<http://dbpedia.org/resource/Otto_Georg_Thierack> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Agent> .
<http://dbpedia.org/resource/Otto_Georg_Thierack> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
<http://dbpedia.org/resource/Otto_Georg_Thierack> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> .
<http://dbpedia.org/resource/Erich_Wasicky> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> .
<http://dbpedia.org/resource/Erich_Wasicky> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Person> .
<http://dbpedia.org/resource/Erich_Wasicky> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Agent> .
<http://dbpedia.org/resource/Erich_Wasicky> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .