[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RDDL] Java Object Model
- From: Ken MacLeod <ken@bitsko.slc.ut.us>
- To: xml-dev@lists.xml.org
- Date: Sun, 28 Jan 2001 13:35:35 -0600
Jonathan Borden <jborden@mediaone.net> writes:
> I've updated the RDDL java implementation and begun a short
> description of the Java object model at
> http://www.rddl.org/RDDL-JOM.html
>
> Notably a namespace is defined as a container of resources. Each
> resource is indexed by an identifier which is an XPointer which
> locates the rddl:resource within the RDDL document. A container is a
> general mapping of URIs to Resources and is derived from a Namespace
> (a Namespace may also be seen as a restriction of a Container --
> whose URI part is the namespace)
>
> The code is also available at: http://www.rddl.org/rddl.jar
> Javadoc is available at http://www.rddl.org/docs/
Here is a quick translation to the sort-of grovish perspective that
I've been implementing in Orchard[1], a Grovish Model, if you will :-).
Namespace
---------
resources -- a vector/list of Resources
uri
document -- a DOM Document with the original RDDL content
Resource
--------
xlink:arcrole -- the purpose of the resource
xlink:role -- the nature of the resource
xml:base
xlink:href
id
fragment-id -- either the id of the resource or a child seq
uri
xml:lang
xlink:title
In RDDL-JOM, Namespace has several query methods. In Orchard, I
expect to be able to use XPath-like queries over nodes and their
properties, so the equivalent queries would look like below. In turn,
these queries can be re-attached as helper methods that are aliases
for the queries. The context is an instance of Namespace.
getResourcesFromNature /resources[@xlink:role="nature"]
getResourcesFromPurpose /resources[@xlink:arcrole="purpose"]
getResourcesFromHref /resources[@xlink:href="href"]
getResourcesFromTitle /resources[@xlink:title="title"]
getResourcesFromLang /resources[@xml:lang="lang"]
getResourcesFromId /resources[id("id or id-list")]
(These XPath-like queries are just conceptual, the mapping of queries
into nodes is not complete yet, and there are some semantic
differences between trees of elements and attributes, and trees of
arbitrary nodes.)
An example usage of Orchard RDDL would look like this, in Python:
from Orchard import RDDL
namespace = RDDL.get('http://www.rddl.org/')
xlink = "http://www.w3.org/1999/xlink"
for resource in namespace.resources:
print "URI: " + resource.uri
print "Title: " + resource[(xlink, 'title')]
print "Nature: " + resource[(xlink, 'role')]
print "Purpose: " + resource[(xlink, 'arcrole')]
print
These short snippets[2] of Orchard use don't tell a whole story. Much
of Orchard's capabilities are in working with many different types of
property sets in a consistent fashion and with shared tools, rather
than in how any one particular property set is implemented. This
"bigger picture" won't really be visible until somewhere between
version 1.0 (in a few weeks) and hopefully 2.0 (a few months).
-- Ken
[1] <http://casbah.org/~kmacleod/orchard/>
[2] <http://casbah.org/pipermail/devel/Week-of-Mon-20000911/000750.html>