*/
protected void saveMTheory(){
OWLNamedClass mTheoryClass = getOwlModel().getOWLNamedClass(MTHEORY);
// check if individual exists
OWLIndividual mTheoryIndividual = getOwlModel().getOWLIndividual(getMebn().getName());
if (mTheoryIndividual == null) {
// if this individual is new, create it
mTheoryIndividual = mTheoryClass.createOWLIndividual(getMebn().getName());
}
Debug.println("MTheory = " + getMebn().getName());
if(getMebn().getDescription() != null){
mTheoryIndividual.addComment(getMebn().getDescription());
}
/* hasMFrag */
OWLObjectProperty hasMFragProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasMFrag");
List<MFrag> listDomainMFrag = getMebn().getDomainMFragList();
for(MFrag domainMFrag: listDomainMFrag){
OWLNamedClass domainMFragClass = getOwlModel().getOWLNamedClass(DOMAIN_MFRAG);
Debug.println("Domain_MFrag = " + domainMFrag.getName());
// check if individual exists.
OWLIndividual domainMFragIndividual = getOwlModel().getOWLIndividual(this.MFRAG_NAME_PREFIX + domainMFrag.getName());
if (domainMFragIndividual == null) {
// if new, create it
domainMFragIndividual = domainMFragClass.createOWLIndividual(this.MFRAG_NAME_PREFIX + domainMFrag.getName());
}
getMapMFrag().put(domainMFrag, domainMFragIndividual);
mTheoryIndividual.addPropertyValue(hasMFragProperty, domainMFragIndividual);
if(domainMFrag.getDescription()!=null){
domainMFragIndividual.addComment(domainMFrag.getDescription());
}
/* hasResidentNode */
OWLObjectProperty hasResidentNodeProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasResidentNode");
for(Node node: domainMFrag.getNodeList()){
if (node instanceof ResidentNode) {
ResidentNode residentNode = (ResidentNode) node;
Debug.println("Domain_Res = " + residentNode.getName());
// check if individual exists
OWLIndividual domainResIndividual = getOwlModel().getOWLIndividual(this.RESIDENT_NAME_PREFIX + residentNode.getName());
if (domainResIndividual == null) {
// if new, create it
OWLNamedClass domainResClass = null;
if (residentNode instanceof ContinuousResidentNode) {
// get owl class for continuous nodes
domainResClass = getOwlModel().getOWLNamedClass(CONTINUOUS_RESIDENT_NODE);
if (domainResClass == null) {
// if CONTINUOUS_RESIDENT_NODE does not exist, create it
domainResClass = getOwlModel().createOWLNamedSubclass(CONTINUOUS_RESIDENT_NODE, getOwlModel().getOWLNamedClass(DOMAIN_RESIDENT));
}
} else {
// get owl class for resident nodes
domainResClass = getOwlModel().getOWLNamedClass(DOMAIN_RESIDENT);
}
domainResIndividual = domainResClass.createOWLIndividual(this.RESIDENT_NAME_PREFIX + residentNode.getName());
}
domainMFragIndividual.addPropertyValue(hasResidentNodeProperty, domainResIndividual);
getMapDomainResident().put(residentNode, domainResIndividual);
}
}
/* hasInputNode */
OWLObjectProperty hasInputNodeProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasInputNode");
OWLNamedClass generativeInputClass = getOwlModel().getOWLNamedClass(GENERATIVE_INPUT);
for(InputNode inputNode: domainMFrag.getInputNodeList()){
Debug.println("Generative_input = " + inputNode.getName());
// check if individuals exists
OWLIndividual generativeInputIndividual = getOwlModel().getOWLIndividual(inputNode.getName());
if (generativeInputIndividual == null) {
// if new, create it
generativeInputIndividual = generativeInputClass.createOWLIndividual(inputNode.getName());
}
domainMFragIndividual.addPropertyValue(hasInputNodeProperty, generativeInputIndividual);
getMapGenerativeInput().put(inputNode, generativeInputIndividual);
}
/* hasContextNode */
OWLObjectProperty hasContextNodeProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasContextNode");
OWLNamedClass contextClass = getOwlModel().getOWLNamedClass(CONTEXT_NODE);
for(ContextNode contextNode: domainMFrag.getContextNodeList()){
// check if individuals exist
OWLIndividual contextIndividual = getOwlModel().getOWLIndividual(contextNode.getName());
if (contextIndividual == null) {
// if new, create it
contextIndividual = contextClass.createOWLIndividual(contextNode.getName());
}
domainMFragIndividual.addPropertyValue(hasContextNodeProperty, contextIndividual);
getMapContext().put(contextNode, contextIndividual);
}
/* hasOVariable */
OWLObjectProperty hasOVariableProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasOVariable");
OWLNamedClass oVariableClass = getOwlModel().getOWLNamedClass(ORDINARY_VARIABLE);
OWLObjectProperty isSubsByProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("isSubsBy");
for(OrdinaryVariable oVariable: domainMFrag.getOrdinaryVariableList()){
// Set variable name as "MFragName.OVName"
OWLIndividual oVariableIndividual = getOwlModel().getOWLIndividual(
oVariable.getMFrag().getName() + SCOPE_SEPARATOR
+ oVariable.getName() );
if (oVariableIndividual == null) {
oVariableIndividual = oVariableClass.createOWLIndividual(
oVariable.getMFrag().getName() + SCOPE_SEPARATOR
+ oVariable.getName() );
}
domainMFragIndividual.addPropertyValue(hasOVariableProperty, oVariableIndividual);
if (oVariable.getValueType() != null){
oVariableIndividual.addPropertyValue(isSubsByProperty, getMapMetaEntity().get(oVariable.getValueType().getName()));
}
if(oVariable.getDescription() != null){
oVariableIndividual.addComment(oVariable.getDescription());
}
getMapOrdinaryVariable().put(oVariable, oVariableIndividual);
}
}