Hi all,

I'm mostly using the REST API to manage a Fedora 3.4 instance, and I'm
getting a bit confused when managing RELS-EXT -- namely, the formatting
difference I see when retrieving and storing relationships.

Example:

http://www.example.com:8080/fedora/objects/ampm:801/datastreams/RELS-EXT/content


Gives the following output:

<rdf:RDF xmlns:fedora-model="info:fedora/fedora-system:def/model#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; xmlns:rdfs="
http://www.w3.org/2000/01/rdf-schema#";
xmlns:rel="info:fedora/fedora-system:def/relations-external#" xmlns:myns="
http://www.nsdl.org/ontologies/relationships#";>
                                        <rdf:Description
rdf:about="info:fedora/ampm:801">
                                                <rel:isMemberOf
rdf:resource="info:fedora/ampm:Archive"></rel:isMemberOf>
                                                <fedora-model:hasModel
rdf:resource="info:fedora/ampm:Media"></fedora-model:hasModel>
                                        </rdf:Description>
</rdf:RDF>

...which is what I expect, as that's how the objects were originally
ingested. Note the namespace specified in the opening rdf:RDF tag and the
use of prefixes throughout.

And this method:

http://www.example.com:8080/fedora/objects/ampm:801/relationships  (using
GET)

Gives the following output:

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>

<rdf:Description rdf:about="info:fedora/ampm:801">
<hasModel xmlns="info:fedora/fedora-system:def/model#"
rdf:resource="info:fedora/ampm:Media"/>
<hasModel xmlns="info:fedora/fedora-system:def/model#"
rdf:resource="info:fedora/fedora-system:FedoraObject-3.0"/>
<isMemberOf xmlns="info:fedora/fedora-system:def/relations-external#"
rdf:resource="info:fedora/ampm:Archive"/>
</rdf:Description>

</rdf:RDF>

If this is just how the /relationship/ method prefers to disseminate the
RDF, that's fine by me, but where I'm *really* running into trouble is when
I try to add a new relationship.

If I use a POST like:

http://www.example.com:8080/fedora/objects/ampm:801/relationships/new?subject=info:fedora/ampm:801&predicate=rel:isPartOf&object=info:fedora/ampm:100

I get back an HTTP 200 OK response, but the RELS-EXT datastream now looks
like this:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>

<rdf:Description rdf:about="info:fedora/ampm:801">
<isMemberOf xmlns="info:fedora/fedora-system:def/relations-external#"
rdf:resource="info:fedora/ampm:Archive"></isMemberOf>
<hasModel xmlns="info:fedora/fedora-system:def/model#"
rdf:resource="info:fedora/ampm:Media"></hasModel>
<isPartOf xmlns="rel:" rdf:resource="info:fedora/ampm:100"></isPartOf>
</rdf:Description>

</rdf:RDF>

The removal of prefixes and explicit inclusion of namespaces to each element
is one thing, but it's also gone ahead and treated rel: as a namespace
instead of a namespace prefix (I think?!), which breaks stuff.

Never being one to give up, I encoded the full namespace URI and tried
passing that as a "prefix" when sending my API call:

http://www.example.com:8080/fedora/objects/ampm:801/relationships/new?subject=info:fedora/ampm:801&predicate=info%3Afedora%2Ffedora-system%3Adef%2Frelations-external%23:isPartOf&object=info:fedora/ampm:100

...which seems to result in a working RELS-EXT, although the prefixes are
still replaced with explicit namespace attributes:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>

<rdf:Description rdf:about="info:fedora/ampm:801">
<isMemberOf xmlns="info:fedora/fedora-system:def/relations-external#"
rdf:resource="info:fedora/ampm:Archive"></isMemberOf>
<hasModel xmlns="info:fedora/fedora-system:def/model#"
rdf:resource="info:fedora/ampm:Media"></hasModel>
<isPartOf xmlns="info:fedora/fedora-system:def/relations-external#:"
rdf:resource="info:fedora/ampm:100"></isPartOf>
</rdf:Description>

</rdf:RDF>

Now, I don't particularly mind how this datastream is formatted, as long as
I can be sure that the Resource Index is happy with it like this, and that I
know which "prefix" to consistently use when adding new relationships. Will
I run into bother if I don't use prefixes?

Given that the "GET" relationships method seems to crosswalk between the raw
RELS-EXT and the prefix-less RDF, was the "POST" method intended to do a
similar job, so that the raw RDF was able to keep prefixes?

Thanks in advance for any helpful tips! If I'm doing something silly with my
RELS-EXT please point it out, because I'm fairly new to the Fedora Resource
Index.

Cheers,

Kim

Kim Shepherd
Te Tumu Herenga
University of Auckland
------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to