The advice given seems very clear:
> when adding such elements to a graph, you should create them once and store
> the reference if you will need to refer to those elements more than once
> during creation
Use Resource myResource = model.createResource("some URI") and reuse myResource
as often as needed.
What is the purpose of adding Jena resources to a Guava graph? It seems
plausible that you are duplicating functionality found in Jena.
ajs6f
> On Dec 27, 2017, at 12:41 PM, Victor Porton <[email protected]> wrote:
>
> From https://github.com/google/guava/wiki/GraphsExplained :
>
> don't construct multiple elements that are equal to each other and
> expect them to be interchangeable. In particular, when adding such
> elements to a graph, you should create them once and store the
> reference if you will need to refer to those elements more than once
> during creation (rather than passing new MyMutableNode(id) to each
> add*() call).
>
> But I want a graph whose vertices are Resource from Jena. Because one
> resource may be met in a model multiple times, I expect that Jena will
> give me multiple instances of Resource with the same URL. What to do?
> How can I make a graph with Resource as vertices?
>
> Please help.