-
Notifications
You must be signed in to change notification settings - Fork 20
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
SPARQL-friendly lists #46
Comments
+1M. See also here (issue 3): http://manu.sporny.org/2014/json-ld-origins-2/ ... Note that it could be straightforward to add extra semantics, i.e., on top of a triple-based representation, to implement these kinds of list predicates. |
+1 . cc @azaroth42 |
SHACL also makes use of lists to express paths, so improving list support might make SHACL processing easier too. |
@jaw111 I don't quite understand the syntax you're using here. The proposal for Is the intention to use it like <articles/1234> ex:tagList ("travel" "iceland" "winter"). And query: SELECT ?tag ?idx {
<articles/1234> ex:tagList ?tags
VALUES (?tag ?idx) OF listMembers(?tags)
} With the result you gave. This would cover the functionality provided by Jena's |
Some discussion on the mailing list about length-bounded property paths seems relevant too, since a path like |
@cygri you are correct, using a list there does not make much sense. Must have missed a trick earlier. @tayloj expanding on your suggestion, how about using a variable instead of an integer for the path length? So a path like |
@jaw111 That'd certainly be useful, but I have no idea how feasible it is. I think there were already difficulties in implementing |
FWIW, Virtuoso still supports the |
@TallTed does Virtuoso use the bag semantics of expanding that to a BGP/union equivalent, or the set semantics of just limiting the length of a |
I know @dydra also supports that syntax, including {n,} and {,m} cases.
…-------- Original message --------
From: Gregory Todd Williams <[email protected]>
Date: 01/05/2019 18:34 (GMT+02:00)
To: w3c/sparql-12 <[email protected]>
Cc: John Walker <[email protected]>, Mention <[email protected]>
Subject: Re: [w3c/sparql-12] SPARQL-friendly lists (#46)
@TallTed<https://github.com/TallTed> does Virtuoso use the bag semantics of expanding that to a BGP/union equivalent, or the set semantics of just limiting the length of a + path?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#46 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAS5B7PWDVETIYIACBJCXALPTGZ6RANCNFSM4HDNJYRA>.
|
@kasei - Good question, to which I don't immediately have the answer. @IvanMikhailov or @kidehen may be able to shed some light. |
@kidehen Yes, except for the |
Okay, here's the query solution link without DISTINCT :) |
We use sh:in for validation of data cubes in RDF. Unfortunately it is pretty much impossible to generate such a list in SPARQL, at least I could not figure out how. The list functions in Jena seem to be accessing lists only, not manipulating or creating them. Is there any prior work somewhere about how creating and manipulating could look like? I have not much know how about designing such things but what I tried doing (and failed) was: CONSTRUCT {
<something> sh:in ( ?listMembers ) .
} So pretty much using the Turtle collection syntax. So Am I completely missing something here that prevents this approach from working? There is obviously more missing, like removing an entry and adding a new entry but I'm not sure how much of it is realistic in a language like SPARQL. By the way why is this called collection in Turtle and not list? |
Bob DuCharme had a blog post that showed some standard manipulations. Works to some extend but is not really nice form syntactic sugar point of view http://www.snee.com/bobdc.blog/2014/04/rdf-lists-and-sparql.html |
Some tries by @jaw111 https://gist.github.com/jaw111/1b149fd1111f774a3613f10955686617 via Twitter |
From some time ago: https://afs.github.io/rdf-lists-sparql . Lesson - it's painful. One avenue is to add to the basic SPARQL data model - lists and sets (and paths) - beyond RDF terms. This is a large change, including result set formats, but I think it is worth exploring. |
In SWObjects, I extended triple pattern matching with some generators. One of those was "MEMBERS(?var)" (example use) which joined the current binding with the argument (?var above) bound to each member of the list. I mentioned it to Lee F during the SPARQL 1.1 WG and he said the syntax give him hives. I used this a lot, especially from the command line to e.g. sequentially walk test manifest entries, with no skin conditions that couldn't be explained by prolonged puberty. |
List is most commonly understood to mean ordered list, while collection is most commonly understood to mean unordered list. (Yes, both list and collection may have both ordered and unordered variants, but the most common intuitive default is as I said.) Unordered membership is far easier to handle due to various other aspects of RDF and DBMS, and for many reasons (not least being WG time constraints) that ease was important in the development of these specs. |
Stardog talked about a possible extension at least to have a list equivalent to group_concat which would affect the result formats more than anything else. |
@JervenBolleman that is an interesting one, thanks. We have a workaround where we create lists in a coded step after concatenating them with
|
As per @ktk 's suggestion I'm linking here the slides I used today at ISWC to talk about our work on RDF Lists: https://www.slideshare.net/albertmeronyo/modelling-and-querying-lists-in-rdf-a-pragmatic-study I went into the presentation unaware of this thread :-) So I just subscribed cc/ @enridaga |
Just noticed that Stardog provides nice basic member functions for lists, I like what I see https://docs.stardog.com/query-stardog/#rdf-list-functions |
It seems to me that if you have the freedom to extend SPARQL, there are good reasons to write these as operators in the query language rather than as magic predicates embedded in triple patterns:
One advantage to magic predicates is that such a query can pass seamlessly through a naive SPARQL pipeline processor (e.g. a tool which parses the query for bound variables, issues it verbatim, and renders the results in a nice HTML table). Unless SPARQL 1.2 were committed to being syntactically compatible with SPARQL 1.1, I don't think syntactic compatibility of list features compensates for the advantages of SPARQL list operators. |
Pat Hayes on first-class list semantics (or the lack of it): https://lists.w3.org/Archives/Public/semantic-web/2022Sep/0001.html |
Use case: convert SHACL prop attachmetns to domain/range. Very easy to do for insert {
?prop schema:domainIncludes ?domain; schema:rangeIncludes ?range
} where {
{[a sh:NodeShape; sh:property/sh:path ?prop; sh:targetClass ?domain]} union
{[a sh:PropertyShape; sh:path ?prop; sh:class|sh:datatype ?range]}
} Much harder to do for RDFS+OWL because one needs to construct lists, eg :propP rdfs:domain [a owl:Class; owl:unionOf (:classX :classY :classZ)]. @jaw111's example https://gist.github.com/jaw111/1b149fd1111f774a3613f10955686617 shows how to do a similar thing (but produces SHACL as final result, and I think it's a bit erroneous). |
It is very hard[7] to query RDF
lists, using standard SPARQL, while returning item ordering.
This inability to conveniently handle such a basic data
construct seems brain-dead to developers who have grown to
take lists for granted.
"On my wish list are . . . generic structures like nested lists as first class citizens"
https://lists.w3.org/Archives/Public/semantic-web/2018Nov/0170.html
IDEA: Jena's list:index property
Apache Jena offers one potential (though non-standard)
way to ease this pain, by defining a list:index property:
https://jena.apache.org/documentation/query/rdf_lists.html
IDEA: Add lists as a fundamental concept in RDF
As proposed by David Wood and James Leigh
prior to the RDF 1.1 work.[8]
https://www.w3.org/2009/12/rdf-ws/papers/ws14
The text was updated successfully, but these errors were encountered: