I am using JENA to read the annotation properties defined in axioms in an ontology. For example I have this individual and its attached axioms
<owl:NamedIndividual rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#firstPizza">
<rdf:type rdf:resource="http://www.co-ode.org/ontologies/pizza/pizza.owl#Pizza"/>
<hasCountryOfOrigin>
<Country>
<hasCountryOfOrigin rdf:resource="http://www.co-ode.org/ontologies/pizza/pizza.owl#Italy"/>
</Country>
</hasCountryOfOrigin>
</owl:NamedIndividual>
<owl:Axiom>
<owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string">123</owl:versionInfo>
<owl:annotatedSource rdf:resource="http://www.co-ode.org/ontologies/pizza/pizza.owl#firstPizza"/>
<owl:annotatedProperty rdf:resource="http://www.co-ode.org/ontologies/pizza/pizza.owl#hasCountryOfOrigin"/>
<owl:annotatedTarget>
<Country>
<hasCountryOfOrigin rdf:resource="http://www.co-ode.org/ontologies/pizza/pizza.owl#Italy"/>
</Country>
</owl:annotatedTarget>
</owl:Axiom>
Here we have an annotation over the relation (the first hasCountryOfOrigin) between the individual(firstPizza) and an Anonymous individual. I was able to read the axioms and parse them to a custom data structure of my own. My problem is: I can't find a way to tell that the anonymous individual inside firstPizaa is the same one as the anonymous individual in the axiom. JENA gives each one of them different id. How can I tell that they are equal or not?
If this is the input you get, you cannot infer that the two nodes are the same node in the intention of the writer - the parsing rules say that these should be two distinct nodes. The fact that they have identical values for the properties you see might not be relevant.
If you're producing this output, you should be able to specify the same node id when creating the individuals. This should result in an rdf:nodeid attribute on the blank individuals, which then the parser would interpret as the same individual.