Sparqlify icon indicating copy to clipboard operation
Sparqlify copied to clipboard

Query rewriting without graph materialization

Open tokarenko opened this issue 2 years ago • 0 comments

Please advise if Sparqlify is capable for query rewriting without graph materialization?

I am looking for a way to translate the following SPARQL query ...

SELECT ?interface ?ip WHERE { ?interface network:hasIpAddress ?ip. ?ip network:containedWithin "192.168.1.0/24". }

or, alternatively:

SELECT ?interface ?ip WHERE { ?interface network:hasIpAddress ?ip. FILTER(?ip IN "192.168.1.0/24"). }

... to the following SQL query:

SELECT interface, ip FROM interfaces WHERE ip_address << "192.168.1.0/24"

"<<=" operator in SQL WHERE statement is specific to PostgreSQL type "inet": https://www.postgresql.org/docs/9.3/functions-net.html

For a general case, "192.168.1.0/24" may be considered as parameter that must be passed down from SPARQL to SQL for handling without materialization.

I would be grateful if you could suggest alternatives if it is not possible with Sparqlify.

tokarenko avatar Aug 30 '23 14:08 tokarenko