On Thu, Oct 17, 2013 at 1:15 PM, Ralph Perniciaro
<[email protected]> wrote:
> What is the best way to export an individual from a Model to RDF.  I don't
> want to export the entire Model to RDF, just a specific individual or
> resource.  Also, I would like to include any resources that the individual
> is related to, along with it's properties, if it is defined in that model.
>  Another way of looking at this would be replicating a resource and its
> associated resources to another model.

It's probably creating a new model, iterating through the statements
that have that resource as a subject, and adding those statements to
the new model. You could do this with Model.listStatements(...) [1],
which returns a StmtIterator, and model.add(StmtIterator) [2].  I
would look more or less like:

newModel.add( oldModel.listStatements( theResource, null, null ));

//JT

[1] 
http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/rdf/model/Model.html#listStatements(com.hp.hpl.jena.rdf.model.Resource,
com.hp.hpl.jena.rdf.model.Property, com.hp.hpl.jena.rdf.model.RDFNode)
[2] 
http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/rdf/model/Model.html#add(com.hp.hpl.jena.rdf.model.StmtIterator)

-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to