This is great. I also found this utility as well. Not sure of the
difference, but it does what I needed.
Model m = ResourceUtils.reachableClosure(Resource r);
On Fri, Oct 18, 2013 at 2:28 AM, Dave Reynolds <[email protected]>wrote:
> If the description of a resource that you want is a "closed, bounded
> description" then you can use the Closure utility:
>
> Closure.closure(**startingResource, false, mymodel)
>
> Which would be equivalent to using ARQ's describe query.
>
> Dave
>
>
> On 17/10/13 21:52, Ralph Perniciaro wrote:
>
>> Thanks for the info. I am doing exactly what you mention in your first
>> email(Copying statements into another model). Using a recursive function
>> to handle the depth. I'm still not completely happy with the function
>> yet,
>> that is why I thought to ask in case I was making this harder then it
>> needed to be.
>>
>> Ralph
>>
>>
>> On Thu, Oct 17, 2013 at 2:09 PM, Joshua TAYLOR <[email protected]
>> >wrote:
>>
>> On Thu, Oct 17, 2013 at 3:07 PM, Joshua TAYLOR <[email protected]>
>>> wrote:
>>>
>>>> On Thu, Oct 17, 2013 at 1:15 PM, Ralph Perniciaro
>>>> <[email protected].**edu <[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 ));
>>>>
>>>
>>> Rereading your original email, it seems like you might have wanted
>>> another level deep, in which case you could do it with listStatements,
>>> but it's probably easier to just run a SPARQL construct query that
>>> will return a model to you. It'd look like
>>>
>>> construct { <theResource> ?p ?o . ?o ?p2 ?o2 . }
>>>
>>>
>>> --
>>> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>>>
>>>
>>
>