Message Boards Message Boards

Use SPARQLExecute for SPARQLSelect on Entities?

Posted 6 years ago

Cross-posted on Mma.SE, 197438.

When using SPARQLSelect on Entity Types the entire entity store is downloaded to the local cache.

For example,

SPARQLSelect[
  {
     RDFTriple[SPARQLVariable["city"], EntityProperty["City", "Name"],
       SPARQLVariable["cityName"]]
     } /; 
    SPARQLEvaluation["CONTAINS"][SPARQLVariable["cityName"], 
     "Lon"] -> 
   {"city"}
  ][Entity["City"]]

Mathematica graphics

This first downloads 164,599 entity values to the local cache before evaluating the query locally.

With SPARQLExecute the query can be evaluated on the graph database server and only the results returned. However I have not been able to find the Wolfram graph-store entity URL in the documentation.

Is there a way to SPARQLExecute an entity query on the Wolfram graph-store URL? Or, alternatively, execute the SPARQL query without it killing the kernel?

I would like to evaluate the following but, after the entity stores are downloaded, the kernel dies just after a system low memory warning pop-up appears.

SPARQLSelect[
  {
     RDFTriple[SPARQLVariable["city"], EntityProperty["City", "Name"],
       SPARQLVariable["cityName"]],
     RDFTriple[SPARQLVariable["airport"], 
      EntityProperty["Airport", "Name"], SPARQLVariable["airportName"]]
     } /; 
    SPARQLEvaluation["CONTAINS"][SPARQLVariable["airportName"], 
     SPARQLVariable["cityName"]] -> 
   {"city", "airport"}
  ][{Entity["City"], Entity["Airport"]}]
POSTED BY: Edmund Robinson
3 Replies
Posted 6 years ago

Hi Edmund. Thanks for your report. The Wolfram Knowledge base is currently not a SPARQL endpoint, so the query is evaluated locally. This means that in some cases, a lot of data has to be downloaded and processed. The second example exhausts all memory because the query is not evaluated in the optimal way. I have filed a suggestion for it.

POSTED BY: Toni Schindler

Thank you for looking into it.

Do you think the fix for querying could come as a paclet update or does it need to be updated by installation of a new version of Mathematica?

POSTED BY: Edmund Robinson
Posted 6 years ago

We don't have an estimate for a fix yet.

POSTED BY: Toni Schindler
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract