Skip to content

SPARQL result mapping should not require explicit types projection #424

Description

@ledsoft

Currently, mapping SPARQL query result to an entity requires the query to explicitly project a ?types variable containing the instance's ontology type. However, the result loader should be able to assume the type from the target entity type and not require the variable value.

That is, a query such as:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?d ?name ?comment ?homepage ?employeeCount ?types WHERE {
  ?d a <http://dbpedia.org/class/yago/WikicatVideoGameDevelopmentCompanies> ;
    foaf:name ?name ;
    a ?types .
  OPTIONAL { ?d rdfs:comment ?comment . }
  OPTIONAL { ?d foaf:homepage ?homepage . }
  OPTIONAL { ?d dbo:numberOfEmployees ?employeeCount . }
} ORDER BY ?name

could be simplified to:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?d ?name ?comment ?homepage ?employeeCount WHERE {
  ?d a <http://dbpedia.org/class/yago/WikicatVideoGameDevelopmentCompanies> ;
    foaf:name ?name .
  OPTIONAL { ?d rdfs:comment ?comment . }
  OPTIONAL { ?d foaf:homepage ?homepage . }
  OPTIONAL { ?d dbo:numberOfEmployees ?employeeCount . }
} ORDER BY ?name

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions