[Versa] Versa issue: subgraph primitives?

Michael Olson Mike.Olson at fourthought.com
Sun Aug 28 23:22:39 MDT 2005


On Aug 13, 2005, at 8:22 AM, Chimezie Ogbuji wrote:

>> IMO, if we accept subgraphs as first-class objects, then we should  
>> dump
>> statements as separate first-class objects.  A statement is, of  
>> course,
>> just a special case of a subgraph.
>
> Yes, but then you would essentially only have the capability on a
> subgraph that you would on a model (still no statement-level query
> semantics).

So, we would need some additional operator/method to say "apply this  
query on the results of a first query".   I'll use method because we  
are running our of operators :)

nested("type(rdf:List)",all() -| rdf:first -> *)

would first evaluate "type(rdf:List)" then this sub graph becomes the  
context for the second query.  In the second query, "all()" would  
return all of the resources from the first, etc.

However, I still do not see a difference between sub graph and "list of  
statements"


>
>> Traversal expressions would return a subgraph rather than a list of
>> statements (or scalars right now).
>
> So all() |- dc:title -> contains('Article') would return a subgraph
> containing all dc:title statements containing 'Article'?  Then you
> could do:
>
> scoped-subgraph('type(xsd:string)','all() |- dc:title ->  
> contains('Article')')
>
> to get all such titles?
>

Hey, I just didn't read far enough

Maybe, a query should be expanded to be

query := context?  expression
context = '{' sub-graph expression '}'

and if context is not specified, then it is the entire model.

Mike


>>  As chime says, this would allow for
>> very elegant composition, e.g. in chaining Versa queries.
>
> On that note, I found it incredibly useful to implement a query-chain
> function (which went along way in allowing me to limit how much work
> is done by the host language - which was doing more work than I
> thought it should for my taste) which allows explicit chaining of
> versa queries.  Emeka currently is capable of such queries:
>
> <chimezie> .help query-chain
> <Emeka> query-chain(string,[string, [...]])
> <Emeka> Treats each of it's arguments as the string representation of
> a Versa expression (each of which is compiled and
>           evaluated in the order given). The results of successive
> evaluations are bound to variables of the form resultN,
>           where N is the index/number of the expression evaluated.
> Each expression is evaluated with the prior result as
>           the context node and with all the previous results available
> as variables (result1,result2,..,resultN).
>
> <chimezie> .query $chimeziesBookmarks
> "query-chain('list("chime","ogbuji")','filter(.,"contains(\'og\')")')"
> <Emeka> Querying against 469 triples
> <Emeka> [u'ogbuji']
> _______________________________________________
> Versa mailing list
> Versa at lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/versa
>
------------------------------------------------------------------------ 
-----------------
Mike Olson                                                Principal  
Consultant
mike.olson at fourthought.com                +1 720 253 4662
Fourthought, Inc.                                       
http://Fourthought.com
PO Box 270590,                                       http://4Suite.org
Louisville, CO 80027-5009, USA
XML strategy, XML tools, knowledge management




More information about the Versa mailing list