ge-semtk / semtk

Drag and drop SPARQL queries and data ingestion for virtuoso and soon other SPARQL endpoints
http://semtk.research.ge.com
Other
37 stars 6 forks source link

Improve SPARQL gen with type THING #405

Closed cuddihyge closed 1 year ago

cuddihyge commented 1 year ago

Using RACK SAME_AS query as an example, queries that have a node of type THING generate sparql with very long type clauses for FILTER IN.

Auto-generated queries are unusably slow.

Explore solutions:

  1. optimization logic that decides to use VALUES clause for types instead of subclassOf* may need to take into account the number of subclasses
  2. optimization logic that decides the type is needed on a node should (?) be able to drop the clause altogether given that the node type THING is the same as the range of the incoming connection (primary or secondary)

Image

select distinct ?SAME_AS ?THING ?THING_0
        FROM <http://rack001/data>
        FROM <http://rack001/model>
 where {
    VALUES ?THING_0_type { REQUIREMENTS:REQUIREMENT Boeing:CSID_Req Boeing:PIDS_Req Boeing:SRS_Req SRI_SS:SecurityRequirement SRI_SS:SafetyRequirement SRI:SoftwareHighLevelRequirement SRI:SoftwareLowLevelRequirement Boeing:SubDD_Req SRI:SystemRequirement  } .
    ?THING_0 a ?THING_0_type .
    ?SAME_AS RESOLUTIONS:secondary ?THING_0 .
        ?SAME_AS a RESOLUTIONS:SAME_AS .
        ?SAME_AS RESOLUTIONS:primary ?THING .
            VALUES ?THING_type { REQUIREMENTS:REQUIREMENT Boeing:CSID_Req Boeing:PIDS_Req Boeing:SRS_Req SRI_SS:SecurityRequirement SRI_SS:SafetyRequirement SRI:SoftwareHighLevelRequirement SRI:SoftwareLowLevelRequirement Boeing:SubDD_Req SRI:SystemRequirement  } .
            ?THING a ?THING_type .
}