Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify the RDF dataset for a query based on a query #178

Open
jaw111 opened this issue Dec 23, 2022 · 0 comments
Open

Specify the RDF dataset for a query based on a query #178

jaw111 opened this issue Dec 23, 2022 · 0 comments

Comments

@jaw111
Copy link
Contributor

jaw111 commented Dec 23, 2022

Why?

In a dataset named graphs are often used to represent different aspects of resources, see the Graph Per Aspect design pattern. If we want to query a certain 'slice' of the dataset (specifically for patterns and property paths that cross graph boundaries), the FROM and FROM NAMED clauses can be used to enumerate the IRIs of the graphs over which the query will operate, but this can prove impractical for datasets containing hundreds of thousands of named graphs.

Currently this involves running first query to identify the graph IRIs of interest, and using those results to either:

  • Construct the FROM and FROM NAMED clauses in a second query, or
  • Construct the request with appropriate default-graph-uri and named-graph-uri query (string) parameters per SPARQL 1.1 Protocol

Previous work

Unknown

Proposed solution

Extend the grammar for FROM and FROM NAMED to allow SubSelect:

[16]  	SourceSelector	  ::=  	[iri](https://www.w3.org/TR/sparql11-query/#riri) | '{' [SubSelect](https://www.w3.org/TR/sparql11-query/#rSubSelect) '}'

Whereby the subselect should project a single variable whose values are used as the graph IRIs.

For example:

SELECT *
FROM {
  SELECT DISTINCT ?g {
    graph ?g {
      ?s dc:created ?created .
      FILTER (?created > "2022-12-23"^^xsd:date)
    }
  }
}
WHERE {
  ?s a ?type .
}

Considerations for backward compatibility

Extension of the specification, so none foreseen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant