W3C home > Mailing lists > Public > www-rdf-interest@w3.org > May 2000

Comments on the Stanford RDF API

From: McBride, Brian <bwm@hplb.hpl.hp.com>
Date: Tue, 2 May 2000 13:51:16 +0100
Message-ID: <7686E88F1253D311A867006008CD059F010B1D66@0-mail-1.hpl.hp.com>
To: "RDF Interest Group (E-mail)" <www-rdf-interest@w3.org>
In general, I found the API pretty easy to work with and a good basis
for development.  

I've been working mainly with a database back end with some work on a low
level editor and a schema validator. I've split comments into three groups,
general issues, those motivated by database specific issues and stylistic.
Its pretty encouraging that the database specific section is so small.

Brian McBride


o Issue: Vector.indexAt() does not work for a vector of RDFNode.

  Reason:  RDFNode.equals(RDFNode n) should be RDFNode.equals(Object o).

o Issue: No declared exceptions

  Discussion:  I've got a host of exception conditions that can arise
         there needs to be a way to report them.  Currently I'm using
         runtime exceptions so they don't have to be declared, but I'd
         prefer to be able to declare them.

o Issue:  Namespace names lost on import

  Reason: When I'm importing an RDF serialization into the database, I'm
	passed the full URI.  It is not possible in general, to parse that
      URI and pick out the namespace component.  It is better to retain
      the namespace component which can then be used for better user
      presentation in an editor and for better serialization of the model.

  Remedy: Add methods Model.createResource(String nsName, String roName), 
          String RDFResource.nsName() and String RDFResource.roName().

o Issue:  Current API has no way to set a namespace prefix

  Reason: When displaying URI's, and when serialising it would be good
	to display a namespace prefix that is meaningful to a human.

  Remedy: Add method Model.setNsPrefix(String nsName, String prefix)

o Issue: New query methods.

  Reason:	When generating an RDF serialization, it is convenient to be
able to
	list all the namespaces used in a model so they can be output at the
	of the serialization.  For my RDF editor, I want to be able to list
	all the unique subjects in the model, and I'd like to use a database
      query rather than troll through all the statements and pick them out
	myself.  See also the stylistic note below.

  Remedy:  Add methods:
		RDFEnum Model.namespaces();
		RDFEnum Model.subjects();
		RDFEnum Model.predicates();
		RDFEnum Model.objects();

o Issue: Id for RDFNodes

  Reason: My reading of the spec is that a model can contain anonymous
	resources.  I'm aware that you disagree with this.  In my
	an anonymous resource has an empty string as its URI, so I need some
	other way to distinguish them.  For now, I've added the following
	to RDFNode.  This is really just a placeholder for now, because I'd
	like to get this issues of anon resources cleared up.

  Remedy: long Resource.getId() returns an integer unique within this

o Issue:  What to do with model.setSourceURI() and getSourceURI().

  Reason: I have some test files lying around.  When I import one of these,
	SiRPAC is calling this method with an arguement like 
	"c:\temp\rdfschema.rdf".  I'm just not sure how useful this is or
	to do with it.  Is this intended to be the URI for the model?  Is it
	property to be attached to the model URI?

o Issue: Model.create() does not specify URI.

  Reason:  See my separate note, but I don't think we are far apart on this.
	model may have URI, so I'd expect Model.create() to take a URI
	which may be null or empty if the model is anonymous.

  Remedy:  modify Model.create() to be Model.create(String URI).


o Issue: I need to free up resources when a model or an enumerator is no
	longer in use.

  Reason:  My database implementation allocates database resources such
	as connections, cursors and views.  I need to be able to release
      preferably as soon as the application is finished with them.  If I
	till the garbage collector runs, I tend to run out of cursors even
	simple applications, and I can't rely on finalizers being run when
	application terminates.

  Remedy: Add close() method to Model and the enumeration returned by


o Suggestion:  I've added some public well known constants to the interfaces
	with things like the RDF and RDFS name spaces.

o Suggestion:  Not all models will be mutable.  Move those methods that
	the model into another interface, MutableModel.  These methods would
	include addStatement, createStatement, createResource,
createLiteral.  Or
	need a not implemented exception.

o Suggestion:  Not all models shoud have to support a query interface so
	 the query methods into a separate SimpleQuery interface.

o Suggestion: Rename Model.size() to Model.numStatements().  There might be
	ways to measure the size of a model.  This naming is clearer.

o Suggestion: Rename Model.elements() to Model.statements().  This
	is more consistent with the language used in the spec.
Received on Tuesday, 2 May 2000 08:51:28 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:07:29 UTC