SmartDataAnalytics/Sparqlify

Suboptimal query generation:

Aklakan opened this issue · 0 comments

The query for finding the latest version of a GA (groupId-artifactId) pair, creates a union over all label tables - although by the constraints it should be clear, that there can only be a single table backing each of the label triples.

Select ?gl ?al ?vl {

  ?s <http://dcat.cc/ontology/groupId> ?g .
  ?s <http://dcat.cc/ontology/artifactId> ?a .
  ?s <http://dcat.cc/ontology/version> ?v .

  Optional {
    ?s2 <http://dcat.cc/ontology/groupId> ?g .
    ?s2 <http://dcat.cc/ontology/artifactId> ?a .
    ?s2 <http://dcat.cc/ontology/version> ?v2 .
    Filter(?v2 > ?v)
  }
  Filter(!Bound(?v2))

  ?g <http://www.w3.org/2000/01/rdf-schema#label> ?gl .
  ?a <http://www.w3.org/2000/01/rdf-schema#label> ?al .
  ?v <http://www.w3.org/2000/01/rdf-schema#label> ?vl .
}