Re: RDF resource and tree

Neil Stansbury <[email protected]>
Newsgroups gmane.comp.mozilla.devel.rdf
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Denis,

I'm intrigued, but I can see how it will work:

Looking at the striping:

The resource "http://localhost/bookstore/book/12178"
  has the following arcs:

  has a property of "http://localhost/bookstore/rdf/book#isbn"
   whose value is the literal "714877320"

  has a property of ""http://localhost/bookstore/rdf/book#author"
   whose value is the resource "http://localhost/bookstore/author/12178"

The resource "http://localhost/bookstore/author/12178"
  has a property of "http://localhost/bookstore/rdf/author#lastname"
   whose value is the literal "Nom famille"

Yet you want that resource's value in the <treecell> whose properties 
arc from "http://localhost/bookstore/book/12178" not 
"http://localhost/bookstore/author/12178"

In other words:

The resource "http://localhost/bookstore/book/12178"
  doesn't have an arc to "http://localhost/bookstore/rdf/author#lastname"

I think you'll need to use the full rule syntax to get the arc from the 
resource before assiging.  Checkout this template at XUL planet:

http://xulplanet.com/tutorials/xulqa/q_tmpl_predicate-iterate-triple.html

Which iterates over the parent resource to assign the child property to 
a variable.

Neil




Denis Laprise wrote:
> Hi,
> 
> I'd like to match the following RDF graph
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>          xmlns:AUTHOR="http://localhost/bookstore/rdf/author#"
>          xmlns:PUBLISHER="http://localhost/bookstore/rdf/publisher#"
>          xmlns:BOOK="http://localhost/bookstore/rdf/book#"
>          xmlns:REVIEW="http://localhost/bookstore/rdf/review#">
> 
> 
>         <RDF:Description about="http://localhost/bookstore/author/12178">
>             <AUTHOR:id>12178</AUTHOR:id>
>             <AUTHOR:firstname>Auteur #0</AUTHOR:firstname>
>             <AUTHOR:lastname>Nom famille</AUTHOR:lastname>
>         </RDF:Description>
> [...]
>         </RDF:Description>
>             <RDF:Description 
> about="http://localhost/bookstore/publisher/12178">
>             <PUBLISHER:id>12178</PUBLISHER:id>
>             <PUBLISHER:name>Publisher #0</PUBLISHER:name>
>         </RDF:Description>
> [...]
> 
> <RDF:Bag about="http://localhost/bookstore/myBookstore">                
> <RDF:li>
>          <RDF:Description about="http://localhost/bookstore/book/12178">
>             <BOOK:isbn>714877320</BOOK:isbn>
>             <BOOK:title>Livre #0</BOOK:title>
>             <BOOK:author 
> resource="http://localhost/bookstore/author/12178" />
>             <BOOK:publisher 
> resource="http://localhost/bookstore/publisher/12178" />
>         </RDF:Description>
>     </RDF:li>
> 
> [...]
> 
> </RDF:Bag>
> </RDF:RDF>
> 
> to a tree like this:
> 
> 
>      <tree id="treeBook" key="isbn" enableColumnDrag="true" flex="1" 
> sdatasources="bookstore_ext.rdf.php" 
> ref="http://localhost/bookstore/myBookstore" onAccept="handleAccept">
>         <treecols>
>           <treecol id="isbn" label="ISBN" flex="1" primary="true" />
>           <treecol id="title" label="Title" flex="2" />
>           <treecol id="author" label="Author" flex="1"  />
>           <treecol id="publisher" label="Publisher" flex="1" />
>         </treecols>
>             <template>
>                 <rule>
>                 <treechildren flex="1">
>                     <treeitem uri="rdf:*">
>                     <treerow  
> id="rdf:http://localhost/bookstore/book#isbn">
>                         <treecell 
> label="rdf:http://localhost/bookstore/rdf/book#isbn"/>
>                         <treecell 
> label="rdf:http://localhost/bookstore/rdf/book#title"/>
>                         <treecell 
> label="rdf:http://localhost/bookstore/rdf/author#lastname" 
> readonly="true"/>
>                         <treecell 
> label="rdf:http://localhost/bookstore/rdf/publisher#name" readonly="true"/>
>                     </treerow>
>                     </treeitem>
>                 </treechildren>
>                 </rule>
>             </template>          
>      </tree>
> 
> The tree ends up showing the isbn and title of the book, but I did'nt 
> succed yet to show the author nor the publisher. I guess a must define a 
> predicate but I can't figure it out.
> 
> Thank you
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.