Currently wondering whether this work might be usable for manipulating simple FOAF graphs, or whether I should just stick with the RDF query language built into Jena, plus the hooks provided in the API to add custom Selectors.
I find myself thinking about a FOAF document as a graph: the
foaf:Person being edited is the root, with properties (e.g.
foaf:knows) as descendents.
So using something like XPath is a good fit to my mental model, even if its not necessarily entirely snug with the RDF model. I was also surprised to find what I would consider to be a few holes in the Jena API. Others might disagree, and I’m perfectly willing to admit that these gripes are likely to be a result of my limited grasp of Jena, and are really minor niggles with what has so far proven to be a very easy to use API.
Last night I wanted to just remove a set of Resources, in this case the list of current friends. This would allow me to delete friends from the internal model built up by the FOAF-a-Matic before it exports RDF data. But I found that there was no way to remove just a Resource from the model, and that the ResIterator doesn’t support removal either.
Casting about a bit I found that I could remove a Statement But, as you might expect, this results in just the relationship being removed. The Resource that is the object of the Statement remains intact.
In the end I discovered that if I removed all properties then it would be removed from the model, which seems slightly counter-intuitive.
This all seems quite a round-about way to handle something which should be fairly simple. The equivalent in database terms would be a DELETE CASCADE (“Delete this statement and all objects”). Leads me to wonder whether there are further layers required in RDF APIs for handling less fine grained manipulations of RDF graphs. I don’t have enough experience yet to be sure.
Another example that springs to is that there’s no way to create a typed Resource in a single step. You have to manually create a resource, then assign it an rdf:type property. An API should handle some of these routine tasks for you.
I’m likely to accumulate a set of Jena based utility classes as a result of this. I should make sure that they’re independent of the main code base. I should probably digest this ramble into some suggestions for the jena-dev mailing list as well. I’m avoiding this at the moment as another source of distraction.