Hi Roland! [Note: this reply isn't really about RDFLib, so pardon me for going a bit off-topic.]
The problem in your use case is that references to <http://foo.example.com#1234> do refer to the same object. The two serializations represent equivalent graphs (RDF/XML striping in the first may make it appear "closed", but in fact it is not - two nickName statements are being made about the same resource). What you need - and has begun to do - is to represent two unique resources in the collection, easily done with BNodes. You already do that with the operations (DeleteProperty), but you also need to change the statement which speaks of the property and value to operate on so that the BNode is the subject. Then associate these unique operations with the target resource (I use "subject" here to align with the triple to be deleted). To somewhat match your original, say: <_5:DeleteProperty> <_5:subject rdf:resource="http://foo.example.com#1234"/> <_5:pattern rdf:parseType="Resource"> <_3:nickName>one</_3:nickName> </_5:pattern> </_5:DeleteProperty> But this "pattern" suggestion may be at least more complex than necessary; better could be along the lines of: <_5:DeleteStatement> <_5:subject rdf:resource="http://foo.example.com#1234"/> <_5:predicate rdf:resource="http://example.com/namespace-for-_3#nickName"/> <_5:object>one</_5:object> </_5:DeleteStatement> (See also e.g. RDF reification with rdf:Statement, OWL and FRESNEL <http://www.w3.org/2005/04/fresnel-info/manual/> for examples of speaking about statements and/or matching properties and values. Be careful with rdf:Statement and associated properties themselves though - as these are reified statements and would be added as such (here in the message graph) if used.) There may be other theoretical problems with this, but I don't see anything raising practical difficulty in your case. (There is still the possibility that the two bnodes represent the same thing - based on the "no uniqueness assumption" in RDF model theory - but that is purely academical without a reasoner and (OWL) statements to the effect of equating them (by means of e.g. owl:InverseFunctionalProperty).) Finally, you may also be interested in SPARQL/Update (SPARUL) and similar approaches to RDF modification languages. See e.g.: <http://dowhatimean.net/2007/03/sparul%E2%80%94sparql-update-language> Best of luck, Niklas On 8/17/07, Roland Hedberg <[EMAIL PROTECTED]> wrote: > Hi! > > I've encountered a snag which I'd like your help to solve. > > What I must be able to produce are XML/RDF that looks like this snippet: > > <_4:Message> > <_4:bodyList rdf:parseType="Collection"> > <_5:DeleteProperty> > <_5:object> > <_3:Person rdf:about="http://foo.example.com#1234"> > <_3:nickName>one</_3:nickName> > </_3:Person> > </_5:object> > </_5:DeleteProperty> > <_5:DeleteProperty> > <_5:object> > <_3:Person rdf:about="http://foo.example.com#1234"> > <_3:nickName>two</_3:nickName> > </_3:Person> > </_5:object> > </_5:DeleteProperty> > </_4:bodyList> > </_4:Message> > > What this represents is a set of operations where the order between them > are important. In this case all the operations are on the same object > that does not have to always be the case. > > Now, what I have been using up until now, when creating the RDF/XML > stuff are code that looks like this: > > def graph(formar="pretty-xml") > store = ConjunctiveGraph() > for t in self.triple(): > store.add(t) > return store.serialize(format=format) > > But this doesn't work in the above mention case because I can not using > this function make the serializer realize that it should not treat the > two references to "#1234" as referring to the same object in this graph. > > What it comes out as is this: > > <_4:Message> > <_4:bodyList rdf:parseType="Collection"> > <_5:DeleteProperty> > <_5:object> > <_3:Person rdf:about="http://foo.example.com#1234"> > <_3:nickName>one</_3:nickName> > <_3:nickName>two</_3:nickName> > </_3:Person> > </_5:object> > </_5:DeleteProperty> > <_5:DeleteProperty> > <_5:object rdf:resource="http://foo.example.com#1234"/> > </_5:DeleteProperty> > </_4:bodyList> > </_4:Message> > > Which is not the same thing. > > Are there other means of serializing, using rdflib, to RDF/XML which > would allow me to produce the RDF/XML I need ? > > -- Roland > > > _______________________________________________ > Dev mailing list > Dev@rdflib.net > http://rdflib.net/mailman/listinfo/dev > _______________________________________________ Dev mailing list Dev@rdflib.net http://rdflib.net/mailman/listinfo/dev