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#%22%3E <rdf:Description rdf:about="http://test%22%3E <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#%22%3E
<!-- example family (has an unlinked typifying name with non-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:titleAmaryllidaceae J.St.-Hil.</dc:title> dcterms:created2004-01-20 00:00:00.0</dcterms:created> dcterms:modified2005-06-23 15:45:33.0</dcterms:modified> tn:rankStringfam.</tn:rankString> tn:nameCompleteAmaryllidaceae</tn:nameComplete> tn:uninomialAmaryllidaceae</tn:uninomial> tn:authorshipJ.St.-Hil.</tn:authorship> tn:publishedInExpos. Fam. Nat. 1: 134. 1805 [Feb-Apr 1805]</tn:publishedIn> tn:year1805</tn:year> tn:typifiedBy tn:NomenclaturalType dc:titleAmaryllis 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