In trying to implement the RDFPath spec, I noticed that:
- The . selection for the current context is used but not defined.
- # is sort of a bad operator for grabbing type information. How about %?
- The spec distinguishes between resources, arcs and literals. Aren't they
all resources? I mean resources vs. literals I can sort of see, but arcs?
- It's not clear one goes in the whatever() functions.
- It's not clear where a plain URI vs. a QName can be used.
- The separation of filters and selections in sections 3 and 4 imply that
they are different things, however the examples show them being used
seemingly interchangeably. Which is it?
- It should also be noticed that the ' character (used to quote URIs) can
be included in URIs, which makes things messy. Can we use <...> instead?
Now I'm about half-way through my implementation and I realize the syntax
doesn't make much sense to me. Alright, time for some examples of my own
(I'm trying to be N3-like):
** Node Queries
/
Returns all nodes.
[]
Returns all anonymous nodes.
[foaf:mbox "me@..."]
Returns all nodes where the value of the property foaf:mbox equals
the literal "me@...".
[foaf:mbox "me@..." ; foaf:homepage <http://www.aaronsw.com>]
Returns nodes where foaf:mbox equals the literal of my email address
and foaf:homepage equals the resource of my homepage.
[a rdf:Bag]
Returns nodes of type rdf:Bag.
<http://example.org/#foo>
Returns the resource <http://example.org/#foo>.
"Whatever"
Returns the literal "Whatever".
** Sub-queries
(In these, the first path segment can be replaced with any of the node
queries above.)
/dc:creator
Returns values of the dc:creator property for all resources.
/[a rdfs:ContainerMembershipProperty]
Returns the values of all container membership properties (_1, _2, etc.)
for all resources.
"Aaron Swartz"\dc:creator
Returns all resources with a dc:creator property of "Aaron Swartz".
(The last one may be a bit odd, but I think it's very powerful. It allows
you to go backwards in queries.)
** Query Refinements
/dc:creator [a w3c:StaffMember]
Returns all of the w3c:StaffMembers who are listed as the dc:creator of
a resource.
I don't do arcs or reification because I don't understand how they fit into
a query context.
There's more I want to add to this, but I'm at a conference and don't have
time to finish it, but I wanted feedback.
What do you think?
--
[ Aaron Swartz | me@... | http://www.aaronsw.com ]