Re: [w3photo] RDF and ID's

hi Greg

On Sun, 8 Feb 2004, Greg Elin wrote:

> I've been working on hacking Fotonotes's code to read/write the RDF
> vocab Libby described on her very informative page,
> http://esw.w3.org/topic/W3PhotoVocabs .
>
> I want to understand something about adding ID's to nodes.  The
> questions I have are at the bottom of this email at the end of the
> following background information:
>
> According to the vocab, an image can contain parts:
>
> * There MAY be image:width and image:height properties
> * There MAY be image:hasPart properties
> * If image:hasPart is present, image:points property MUST be present
> * If image:hasPart is present, dc:description for that part MAY be
> present
> * If image:hasPart is present, image:regionDepicts MAY be present
> * If image:regionDepicts is present and depicts a foaf:Person or Agent,
> an identifying property MUST be present, one of foaf:mbox_sha1sum,
> foaf:homepage, foaf:weblog, foaf:page, or foaf:name (name is the worst
> case option)
>
> Here's an example:
>
>   <foaf:Image
> rdf:about='http://www94.web.cern.ch/WWW94/Images/ClosingPanel/
> Closingpanel5.gif'>
>    <image:width>535</image:width>
>    <image:height>367</image:height>
>    <image:hasPart>
>     <image:Rectangle rdf:ID='p1'>
>      <image:points>6,106 84,181</image:points>
>      <dc:description>Joseph Hardin looking interested</dc:description>
>      <image:regionDepicts>
>       <foaf:Person>
>         <foaf:name>Joseph Hardin</foaf:name>
>
> <foaf:mbox_sha1sum>1af3d5e34a12435a835c5e51a687c93707114f0b</
> foaf:mbox_sha1sum>
>       </foaf:Person>
>      </image:regionDepicts>
>     </image:Rectangle>
>    </image:hasPart>
>   </foaf:Image>
>
>
> The proposed above vocab puts and rdf:ID for a given image part one
> layer down:
>   <image:hasPart>
>     <image:Rectangle rdf:ID='p1'>
> 	<image:points>6,106 84,181</image:points>
>    </image:Rectangle>
>
> So now I get to my issue. Fotonotes has a simple hack of placing the
> "ID" as part of a single word <selection> tag:
> <selection3>
> 	<selectionRectangle>
> 		315,90,112,206
> 	</selectionRectangle>
>
> I just wanted something that would work until I could interact with
> smart folks like you all to understand better formats. It seems to be
> that parsing the proposed RDF with the ID located inside a tag but one
> level inside involves more sophisticated code than parsing multiple
> <selection#> tags with the ID located as just part of the word at the
> initial level. And I'm hoping there is an easy way to make the
> transition.
>
> My questions:
> 1) Is it okay if used the format of placing an ID also inside the
> <image:hasPart> tag, e.g., <image:hasPart rdf:ID='hp1'> instead of, or
> in addition to, being inside the <image:Rectangle rdf:ID='p1'> tag?
> Does that form break it for other people?
>   <image:hasPart rdf:ID='hp1' >
>     <image:Rectangle rdf:ID='p1'>

Unfortunately that breaks the RDF.

RDF has objects and prooperties, which are usually syntactically
differentiated using a 'striped' syntax[1]. So you have

foaf:Image (an object)
  image:width (a property)
  image:height (a property)
  image:hasPart (a property)
    image:Rectangle (an object)

(notice also that by convention objects start with a capital letter).

You can only have ids (and nodeIds, and rdf:resources and rdf:abouts)
referring to objects in RDF, never properties. So what's for you a
little syntactic difference breaks the RDF syntax, unfortunately.

>
> 2) What is the philosophy of putting the ID one level down and *inside*
> the tag has a property? What's the principle advantage? I think I'm
> open to following that form, but it seems to force a level of
> complexity on the parsing code (and hence the developer). Can I gain
> some insight?
>

see above, I hope. Essentially it is difficult to represent a graph
structure using a heirarchical structure, and so you get some syntactic
oddities with RDF. A quick way to check if something will work is to use
the RDF validator[2].

In general, parsing RDF with XML is not a good idea....however I can't
oddhand find a php libbary for RDF parsing - Redland[3] can do it but
might be a bit heavyweight for your purposes.

Libby

[1] http://www.w3.org/2001/10/stripes/
(a bit old - and not all RDF syntax follows this pattern - but still
very useful I think.)
[2] http://www.w3.org/RDF/Validator/
[3] http://www.redland.opensource.ac.uk/docs/php.html
==================================
This is the TEMPORARY discussion list for the W3 Semantic-Photo History
Project. For questions, contact greg@fotonotes.net.

Subscribe Instructions
To:   semantic-photolist-request@unitboy.com
Body: subscribe

Unsubscribe Instructions
To:   semantic-photolist-request@unitboy.com
Body: unsubscribe

Help
To:   semantic-photolist-request@unitboy.com
Body: help

Received on Sunday, 8 February 2004 13:30:42 UTC