You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Tsuyoshi Ito <ts...@trialox.org> on 2010/06/16 08:53:40 UTC

Problems using UnionMGraph

Hi there


I have used UnionMGraph to combine a SimpleMGraph with the contentgraph like the following:

I have a Resource aNode in the contentgraph which "has" the triple (aNode,PAGEMANAGER.menu, aMenuSection) now I create a GraphNode

new GraphNode(aNode, new UnionMGraph(new SimpleMGraph(), contentGraph) and add to this graph node the above triple (aNode,PAGEMANAGER.menu, aMenuSection) again

When I iterate over predicate the PAGEMANAGER.menu in a ssp it returns aMenuSection twice. I think it should appear only once.

So, right now I have to check before I add the triple again.Here the code snippet from the above scenario:


MGraph contentGraph = cgProvider.getContentGraph();
			SimpleMGraph result = new SimpleMGraph();
			node = new GraphNode(uri, new UnionMGraph(result, contentGraph));
			Iterator<Triple> menuSections = contentGraph.filter(null, RDF.type, PAGEMANAGER.Menu);
			while(menuSections.hasNext()) {
				Resource menuSection = menuSections.next().getSubject();
				Triple triple = new TripleImpl((NonLiteral) node.getNode(),PAGEMANAGER.menu, menuSection);
				if(!node.getGraph().contains(triple)){
					result.add(triple);
				}
			}

From my point of view a UnionMGraph should merge 2 triples which are identically based on the "set theory".

Cheers
Tsuy