Re: RDFa API: thoughts on PropertyGroup

On 11/06/2010 07:49 PM, Niklas Lindström wrote:
> 1. The name of the interface "PropertyGroup". Since the methods used
> to retrieve these are named "getItemBy[...]", why is it not named
> "RDFItem" or similar? Just a detail perhaps, but the naming of things
> is quite important IMHO. (It could also be called Description, in
> honor of the "D" in RDF.. ;) )

Mark and I went back and forth on this a number of times. We discussed
many names - "Item", "Object", "DataGroup", "Descriptor", "Info", etc.,
but none of them were as work-able as PropertyGroup. We decided to move
on and try naming PropertyGroups later as we could spend a very long
time bike-shedding the name.

So, a number of us agree with you - PropertyGroup isn't the name that we
want to end up with in the RDFa API. I do like "Description" or
"ResourceDescription".

> 2. The PropertyGroup should have an attribute for the subject it
> represents the properties of ("readonly attribute RDFResource
> subject;").

Hmm, I thought that was in there - in any case, it should be. I think
that perhaps the last time the interface was edited, the subject was
supposed to be placed in the 'info' property, so this could give you the
subject:

var subject = pg.info["subject"];

Although the documentation doesn't say that, does it. What do you think
of the above mechanism?

> 3 a. It would be really convenient to easily get a PropertyGroup for
> an RDFResource (i.e. IRI:s and BNodes), so I suggest adding a method
> to RDFResource for getting a PropertyGroup with the given resource as
> subject, such as "getItem()". This is to avoid having to repeatedly
> call "document.getItemBySubject(...)" when traversing linked
> resources.

Perhaps. We're trying to keep the interface as light-weight as possible.
This is the code we'd have without your change:

var pg = document.getItemBySubject(resource.toString());

and this is the code we'd have with your change:

var pg = resource.getItem();

I don't think adding the interface simplifies the code enough to warrant
the addition. Am I missing something? What do you think of the more
complicated code example?

> 3 b. If this breaks the layered abstraction (RDFResource being "lower"
> than PropertyGroup), it might be better to have something like
> "getItems(...)" on PropertyGroup (either failing or filtering if the
> retrieved values aren't all RDFResource:s).

It does break the layered abstraction a bit. So is this what you mean by
the statement above:

var pgs = pg.getItems(???);

What would you pass getItems()? An RDFResource? If so, wouldn't you only
get one PropertyGroup back? A code example would help to understand
where you're coming from.

> Background: I have two implementations, one in Java for Sesame and one
> in Python for RDFLib, which I would like to adapt to this interface.
> Both of these are generic read/write utilities - not RDFa specific. I
> have used them a lot with good results, and these suggestions are all
> based on my experience with that.

Thanks Niklas - this input definitely does help... let us know what you
think about the feedback/questions above.

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Saving Journalism - The PaySwarm Developer API
http://digitalbazaar.com/2010/09/12/payswarm-api/

Received on Sunday, 7 November 2010 20:43:51 UTC