W3C home > Mailing lists > Public > public-owl-dev@w3.org > January to March 2005

sparta's use of OWL

From: Dan Brickley <danbri@w3.org>
Date: Fri, 18 Mar 2005 13:48:02 -0500
To: public-owl-dev@w3.org
Message-ID: <20050318184801.GF26039@homer.w3.org>

Nice imho use of OWL to improve an RDF API. It's node-centric,
ie. programatic objects bind to nodes in some specific RDF graph 
data. I had something like this in Ruby once; it's a nice way to
expose RDF in scripting environments where property names 
can be fabricated at runtime (eg. python, perl, ruby, ...).

Spotted via planetrdf.com

-> http://www.mnot.net/blog/2005/03/17/sparta
-> http://www.mnot.net/sw/sparta/

Sparta is a simple API for RDF that binds RDF nodes to Python objects
and RDF arcs to attributes of those Python objects. As such, it can be
considered a “data binding” from RDF to Python.


Accessing and Manipulating Data

Once you have a node, you can access and change its properties by name,
using the prefix mapping as explained above. For example,

print foo.rdf_type

will print the 'rdf_type' property of the 'foo' node.

There are two ways to access a property's values, depending on what
Sparta knows about it through the schema store. If it is an
owl:FunctionalProperty, or if the subject is subclassed to restrict that
property with either a owl:maxCardinality or a owl:cardinality of "1",
the property can be accessed as a normal, singular value; that is, it
can be accessed as explained above, assigned with the '=' operator,
deleted with 'del', and so forth.

Otherwise, the property's value is assumed to have a cardinality greater
than one, and implements a subset of the sets.Set interface. For
example, you can add to the set with the add method, like this;


test for membership with the in operator, and so forth. See the
PropertySet class for the exact methods implemented.
Received on Friday, 18 March 2005 18:48:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:13 UTC