How to use SPARQL on SQL triples

61 Views Asked by At

I'd like to combine triples from ontologies with data that was exposed via TDEs, to prevent having to expose the data both as TDE views, and as triples. However, subjects and predicates from TDE data don't behave as regular IRIs. I have learned that TDE view subjects are actually sql:rowIds (see also https://stackoverflow.com/a/61679309/918496), but that knowledge hasn't helped me use them in a where clause, unless using an expensive filter expression.

I was hoping there is a way to run a query something like this:

select *
where {
  <http://marklogic.com/row/3B89C3F7B234C80F/00001E041393E29F> ?p ?o.
}
limit 10

Instead of doing something like this:

select *
where {
  ?s ?p ?o.
  filter( str(?s) = "4290175588661250063:33002857161375" )
}
limit 10

Note the fact that "4290175588661250063:33002857161375" doesn't quite seem to match http://marklogic.com/row/3B89C3F7B234C80F/00001E041393E29F, but that does appear to be the str value of the rowId.

1

There are 1 best solutions below

3
John Snelson On

Use the sql:rowId() function to construct a row ID from the string representation.