econniterativepartitioning.java

来自「Semantic Web Ontology Editor」· Java 代码 · 共 1,353 行 · 第 1/5 页

JAVA
1,353
字号
				if (superProperties.get(prop)!=null) related.addAll((HashSet) this.superProperties.get(prop));				for (Iterator iter2 = related.iterator(); iter2.hasNext();) {					OWLProperty relProp = (OWLProperty) iter2.next();					// ensure same state (S2/S3/S4) of relProp and prop					if (!currentState.equals("S2") && checkState(relProp, STATE_L12))  {						if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S2 because related property "+ getName(relProp) + " is in S2");						out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S2 because related property "+ getName(relProp) + " is in S2 <br>");						changed = this.makeStateChange(prop, STATE_L12, removeFrom, this.ObjPropS2);													}					else if (!currentState.equals("S3") && checkState(relProp, STATE_L21))  {						if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S3 because related property "+ getName(relProp) + " is in S3");						out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S3 because related property "+ getName(relProp) + " is in S3 <br>");						changed = this.makeStateChange(prop, STATE_L21, removeFrom, this.ObjPropS3);													}					else if (!currentState.equals("S4") && checkState(relProp, STATE_O2))  {						if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because related property "+ getName(relProp) + " is in S4");						out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because related property "+ getName(relProp) + " is in S4 <br>");						changed = this.makeStateChange(prop, STATE_O2, removeFrom, this.ObjPropS4);													}					if (changed) break;				}								//*** check if P is in S1, then..				if (!changed && checkState(prop, STATE_O1)) {										//**check if dom(P,C) and C is in O2, move P to S3					for (Iterator iter2 = prop.getDomains(source).iterator(); iter2.hasNext();) {						OWLDescription desc = (OWLDescription) iter2.next();						if (checkState(desc, STATE_O2)) {							if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S3 because DOMAIN(P,C), where C is "+ getName(desc) + " and C has moved");							out.write("Moving ObjectProperty " +getName(prop) + " S1->S3 because DOMAIN(P,C), where C is "+ getName(desc) + " and C has moved <br>");							changed = this.makeStateChange(prop, STATE_L21, this.ObjPropS1, this.ObjPropS3);							break;						}					}										//**check if range(P,C) and C is in O2, move P to S2					if (!changed) {												for (Iterator iter2 = prop.getRanges(source).iterator(); iter2.hasNext();) {							OWLDescription desc = (OWLDescription) iter2.next();							if (checkState(desc, STATE_O2)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S2 because RANGE(P,C), where C is "+ getName(desc) + " and C has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S1->S2 because RANGE(P,C), where C is "+ getName(desc) + " and C has moved <br>");								changed = this.makeStateChange(prop, STATE_L12, this.ObjPropS1, this.ObjPropS2);								break;							}						}					}										//** check if P(a,b) and a in O2, move to S3					if (!changed && this.propToIndividualAssertions.get(prop)!=null) {						for (Iterator iter2 = ((HashSet) this.propToIndividualAssertions.get(prop)).iterator(); iter2.hasNext();) {							OWLIndividual ind = (OWLIndividual) iter2.next();							if (checkState(ind, STATE_O2)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S3 because P(a,b), where a is "+ getName(ind) + " and a has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S1->S3 because P(a,b), where a is "+ getName(ind) + " and a has moved <br>");								changed = this.makeStateChange(prop, STATE_L21, this.ObjPropS1, this.ObjPropS3);								break;							}							//** also check if P(a,b) and b in O2, move to S2							Map oValues = ind.getObjectPropertyValues(source);							for (Iterator iter3=((HashSet) oValues.get(prop)).iterator(); iter3.hasNext();) {								OWLIndividual valueInd = (OWLIndividual) iter3.next();								if (checkState(valueInd, STATE_O2)) {									if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S2 because P(a,b), where b is "+ getName(valueInd) + " and b has moved");									out.write("Moving ObjectProperty " +getName(prop) + " S1->S2 because P(a,b), where b is "+ getName(valueInd) + " and b has moved <br>");									changed = this.makeStateChange(prop, STATE_L12, this.ObjPropS1, this.ObjPropS2);									break;								}							}						}					}									}								//*** check if P is in state S2, then..				if (!changed && checkState(prop, STATE_L12)) {										//** check symmetric/transitive					if (prop.isSymmetric(source) || prop.isTransitive(source)) {						if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S2->S4 because its SYMMETRIC/TRANSITIVE");						out.write("Moving ObjectProperty " +getName(prop) + " S2->S4 because its SYMMETRIC/TRANSITIVE <br>");						changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS2, this.ObjPropS4);						break;					}										//** check if dom(P,C) and C is in O2, move P to S4					if (!changed) {												for (Iterator iter2 = prop.getDomains(source).iterator(); iter2.hasNext();) {							OWLDescription desc = (OWLDescription) iter2.next();							if (checkState(desc, STATE_O2)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S2->S4 because DOMAIN(P,C), where C is "+getName(desc) + " and C has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S2->S4 because DOMAIN(P,C), where C is "+getName(desc) + " and C has moved <br>");								changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS2, this.ObjPropS4);								break;							}						}						}										//** check if P(a,b) and a in O2, move to S4					if (!changed && this.propToIndividualAssertions.get(prop)!=null) {						for (Iterator iter2 = ((HashSet) this.propToIndividualAssertions.get(prop)).iterator(); iter2.hasNext();) {							OWLIndividual ind = (OWLIndividual) iter2.next();							if (checkState(ind, STATE_O2)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S2->S4 because P(a,b), where a is "+getName(ind) + " and a has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S2->S4 because P(a,b), where a is "+getName(ind) + " and a has moved <br>");								changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS2, this.ObjPropS4);								break;							}						}					}									}								// if P is in state S3, then..				if (!changed && checkState(prop, STATE_L21)) {										//** check symmetric/transitive					if (prop.isSymmetric(source) || prop.isTransitive(source)) {						if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S3->S4 because its SYMMETRIC/TRANSITIVE");						out.write("Moving ObjectProperty " +getName(prop) + " S3->S4 because its SYMMETRIC/TRANSITIVE <br>");						changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS3, this.ObjPropS4);						break;					}										//** check if range(P,C) and C is in O2, move P to S4					for (Iterator iter2 = prop.getRanges(source).iterator(); iter2.hasNext();) {							OWLDescription desc = (OWLDescription) iter2.next();							if (checkState(desc, STATE_O2)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S3->S4 because RANGE(P,C), where C is "+getName(desc) + " and C has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S3->S4 because RANGE(P,C), where C is "+getName(desc) + " and C has moved <br>");								changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS3, this.ObjPropS4);								break;							}						}										//** check if P(a,b) and b in O2, move to S4					if (this.propToIndividualAssertions.get(prop)!=null) {						for (Iterator iter2 = ((HashSet) this.propToIndividualAssertions.get(prop)).iterator(); iter2.hasNext();) {							OWLIndividual ind = (OWLIndividual) iter2.next();														Map oValues = ind.getObjectPropertyValues(source);							for (Iterator iter3=((HashSet) oValues.get(prop)).iterator(); iter3.hasNext();) {								OWLIndividual valueInd = (OWLIndividual) iter3.next();								if (checkState(valueInd, STATE_O2)) {									if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S3->S4 because P(a,b), where b is "+getName(valueInd) + " and b has moved");									out.write("Moving ObjectProperty " +getName(prop) + " S3->S4 because P(a,b), where b is "+getName(valueInd) + " and b has moved <br>");									changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS3, this.ObjPropS4);									break;								}							}						}					}				}								//*** check for all restrictions involving P				if (!changed && this.propToDescriptionRestrictions.get(prop)!=null) {					for (Iterator iter2 = ((HashSet) this.propToDescriptionRestrictions.get(prop)).iterator(); iter2.hasNext();) {						OWLObjectRestriction rest = (OWLObjectRestriction) iter2.next();												// if restriction itself is in O2						if (checkState(rest, STATE_O2)) {							// if P is in S1 move P to S3							if (checkState(prop, STATE_O1)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S3 because its IN A RESTRICTION which itself has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S1->S3 because its IN A RESTRICTION which itself has moved <br>");								changed = this.makeStateChange(prop, STATE_L21, this.ObjPropS1, this.ObjPropS3);								break;							}							// if P is in S2 move P to S4							if (checkState(prop, STATE_L12)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S2->S4 because its IN A RESTRICTION which itself has moved");								out.write("Moving ObjectProperty " +getName(prop) + " S2->S4 because its IN A RESTRICTION which itself has moved <br>");								changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS2, this.ObjPropS4);								break;							}						}												// if C in restriction is in O2						if (rest instanceof OWLObjectQuantifiedRestriction) {							OWLDescription desc = ((OWLObjectQuantifiedRestriction) rest).getDescription();							if (checkState(desc, STATE_O2)) {															// if P is in S1 move P to S2								if (checkState(prop, STATE_O1)) {									if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S2 because its IN A (SOME/ALL) RESTRICTION, where C is " +getName(desc)+" and C has moved");									out.write("Moving ObjectProperty " +getName(prop) + " S1->S2 because its IN A (SOME/ALL) RESTRICTION, where C is " +getName(desc)+" and C has moved <br>");									changed = this.makeStateChange(prop, STATE_L12, this.ObjPropS1, this.ObjPropS2);									break;								}								// if P is in S3 move P to S4								if (checkState(prop, STATE_L21)) {									if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S3->S4 because its IN A RESTRICTION, where C is " +getName(desc)+" and C has moved");									out.write("Moving ObjectProperty " +getName(prop) + " S3->S4 because its IN A RESTRICTION, where C is " +getName(desc)+" and C has moved <br>");									changed = this.makeStateChange(prop, STATE_O2, this.ObjPropS3, this.ObjPropS4);									break;								}							}						}					}				}								//*** check for inverses 				if(!changed ){				for (Iterator iter2 = SetUtils.union(reasoner.inversePropertiesOf(prop)).iterator(); iter2.hasNext();) {						OWLObjectProperty invProp = (OWLObjectProperty) iter2.next();												// if P in S1,..						if (checkState(prop, STATE_O1)) {							// if Q in S2, move P to S3							if (checkState(invProp, STATE_L12)) {								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S3 because its INVERSE " +getName(invProp)+" is in S2");								out.write("Moving ObjectProperty " +getName(prop) + " S1->S3 because its INVERSE " +getName(invProp)+" is in S2 <br>");								changed = this.makeStateChange(prop, STATE_L21, this.ObjPropS1, this.ObjPropS3);								break;							}							else						    // if Q in S3, move P to S2						    if (checkState(invProp, STATE_L21)) {						    	if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " S1->S2 because its INVERSE " +getName(invProp)+" is in S3");						    	out.write("Moving ObjectProperty " +getName(prop) + " S1->S2 because its INVERSE " +getName(invProp)+" is in S3 <br>");						    	changed = this.makeStateChange(prop, STATE_L12, this.ObjPropS1, this.ObjPropS2);						    	break;						    }						    else {// inverse is in S4, so move P to S4						    	if (checkState(invProp, STATE_O2)) {							    	if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because its INVERSE " +getName(invProp)+" is in S4");							    	out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because its INVERSE " +getName(invProp)+" is in S4 <br>");							    	changed = this.makeStateChange(prop, STATE_O2, removeFrom, this.ObjPropS4);						    								    	break;							    }						    }						}						if(checkState(prop,STATE_L12)){							//if prop is in L12 and its inverse also, move prop to 4							if(checkState(invProp,STATE_L12)){								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because it is in L_12 and its INVERSE " +getName(invProp)+" also");						    	out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because it is in L_12 and its  INVERSE " +getName(invProp)+" also <br>");						    	changed = this.makeStateChange(prop, STATE_O2, removeFrom, this.ObjPropS4);						    							    	break;						  }														if (checkState(invProp, STATE_O2)) {						    	if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because its INVERSE " +getName(invProp)+" is in S4");						    	out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because its INVERSE " +getName(invProp)+" is in S4 <br>");						    	changed = this.makeStateChange(prop, STATE_O2, removeFrom, this.ObjPropS4);						    							    	break;						    }						    						}						if(checkState(prop,STATE_L21)){							//if prop is in L21 and its inverse also, move prop to 4							if(checkState(invProp,STATE_L21)){								if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because it is in L_21 and its INVERSE " +getName(invProp)+" also");						    	out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because it is in L_21 and its  INVERSE " +getName(invProp)+" also <br>");						    	changed = this.makeStateChange(prop, STATE_O2, removeFrom, this.ObjPropS4);						    							    	break;						  }														if (checkState(invProp, STATE_O2)) {						    	if (DEBUG) System.out.println("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because its INVERSE " +getName(invProp)+" is in S4");						    	out.write("Moving ObjectProperty " +getName(prop) + " "+currentState+"->S4 because its INVERSE " +getName(invProp)+" is in S4 <br>");						    	changed = this.makeStateChange(prop, STATE_O2, removeFrom, this.ObjPropS4);						    							    	break;						    }						    						}																	}				}			} // end object properties check			changed = changed | copyChanged;			timers.stop();		}		while (changed);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?