0

I have the query --

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

-- which returns all the triples which have type, domain, and range properties. The resultset is like --

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

As you see, all the subjects are <http://dbpedia.org/ontology/...... but I would like to have the <http://dbpedia.org/resource/.... as my subjects. Is there any way to have them? My desired triples would look like this:

<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>  .
TallTed
  • 9,069
  • 2
  • 22
  • 37
  • 1
    You are mixing up different entities in your query: instances are asserted to classes via rdf:type, properties do have domain and range, and classes are related to others via `rdfs:subClassOf`. – UninformedUser Jun 22 '17 at 18:25
  • I think your query needs major changes for your desired result. Entities like `` do not have `rdfs:domain` nor `rdfs:range`, though they will typically have `rdf:type`. Perhaps you should give us a better idea of what you're trying to achieve, and why (as this looks rather like a homework assignment to me). – TallTed Jun 27 '17 at 16:39

0 Answers0