1

I am very new to web ontology languages, I have created owl files using protege and I have to write a program that should merge these files into one. Is it possible with jena? Can anyone help with how to proceed?Can I do that in java using owl API? thanks in advance.

Max
  • 35
  • 6
  • 2
    possible duplicate of [Merging multiple RDF documents into one](http://stackoverflow.com/questions/18958255/merging-multiple-rdf-documents-into-one) – Joshua Taylor Oct 09 '13 at 21:26
  • 2
    Jena works at the RDF level, not the OWL level, so you will have to have your OWL files in RDF format (which I think is the default, so you probably already have this). The linked duplicated question shows how to merge two RDF files. As to eliminating common classes: if they are actually common classes (i.e., identified by the same IRI), then they'll be “merged” properly. RDF is based on _sets_ of statements, and _sets_ don't have duplicates, so if something appears in both input files, it will only appear once in the output. – Joshua Taylor Oct 09 '13 at 21:27
  • Thanks for the prompt reply – Max Oct 10 '13 at 20:09
  • @Joshua Am still having problems with the merging because all the IRIs seem to be different so it only attaches the second ontology to the first instead of merging. I want the subclasses of the second ontology to be the subclasses of the first if the names of the classes are the same. Could you help me out please? thanks – Max Oct 22 '13 at 07:29
  • You said that the IRIs of the classes are different. What do you mean, then, that the classes have the same name? Do they have an rdfs:label? Some other property indicating a name? Have the same suffix after their respective namespace prefixes? – Joshua Taylor Oct 22 '13 at 11:17
  • Is this related to your new question, [Merge equivalent classes using the OWL-API](http://stackoverflow.com/q/19515464/1281433)? If it is, it would be better to clarify this question than to ask a new one. It's hard to tell, though, because it's not clear what the error in the new question _is_. – Joshua Taylor Oct 22 '13 at 13:02
  • @Joshua. thanks for the responds.Yes it is related and i tried to do that with java.The whole idea is that I have a general ontology and it might contain a class/entity(e.g. parent) and I want to plugin smaller ontologies such if this smaller ontolgy also has a class/entity called – Max Oct 22 '13 at 18:27
  • As I asked in an earlier comment, "what do you mean that the classes have the same name? Do they have an rdfs:label? Some other property indicating a name? Have the same suffix after their respective namespace prefixes?" You'll need to add some `owl:equivalentClass` relations between the classes with the same name, but we can't help you do that if we don't know how you're defining "have the same name." – Joshua Taylor Oct 22 '13 at 18:33
  • @Joshua. thanks for the responds.Yes it is related and i tried to do that with java.The whole idea is that I have a general ontology such that it might contain a class/entity(e.g. parent) and I want to plugin a smaller ontology such that if this smaller ontolgy also has a class/entity called parent, then after the merge, the subclasses of this smaller ontology will be transferred to the subclass of the general ontology.I tried with protege and the merge didn't work that way. hope this will add clarification to the question. thank you. – Max Oct 22 '13 at 18:34
  • Combining the RDF files is not a problem. Adding `owl:equivalentClass` axioms to "merge" the classes from the different ontologies is not a problem. But we need to know _how you're determining whether two classes have the same name_. E.g., do `ns1:Person` and `n2:Person` have the same name because they have the same suffix? Do `ns0:Class73` and `ns0:Class85` have the same name if they both have `rdfs:label "Cat"@en`? Once you say how you want to detect classes with the same name, it will be easy to add the relevant `owl:equivalentClass` axioms. – Joshua Taylor Oct 22 '13 at 18:45
  • for instance in one ontology, I Event as a class with a subclass such as movement <!http://www.semanticweb.org/max/ontologies/2013/2/Action1.owl#Event - and in the general ontology I also have EVENT as a class both of them are events because the words match. lets say classes have the same name if the words match. thank you Joshua. – Max Oct 22 '13 at 19:37
  • So, to be clear, you mean that there are prefixes defined such that the suffix of the classes' IRIs equal under a case insensitive string comparison, right? – Joshua Taylor Oct 22 '13 at 21:05
  • yes. that is exactly what i mean – Max Oct 23 '13 at 15:59
  • @ Joshua...Hi Joshua, any suggestion on how to proceed? thanks alot in advance – Max Oct 28 '13 at 17:20

1 Answers1

1

I was able to solve it with protege and it works. Thanks for all the comments and contributions. It helped a lot. :-)

Max
  • 35
  • 6
  • using the refactor menu on protege, copy the iri from the rename entity column and rename the class you want to have this particular iri. Classes will automatically be recognised since they have the same iri's. – Max Dec 03 '13 at 12:43