On Thursday, October 17, 2013 03:07:07 PM Joshua TAYLOR wrote: > 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 ));
If the object of a property is a blank node, probably want to copy /its/ properties also. Making sure that repetition and loops are handled. Chris
