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

Expressing path expressions over nested quoted triples #190

Open
rubensworks opened this issue Jul 7, 2023 · 1 comment
Open

Expressing path expressions over nested quoted triples #190

rubensworks opened this issue Jul 7, 2023 · 1 comment

Comments

@rubensworks
Copy link
Member

Why?

A topic that was recently discussed in the RDF-star WG, is the ability to query nested quoted triples at an unknown depth.

For example, given the following dataset:

:Alice :says << :Bob :says << :Carol :says << :Violets :haveColor :Blue >> >> >>
:Alice :says << :Bob :says << :Violets :haveColor :Yellow >> >>
:Alice :says << :Violets :haveColor :Red >>

If one wants to know all claimed colors of :Violets, there is currently no way to express this in a SPARQL (1.2) query, without knowing all nested quoted triple depths beforehand.

Since this topic is part of a broader problem of generalizing path expressions in SPARQL, the WG decided not to design an ad-hoc solution that is specific to paths over nested quoted triples (given the limited charter of the WG), but defer to a future group. Hence, I am opening this issue here to make sure we keep track of it.

Previous work

This issue is related to proposals for extending property path expressions:

Proposed solution

Some possible solutions to this specific problem of nested quoted triples can be found below.
But ideally, this should be solved in a more generic manner that captures the requirements from the issues linked above.

Extending property path syntax to allow recursing into nested quoted triples:

:Alice :says*' << :Violets :haveColor ?color >>

An alternative approach that is inspired by the GRAPH syntax
could allow the QUOTED keyword to be used to access any quoted triple (at any nested depth):

SELECT ?person ?color {
  {
    QUOTED ?qOuter {
      ?person :says ?qInner
    }
  } UNION { # Union is necessary because :Alice's statement about :Red is not quoted
    ?person :says ?qInner
  }
  QUOTED ?qInner {
    :Violets :haveColor ?color
  }
}

Considerations for backward compatibility

N/A

@sdasguitar
Copy link

Adrian asked me to add the link for the deck of slides that I had presented at the 2022 Knowledge Graph Conference, but I am not sure how I can edit this page. So, I am providing the link here in this comment. Please add it to the "Previous Work" section or wherever appropriate. Thanks.
"Neighborhood-Aware Path Traversal", Souripriya Das.

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

2 participants