RDFa API thoughts

Forwarding Nathan's thoughts on the RDFa API to the mailing list...

-----------------------

Hi Manu,

I've went through the RDFa API document and spent the last few hours.

For the basic IDL and methods I think the following may be most useful
(back tracking a little and building on some mock cases and Ivans
suggested methods):

interface RDFaDocument {

    readonly attribute DocumentData data;

    NodeList   getElementsByType(in DOMString type);
    NodeList   getElementsBySubject(in DOMString subject);
    NodeList   getElementsByProperty(in DOMString? property, in optional
DOMString? value);

};

interface DocumentData {

    attribute RDFEnvironment? rdf;

    sequence<DOMString>   getSubjects()
    sequence<DOMString>   getSubjects( in DOMString? property, in
optional DOMString? value )
    sequence<DOMString>   getProperties( in optional DOMString? subject )
    sequence<DOMString>   getValues( in DOMString? subject, in DOMString
property )

    Projection            getItem( in DOMString subject )
    sequence<Projection>  getItems()
    sequence<Projection>  getItems( in DOMString? property, in optional
DOMString? value )

    sequence<RDFTriple>   getTriples();

    void                  setMapping(in DOMString mapping, in DOMString
uri);
};

notes:
- duplicates are there for overloading.
- fleshed out the data.getSubjects and getProperties to be (dare I say)
more useful, also added a complement getValues which could be v useful
- dropped the 3 argument version of getItems*
- added a getTriples which returns an array of RDFTriples, I dare say
this is needed and easy to implement without the full RDF API.
- added getElementsByType back in, it seems v useful for DOM-devs (not
so for those working with the data and easy replicable w/ getItems).

Comments and questions:

I can't for the life of me give any strong thoughts wrt .query,
generally it makes me uncomfortable and there are just so many possible
approaches that I don't feel comfortable (personally) trying to define a
single one as being the primary query mechanism for RDFa.

BlankNode identifiers are worrying me a little..
- what does projection.getSubject return for a BlankNode?
- can I then use that on data.getItem or getElementsBySubject?
- are blank node identifiers in the document reliable, so they can be
used in data.getItem and getElementsBySubject?

The getElements* methods in general are worrying me..
- does @rev+@resource/@href set a subject that you can use to
getElementsBySubject (assume yes)?
- are the methods fine to return back node lists which include head
elements?
- when the subject is set by the base, what is returned for
getElementsBySubject, the head, the doc, the?
- will getElementsByProperty confuse people (namewise) since we have a
@property but @rel also sets the property?
- chaining...! for example what would be returned for the method call
document.getElementsByProperty("dbp-owl:residence") with this RDFa?
  <div about="http://dbpedia.org/resource/Albert_Einstein"
  rel="dbp-owl:residence">
    <span about="http://dbpedia.org/resource/German_Empire"></span>
    <span about="http://dbpedia.org/resource/Switzerland"></span>
  </div>
and this RDFa?
  <div about="http://dbpedia.org/resource/Albert_Einstein">
    <span rel="dbp-owl:residence"
resource="http://dbpedia.org/resource/German_Empire"></span>
    <span rel="dbp-owl:residence"
resource="http://dbpedia.org/resource/Switzerland"></span>
  </div>
and this RDFa?
  <div about="http://dbpedia.org/resource/Albert_Einstein"
rel="dbp-owl:residence">
    <span resource="http://dbpedia.org/resource/German_Empire"></span>
    <span rel="dbp-owl:residence"
resource="http://dbpedia.org/resource/Switzerland"></span>
  </div>

CURIE/Term Maps:
Is the RDFa API internal map pre-populated w/ prefixes and terms defined
in the doc? if so, what about when they overwrite each other within the
dom tree, which wins, first or last defined?

Will leave it there for now,

Best,

Nathan

Received on Sunday, 3 April 2011 17:34:56 UTC