Re: Committed a cleaned version of RDF-API

Hi Ben, all!

On Thu, May 12, 2011 at 12:31 PM, Benjamin Adrian
<benjamin.adrian@dfki.de> wrote:
> Am 12.05.2011 11:34, schrieb Ivan Herman:
[...]
>> I had a question a few days ago on the issue on URIRefs vs. URI Strings[1]. Niklas' answer[2,3] might be a possible way forward for this, but we should definitely have something...
> At the moment the Projection would return a simple URI as DOMString.
> You can then resolve this URI by calling
>  e.g.,  data.getProjection( "http://...#ivan" );
> This is simple because it is untyped.
> I like Niklas proposal, but I fear it does not scale for larger RDF
> graphs. A creation of a single projection might cause the creation of
> thousands of projections.
> I think we should not force library developers to implement caching and
> online resolution logics.

There would be no scaling problems if the method call instantiated the
related projections when invoked, and did no caching. That's how
resource oriented APIs like Jena and e.g. the feature branch in RDFLib
do it (and how O/RDF mappers usually do it, e.g. my Oort API in
Python).

But that's also partly why I think separate gelRel(s)/getRev(s) could
be appropriate to clearly indicate what's going on.

The conceptual issue here might be that Projection works both like a
resource-oriented API (binding a subject and providing utility methods
for getting data about that), and a bit like a partial "to JSON"
mapper. The latter is of course problematic not only because a graph
might be huge, but because it's often cyclic. But I that's not a
problem if a Project doesn't attempt to load all data about the
resource it wraps at once.

I think (off the top of my head) that two of my desired methods would
be implemented like (assuming ES 5 support):

    Projection.prototype.getRels = function (uriOrCurie) {
      var data = this.getData();
      return this.getAll(uriOrCurie).map(function (o) { return
data.getProjection(o); });
    };

    Projection.prototype.getRevs = function (uriOrCurie) {
      return this.getData().getProjections(uriOrCurie, this.getSubject());
    };

Note that these don't work right now, since there's no getData()
method on Projection. That might be nice to add to the API regardless
of the rest of these -- since a Projection has a data from where it
originates. (Of course, Projections are also instantiated with an
optional template which should reasonably be used in the above methods
(unless provided in the invocation). But this template is also
currently inaccessible from a Projection instance.)

Best regards,
Niklas


> Greetings,
>
> Ben
>
> [1]
> http://www.w3.org/2010/02/rdfa/sources/rdf-api/#widl-Data-setMapping-DOMString-DOMString-mapping-DOMString-uri
>
>> Ivan
>>
>> [1] http://lists.w3.org/Archives/Public/public-rdfa-wg/2011May/0045.html
>> [2] http://lists.w3.org/Archives/Public/public-rdfa-wg/2011May/0046.html
>> [3] http://lists.w3.org/Archives/Public/public-rdfa-wg/2011Apr/0062.html

Received on Saturday, 14 May 2011 16:32:11 UTC