sub=obj;
obj=tmp;
ope=ope.getInverseProperty().getSimplified();
}
OWLNamedIndividual named=obj.asOWLNamedIndividual();
OWLAnonymousIndividual unnamed=sub.asOWLAnonymousIndividual();
namedNodes.add(named);
nodes.add(unnamed);
if (specialOPEdges.containsKey(unnamed)) {
Map<OWLNamedIndividual,Set<OWLObjectPropertyExpression>> specialEdges=specialOPEdges.get(unnamed);
if (specialEdges.containsKey(named)) {
specialEdges.get(named).add(ope);
}
else {
specialEdges=new HashMap<OWLNamedIndividual,Set<OWLObjectPropertyExpression>>();
Set<OWLObjectPropertyExpression> label=new HashSet<OWLObjectPropertyExpression>();
label.add(ope);
specialEdges.put(named,label);
specialOPEdges.put(unnamed,specialEdges);
}
}
else {
Map<OWLNamedIndividual,Set<OWLObjectPropertyExpression>> specialEdge=new HashMap<OWLNamedIndividual,Set<OWLObjectPropertyExpression>>();
Set<OWLObjectPropertyExpression> label=new HashSet<OWLObjectPropertyExpression>();
label.add(ope);
specialEdge.put(named,label);
specialOPEdges.put(unnamed,specialEdge);
}
}
else {
// both sub and obj anonymous
OWLObjectProperty op;
if (ope.isAnonymous()) {
// inverse role
op=ope.getNamedProperty();
OWLIndividual tmp=sub;
sub=obj;
obj=tmp;
}
else {
op=ope.asOWLObjectProperty();
}
OWLAnonymousIndividual subAnon=sub.asOWLAnonymousIndividual();
OWLAnonymousIndividual objAnon=obj.asOWLAnonymousIndividual();
nodes.add(subAnon);
nodes.add(objAnon);
if ((edges.containsKey(subAnon)&&edges.get(subAnon).contains(objAnon))||((edges.containsKey(objAnon)&&edges.get(objAnon).contains(subAnon)))) {
throw new IllegalArgumentException("Invalid input ontology: There are two object property assertions for the same anonymous individuals, "+"which is not allowed (see OWL 2 Syntax Sec 11.2). ");
}