[Versa] Versa suggestions - Compilation (and new ones)

Chimezie Ogbuji chimezie at gmail.com
Fri Aug 12 21:55:39 MDT 2005


Okay, just to ensure progress and to make sure I'm on the same page,
below is a summary of the issues / suggestions so far as well as some
additional suggestions I have (for 1.0):

1.0 Suggestions

Would these be simple enough to be considered within this release cycle? 

Syntactic shorthand for boolean operators
< foo => lt(foo)   - implicitely compare with context node
bar < foo => lt(bar,foo)
<= foo => lte(foo) - implicitely compare with context node
bar <= foo => lte(bar,foo)
= foo => eq(foo) - implicitely compare with context node
bar = foo => eq(bar,foo)
> foo => gt(foo) - implicitely compare with context node
bar > foo => gt(bar,foo)
>= foo => gte(foo) - implicitely compare with context node
bar >= foo => gte(bar,foo)
foo and bar => and(foo,bar)
foo or bar => and(foo,bar)

Datatyping
Allow for Notation3-style  literal typing.  For example  "1"^^xsd:integers

Notes:

1.We need to gather the complete requirements for conversion / casting
to and from each data type.  Such a conversion mechanism is already
covered in the XQuery specifications.
2.Versa literals (numbers and strings) implicitely cast to XSD
datatypes in order to support for backward compatibility and
simplicity.  Strings cast to xsd:string and numbers cast to xsd:float
(or xsd:integers?).
3.Instead of allowing for typed literals as subjects of traversal
operators, at the very least we could allow them to be arguments of
the class function (see bellow) and results of the  type function when
used WXS Datatype resources.  So,   class("1"^^xsd:integer) =>
set(xsd:integer), class(all() - rdfs:label -> *) => set(xsd:string),
and type(xsd:integer) => set("1"^^xsd:integer,"2"^^xsd:integer,...)
i.e., it will return all the literal integers in the model.

Backward Traversal Filters
Extend traversal operators to include backward traversal operators:
* <- rdfs:label -| type(owl:Class)   => all owl:Classes with labels

Additional Functions (to core)
class([members])
Returns the owl:Class(es) or rdfs:Class(es) the member(s) belongs to. 
Essentially:
list(. | member) – rdf:type -> *

value([resources])
Returns the rdf:value(s) of the given resource(s)

rdfList(rdf_List)
Converts an rdf:List instance (rdf:Bag,rdf:Seq,rdf:Alt) to a Versa
set,list,or set respectively

Pythonic list syntax using [..] and in
Burrow python's list indexing syntax as replacements for member, item,
head, rest, tail,and keesaslice.

For example:

list(1,2,3)[-1]   => 3
list(1,2,3,4,5)[2:-2]   => list(2,3,4)

resource('http://www.w3.org/2002/07/owl#Class') in
list(owl:Class,rdfs:Class) => true

Some additional suggestions (not mentioned previously):

RDF properties as QName functions 

(this would clash with using namespace qualified function names and
the – currently incomplete extension functionality).  However, this
follows standard expert system slot syntax (CLIPS for example). 
Perhaps namespace qualified function invokations are used in this way
specifically.  This wouldn't cause backwards incompatiblity as it's
not clear in the spec currently that function names are Qnames.  This
was originally suggested at some point.  Consider the query

"The foaf:nick of every foaf:Person who knows the foaf:Person named
'Chimezie Ogbuji"

foaf:nick(
  all() |- foaf:knows -> rdf:type(.) = foaf:Person and foaf:name(.) =
'Chimezie Ogbuji'
)


Existential Placeholders - {}
use {..} to encompass traversal operators where the subject slots
would be all() - so optimizers can avoid explicitely retrieving all
resources in the underlying graph upon coming across the all()
function (which is currently the only way to make Versa traversal
patterns about nodes we don't care about).  For instance:

all() - list(..) -> boolean     =>    {- list(..) -> boolean} 
all() |- list(..) -> boolean     =>   {|- list(..) -> boolean} 
boolean <- list(..) - all()     =>    {boolean <- list(..) -} 
boolean <- list(..) -| all()     =>   {boolean <- list(..) -|} 


So,

"The foaf:nick of every foaf:Person who knows the foaf:Person named
'Chimezie Ogbuji"

would be:

foaf:nick(
  {|- foaf:knows -> is-type(foaf:Person) and foaf:name(.) = 'Chimezie Ogbuji'}
)

or

foaf:nick(
  {|- foaf:knows -> rdf:type(.) = foaf:Person and foaf:name(.) =
'Chimezie Ogbuji'}
)


More information about the Versa mailing list