Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [higgins-dev] [IdAS] filter language: XPath/SPARQL

>>> Greg Byrd <gbyrd@xxxxxxxx> 8/18/06 2:52 PM >>>
>
>I've been thinking about the filter language, and (as usual) have come

>up with more questions than answers.  My plan was to use the 
>recently-posted Example Ontology 
>(http://spwiki.editme.com/ExampleContextOntology) as a springboard to

>compare XPath expressions and SPARQL expressions.   Didn't quite get 
>there...
>
>For the following discussion, I will ONLY be considering the filter
used 
>in Context.getSubjects(filter). 
>
>-----
>Question 1:  Is the filter expression intended to apply to (a) the 
>entire Context (i.e., the result of the filter should be the set of 
>DigitalSubjects that match), or (b) to a DigitalSubject (i.e., look at

>each DigSub and add it to the list if the filter is true)?
>
>If (a) then we might have matches to nodes (objects) that aren't 
>DigSubs.  If (b), we can't take advantage of SPARQL expressions that
let 
>you control the ordering, number, etc., of the results.  Going
forward, 
>I'll assume that it's (b).

I assume (a) (sort of), and that there is the capability in the filter
of narrowing the result set to only DigitalSubjects. I wouldn't expect
callers of getSubjects to have to add that to the filter though. I
assume the implementation would auto-add that (since the name of the API
implies that only subjects will be returned). So really, this is like
(b), but the provider's implementation details are different (provider
adds in a filter predicate to only allow DS's).

I don't know enough about SPARQL to know why (b) prevents ordering. My
guess is that at this point, you're the SPARQL expert, so you'll have to
clue us in on the particulars of the problems you see.

>-----
>Question 2:  Is there a canonical RDF/XML representation of any given

>RDF graph?  The Primer (http://www.w3.org/TR/rdf-primer/) lists many 
>abbreviations that can be used, and so there are many possible XML 
>representation of a given graph.  For example, let's assume that the 
>example Person type only has two elements: firstname and surname.  The

>subject could be represented either as:
>
><rdf:Description rdf:about="urn:jim-sermersheim">
>       <jim:firstname>Jim</jim:firstname>
></rdf:Description>
>
><rdf:Description rdf:about="urn:jim-sermersheim">
>       <jim:surname>Sermersheim</jim:surname>
></ref:Description>
>
>Or as the following:
>
><rdf:Description rdf:about="urn:jim-sermersheim">
>       <jim:firstname>Jim</jim:firstname>
>       <jim:surname>Sermersheim</jim:surname>
></ref:Description>
>
>In the second case, an XPath expression '.[jim:firstname="Jim" and 
>jim:surname="Sermersheim"]' would work, but in the first case it 
>wouldn't.  (I apologize if I don't get the XPath syntax quite right --

>I'm a newbie.)  Is there a way to handle the first case in XPath?  If

>the "canonical" RDF/XML representation combines all nodes with the
same 
>rdf:about attribute, then maybe this is OK.

yuk, didn't realize there would be that problem. Yeah I hope there's a
canonical form.

>In both cases, the following SPARQL query would be fine: { ?x 
>jim:firstname "Jim" . ?x jim:surname "Sermersheim" }.

so +1 for SPARQL

>Another case is the representation of type.  In Paul's example, we say

>that urn:jim-sermersheim is a Person as follows:
>
><rdf:Description rdf:about="urn:jim-sermersheim">
>       ...
>       <rdf:type>
>             <rdf:Description rdf:about="&jim;Person>
>       </rdf:type>
></rdf:Description>
>
>But in the Primer, they tend to use the following:
>
><rdf:Description rdf:about="urn:jim-sermersheim">
>       ...
>       <rdf:type rdf:resource="http://www.novell.com/jim#Person"; />
></rdf:Description>
>
>
>In one case the type is an element, and in the other it's an
attribute.  
>How would you use XPath in this case?

Assuming there's no canonical representation, one would have to OR the
two filters which match for those two examples.

>-----
>Question 3:  In the example, hasPostalAddress is a separate object. 
The 
>postal address information is not an XML descendent of the 
>jim-sermersheim node, and there's no link back to the jim-sermersheim

>node from the jims-address node.
>
>Given this schema, how would one search for all DigSubs from a 
>particular city?
>
>In SPARQL, you'd say: { ?x jim:hasPostalAddress ?addr . ?addr jim:city

>"Provo" }.
>
>Is there a way to do this in XPath?  I wasn't able to figure it out, 
>based on my limited research.

XPath doesn't let us do this (effectively dereference a pointer to
another element) -- this is what prompted me to ask #3 (alternate
representations) in
http://dev.eclipse.org/mhonarc/lists/higgins-dev/msg00583.html


_______________________________________________
higgins-dev mailing list
higgins-dev@xxxxxxxxxxx 
https://dev.eclipse.org/mailman/listinfo/higgins-dev


Back to the top