[redland-dev] merging files aka changing/replacing statements

Nicolas Chauvat nico at logilab.fr
Wed Dec 1 07:37:39 PST 2004


Hi List,

I'm trying to merge FOAF files.

I have a file that describes a Person A who knows Person B and a file that
describes Person B who knows Person A.

When I get redland to parse these files, I end up with 4 Persones instead of
2. This is fine since I did not expect Redland to know about the semantics
of my data and magically realize that A and B were the same in the two files.

My problem is that in the store, I have :

blank_node_1 -- rdf:type --> Person
blank_node_1 -- foaf:name --> A
blank_node_2 -- rdf:type --> Person
blank_node_2 -- foaf:name --> B
blank_node_3 -- rdf:type --> Person
blank_node_3 -- foaf:name --> A
blank_node_4 -- rdf:type --> Person
blank_node_5 -- foaf:name --> B

What I want to do during my merge process is to look for Persons named A
and merge the blank_nodes in case I find more than one person named A.

I've tried a lot of things but have not managed to reference blank_nodes
since they appear to be anonymous and do not have a fixed identified.

In a first pass I find that blank_node_1 and blank_node_3 are actually called
r12345r1 and r12345r2 and when I decide that all statements that have r12345r2
as an object have to be transformed into statements that have r12345r1 as the 
object, I cannot find any. That second query tells me that blank_node_1 and
blank_node_3 are now called something else, like r12345r10 and r12345r11.

Any suggestion ?

PS: please try to use python syntax if you reply with code.

-- 
Nicolas Chauvat

logilab.fr - services en informatique avancée et gestion de connaissances  


More information about the redland-dev mailing list