How to compare two rdf files and detect changes. also it should return what is the change or it should return the triples

asked 03 Jan '13, 06:21

vipincpy's gravatar image

vipincpy
393
accept rate: 0%

closed 03 Jan '13, 13:01

Signified's gravatar image

Signified ♦
24.0k1623

Duplicate of: "How to find the diff between RDF dumps?"

http://answers.semanticweb.com/questions/14103/how-to-find-the-diff-between-rdf-dumps

I can't see an answer to one that's not an answer to the other. (Merge?)

(03 Jan '13, 13:00) Signified ♦ Signified's gravatar image

Re-opening the question, since it received upvotes and several serious answers within the last 24 hours. Let's wait and see...

(04 Jan '13, 07:04) Michael Schn... ♦ Michael%20Schneider's gravatar image

Assuming you are using Jena as your tags suggest you can do the following:

Model diff = a.difference(b);

See the difference() method documentation for description of what exactly this returns.

permanent link

answered 03 Jan '13, 06:34

Rob%20Vesse's gravatar image

Rob Vesse ♦
13.9k1715
accept rate: 29%

Thanks a lot sir....this should help me..

(04 Jan '13, 06:40) vipincpy vipincpy's gravatar image

If you just want to check whether they are the same or different:

Model.isIsomorphicWith

which works by trying to find does blank node isomorphism from one model to the other.

Full details: http://www.hpl.hp.com/techreports/2001/HPL-2001-293.pdf

permanent link

answered 03 Jan '13, 08:29

AndyS's gravatar image

AndyS ♦
13.5k37
accept rate: 33%

If your RDF files represent valid OWL 2 ontologies, you can use the owl2diff tool from owl2vcs.

If you need to do it programmatically, the code is open source. The tool is based on OWL API.

Here is an example of what the tool produces. Not triples, but axioms.

$ owl2diff pizza14.owl pizza15.owl
* OntologyID(<http://www.co-ode.org/ontologies/pizza/pizza.owl>)
- Prefix(daml:=<http://www.daml.org/2001/03/daml+oil#>)
- Prefix(protege:=<http://protege.stanford.edu/plugins/owl/protege#>)
* Prefix(:=<http://www.co-ode.org/ontologies/pizza/2006/07/18/pizza.owl#> <http://www.co-ode.org/ontologies/pizza/pizza.owl#>)
- Prefix(dc:=<http://purl.org/dc/elements/1.1/>)
- Import(<http://protege.stanford.edu/plugins/owl/protege>)
- Annotation(protege:defaultLanguage "en"^^xsd:string)
- Annotation(owl:versionInfo "version 1.4"^^xsd:string)
+ Annotation(owl:versionInfo "version 1.5"^^xsd:string)
+ Annotation(owl:versionInfo "v.1.5. Removed protege.owl import and references. Made ontology URI date-independent"@en)
- AnnotationAssertion(rdfs:comment :SpicyPizzaEquivalent "An alternative definition for the SpicyPizza which does away with needing a definition of SpicyTopping and uses a slightly more complicated restriction: Pizzas that have at least one topping that is both a PizzaTopping and has spiciness hot are members of this class. "@en)
- AnnotationAssertion(rdfs:comment :VegetarianPizzaEquivalent2 "An alternative to VegetarianPizzaEquiv1 that does not require a definition of VegetarianTopping. Perhaps more difficult to maintain. Not equivalent to VegetarianPizza "@en)
- AnnotationAssertion(rdfs:label :GoatsCheeseTopping "CoberturaDeQueijoDeCabra  "@pt)
+ ClassAssertion(owl:Thing :France)
+ AnnotationAssertion(rdfs:comment :VegetarianPizzaEquivalent2 "An alternative to VegetarianPizzaEquiv1 that does not require a definition of VegetarianTopping. Perhaps more difficult to maintain. Not equivalent to VegetarianPizza"@en)
+ ClassAssertion(owl:Thing :England)
+ AnnotationAssertion(rdfs:comment :SpicyPizzaEquivalent "An alternative definition for the SpicyPizza which does away with needing a definition of SpicyTopping and uses a slightly more complicated restriction: Pizzas that have at least one topping that is both a PizzaTopping and has spiciness hot are members of this class."@en)
+ ClassAssertion(owl:Thing :Germany)
+ ClassAssertion(owl:Thing :America)
+ AnnotationAssertion(rdfs:label :GoatsCheeseTopping "CoberturaDeQueijoDeCabra"@pt)
+ ClassAssertion(owl:Thing :Italy)
permanent link

answered 03 Jan '13, 10:49

utapyngo's gravatar image

utapyngo
1.9k312
accept rate: 19%

edited 03 Jan '13, 10:51

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×877
×614

question asked: 03 Jan '13, 06:21

question was seen: 1,160 times

last updated: 05 Jan '13, 07:02