I have RDF/XML data which looks like:
<rdf:RDF>
<rdf:Description rdf:about="https://localhost/process/members/test">
<process:user rdf:resource="https://localhost/users/test"/>
<process:roleAssignments rdf:parseType="Collection">
<rdf:Description rdf:about="https://localhost/process/role/ProductOwner">
<process:roleUrl rdf:resource="https://localhost/role/ProductOwner"/>
</rdf:Description>
<rdf:Description rdf:about="https://localhost/process/role/TeamMember">
<process:roleUrl rdf:resource="https://localhost/role/TeamMember"/>
</rdf:Description>
</process:roleAssignments>
</rdf:Description>
</rdf:RDF>
It is not very strict, but I just want to know how to use Jena API to output the rdf:Collection like the above example.
Confusingly what
parsetype="collection"
creates is an rdf list, not a collection. This might have thwarted your searches.What you want is an
RDFList
which you can create using a number of methods inModel
. Let's assume you have most of what you need already in terms of resources and properties. The list can be created as follows:You could also create an empty list and add each item to it.