Hi Peter,
In XML/ABBREV mode, the
serializer uses rdf:Types for element names. Since your example doesn't
have an rdf:Type, it uses the default Jena element names.
- Ben
Ben Szekely
IBM Software Engineer
Advanced Internet Technology, Cambridge, MA
bhszekel@us.ibm.com
tdwg-guid-bounces@mailman.nhm.ku.edu wrote on 09/25/2006
11:02:30 AM:
> Hi Everyone,
>
> Does anyone have/or know of any good examples of using Jena to output
> RDF metadata with non-typical namespaces such as TCS/RDF?
>
> Currently I have the following code for my metadata method(I know
it's
> wrong!).
>
> String TN_NS = "http://tdwg.org/2006/03/12/TaxonNames/";
> ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
> Model model = ModelFactory.createDefaultModel();
> Resource res = model.createResource("http://test");
> res.addProperty(model.createProperty(TN_NS,"testProperty"),"test");
>
> model.write(byteStream, "RDF/XML-ABBREV");
> return new MetadataResponse(new
> ByteArrayInputStream(byteStream.toByteArray()),null,MetadataResponse.RDF
> _FORMAT);
>
> ...which gives me.
>
> <rdf:RDF
> xmlns:j.0="http://tdwg.org/2006/03/12/TaxonNames/"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:about="http://test">
> <j.0:testProperty >test</j.0:testProperty>
> </rdf:Description>
> </rdf:RDF>
>
> ...whereas I could really do with something along the lines of the
IPNI
> metadata.
>
> <rdf:RDF xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> xmlns:dcterms="http://purl.org/dc/terms/"
> xmlns:tn="http://tdwg.org/2006/03/12/TaxonNames/"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>
> <!-- example family (has an unlinked typifying name
withnon-
> standard format data)-->
> <tn:TaxonName
> rdf:about="urn:lsid:ipni.org:names:30000959-2:1.1.2.1">
> <tn:nomenclaturalCode rdf:resource="&tn;#botanical"
/>
> <dc:title>Amaryllidaceae J.St.-Hil.</dc:title>
> <dcterms:created>2004-01-20 00:00:00.0</dcterms:created>
> <dcterms:modified>2005-06-23
> 15:45:33.0</dcterms:modified>
> <tn:rankString>fam.</tn:rankString>
> <tn:nameComplete>Amaryllidaceae</tn:nameComplete>
> <tn:uninomial>Amaryllidaceae</tn:uninomial>
> <tn:authorship>J.St.-Hil.</tn:authorship>
> <tn:publishedIn>Expos. Fam. Nat. 1: 134.
1805 [Feb-Apr
> 1805]</tn:publishedIn>
> <tn:year>1805</tn:year>
> <tn:typifiedBy>
> <tn:NomenclaturalType>
> <dc:title>Amaryllis Linnaeus,
nom.
> cons.</dc:title>
> </tn:NomenclaturalType>
> </tn:typifiedBy>
> </tn:TaxonName>
>
> I think the main problem I have is creating resources that aren't
> defined as vocabularies within Jena already. I can't seem to find
a way
> to create that <tn:TaxonName root resource element.
>
> I'm starting to think that just outputting vanilla text could be the
> best option here, or am I barking up the wrong tree?
>
> Many thanks, Peter.
>
> Peter Hollas MSc BSc(hons) (Peter.Hollas@thomson.com)
> Software Engineer /Systems Administrator
> Thomson Zoological
> Innovation Centre
> York Science Park
> Heslington
> York
> YO10 5DG
>
> Tel: 01904-435113
> Fax: 01904-435114
>
>
>
> _______________________________________________
> TDWG-GUID mailing list
> TDWG-GUID@mailman.nhm.ku.edu
> http://mailman.nhm.ku.edu/mailman/listinfo/tdwg-guid