*/
protected void loadDomainMFrag() throws IOMebnException {
MFrag domainMFrag;
OrdinaryVariable oVariable;
ContextNode contextNode;
ResidentNode domainResidentNode;
InputNode generativeInputNode;
BuiltInRV builtInRV;
RDFIndividual individualOne;
RDFIndividual individualTwo;
OWLNamedClass owlNamedClass;
OWLObjectProperty objectProperty;
owlNamedClass = getOwlModel().getOWLNamedClass(DOMAIN_MFRAG);
Collection instances = owlNamedClass.getInstances(false);
for (Iterator it = instances.iterator(); it.hasNext();) {
individualOne = (RDFIndividual) it.next();
domainMFrag = getMapDomainMFrag().get(individualOne.getBrowserText());
if (domainMFrag == null) {
throw new IOMebnException(
getResource().getString("DomainMFragNotExistsInMTheory"),
individualOne.getBrowserText());
}
Debug.println("DomainMFrag loaded: "
+ individualOne.getBrowserText());
domainMFrag.setDescription(getDescription(individualOne));
/* -> hasResidentNode */
objectProperty = (OWLObjectProperty) getOwlModel()
.getOWLObjectProperty("hasResidentNode");
instances = individualOne.getPropertyValues(objectProperty);
for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
Object itInNext = itIn.next();
if (!(itInNext instanceof RDFIndividual)) {
try {
System.err.println(itInNext + " != RDFIndividual");
} catch (Throwable t) {
t.printStackTrace();
}
continue;
}
individualTwo = (RDFIndividual) itInNext;
// remove prefixes from the name
String name = individualTwo.getBrowserText();
if (name.startsWith(SaverPrOwlIO.RESIDENT_NAME_PREFIX)) {
try {
name = name.substring(SaverPrOwlIO.RESIDENT_NAME_PREFIX
.length());
} catch (Exception e) {
// ignore, because we can still try the original name
e.printStackTrace();
}
}
// instanciate a continuous resident node instead of resident node, if individual is assignable to a continuous node
if (individualTwo.hasRDFType(getOwlModel().getOWLNamedClass(CONTINUOUS_RESIDENT_NODE), true)) {
domainResidentNode = new ContinuousResidentNode(name, domainMFrag);
// try {
// ((ContinuousResidentNode)domainResidentNode).onAddToMFrag(domainMFrag);
// } catch (MFragDoesNotExistException e) {
// e.printStackTrace();
// }
} else {
domainResidentNode = new ResidentNode(name, domainMFrag);
}
getMebn().getNamesUsed().add(name);
domainMFrag.addResidentNode(domainResidentNode);
// the mappings uses the original names (no prefix removal)
getMapDomainResidentNode().put(individualTwo.getBrowserText(),
domainResidentNode);
getMapMultiEntityNode().put(individualTwo.getBrowserText(),
domainResidentNode);
Debug.println("-> " + individualOne.getBrowserText() + ": "
+ objectProperty.getBrowserText() + " = "
+ individualTwo.getBrowserText());
}
/* -> hasInputNode */
objectProperty = (OWLObjectProperty) getOwlModel()
.getOWLObjectProperty("hasInputNode");
instances = individualOne.getPropertyValues(objectProperty);
for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
individualTwo = (RDFIndividual) itIn.next();
generativeInputNode = new InputNode(
individualTwo.getBrowserText(), domainMFrag);
getMebn().getNamesUsed().add(individualTwo.getBrowserText());
domainMFrag.addInputNode(generativeInputNode);
getMapGenerativeInputNode().put(individualTwo.getBrowserText(),
generativeInputNode);
getMapMultiEntityNode().put(individualTwo.getBrowserText(),
generativeInputNode);
Debug.println("-> " + individualOne.getBrowserText() + ": "
+ objectProperty.getBrowserText() + " = "
+ individualTwo.getBrowserText());
}
/* -> hasContextNode */
objectProperty = (OWLObjectProperty) getOwlModel()
.getOWLObjectProperty("hasContextNode");
instances = individualOne.getPropertyValues(objectProperty);
for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
individualTwo = (RDFIndividual) itIn.next();
contextNode = new ContextNode(individualTwo.getBrowserText(),
domainMFrag);
getMebn().getNamesUsed().add(individualTwo.getBrowserText());
domainMFrag.addContextNode(contextNode);
getMapContextNode().put(individualTwo.getBrowserText(), contextNode);
getMapMultiEntityNode().put(individualTwo.getBrowserText(),