ret = "observable "; } else if (observer != null) { ret = observer.name().toLowerCase() + " ";
token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.COUNT.name().toLowerCase())) { ret.observer = Observables.Qualities.COUNT; token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.ASSESSMENT.name().toLowerCase())) { ret.observer = Observables.Qualities.ASSESSMENT; token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.DISTANCE.name().toLowerCase())) { ret.observer = Observables.Qualities.DISTANCE; token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.PRESENCE.name().toLowerCase())) { ret.observer = Observables.Qualities.PRESENCE; token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.PROBABILITY.name().toLowerCase())) { ret.observer = Observables.Qualities.PROBABILITY; token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.OCCURRENCE.name().toLowerCase())) { ret.observer = Observables.Qualities.OCCURRENCE; token = tokenizer.nextToken(); } else if (token.getImage() .equals(Observables.Qualities.PROPORTION.name().toLowerCase())) { ret.observer = Observables.Qualities.PROPORTION; admitOther = true;
axioms.add(Axiom .AnnotationAssertion(traitID, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.TYPE .name().toLowerCase() + " " + ((Concept) trait).getAssertedDefinition())); axioms.add(Axiom.AnnotationAssertion(traitID, IMetadata.DC_LABEL, trait
ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.PRESENCE .name() .toLowerCase() + " " + ((Concept) concept).getAssertedDefinition()));
public static IConcept makeValue(IKnowledge concept, IKnowledge comparison) { if (concept.is(KLAB.c(NS.CORE_VALUE))) { return (IConcept) concept; } String cName = "ValueOf" + cleanInternalId(concept.getLocalName()) + (comparison == null ? "" : ("Over" + cleanInternalId(comparison.getLocalName()))); /* * make a ConceptCount if not there, and ensure it's a continuously quantifiable * quality. Must be in same ontology as the original concept. */ IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_VALUE, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.VALUE .name() .toLowerCase() + " " + ((Concept) concept).getAssertedDefinition() + (comparison == null ? "" : ("," + ((Concept) comparison) .getAssertedDefinition())))); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); } return ret; }
public static IConcept makeRatio(IConcept concept, IConcept comparison) { /* * accept only two qualities of the same physical nature (TODO) */ if (!(NS.isQuality(concept) || NS.isTrait(concept)) || !NS.isQuality(comparison)) { return null; } String cName = cleanInternalId(concept.getLocalName()) + "To" + cleanInternalId(comparison.getLocalName()) + "Ratio"; IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_RATIO, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.RATIO .name() .toLowerCase() + " " + ((Concept) concept).getAssertedDefinition() + (comparison == null ? "" : ("," + ((Concept) comparison) .getAssertedDefinition())))); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); } return ret; }
public static IConcept makeCount(IConcept concept) { /* * first, ensure we're counting things and not amounts. */ if (!NS.isCountable(concept)) { return null; } String cName = cleanInternalId(concept.getLocalName()) + "Count"; /* * make a ConceptCount if not there, and ensure it's a continuously quantifiable * quality. Must be in same ontology as the original concept. */ IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_NUMERIC_QUANTITY, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.COUNT .name() .toLowerCase() + " " + ((Concept) concept).getAssertedDefinition())); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); } return ret; }
public static IConcept makeAssessment(IConcept concept) { String cName = cleanInternalId(concept.getLocalName()) + "Assessment"; if (!NS.isQuality(concept)) { return null; } /* * make a ConceptAssessment if not there, and ensure it's a continuously * quantifiable quality. Must be in same ontology as the original concept. */ IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_ASSESSMENT, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.ASSESSMENT .name() .toLowerCase() + " " + ((Concept) concept).getAssertedDefinition())); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); OWL.restrictSome(ret, KLAB.p(NS.OBSERVES_PROPERTY), concept); } return ret; }
public static IConcept makeProportion(IConcept concept, IConcept comparison) { if (!(NS.isQuality(concept) || NS.isTrait(concept)) && !NS.isQuality(comparison)) { return null; } String cName = cleanInternalId(concept.getLocalName()) + "ProportionIn" + cleanInternalId(comparison.getLocalName()); IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_PROPORTION, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.PROPORTION .name().toLowerCase() + " " + ((Concept) concept).getAssertedDefinition() + (comparison == null ? "" : ("," + ((Concept) comparison) .getAssertedDefinition())))); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); } return ret; }
public static IConcept makeDistance(IConcept concept) { if (concept.is(KLAB.c(NS.CORE_DISTANCE))) { return concept; } if (!NS.isObject(concept)) { throw new KlabRuntimeException("cannot compute the distance to a quality"); } String cName = "DistanceTo" + cleanInternalId(concept.getLocalName()); /* * make a ConceptCount if not there, and ensure it's a continuously quantifiable * quality. Must be in same ontology as the original concept. */ IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_DISTANCE, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.DISTANCE .name() .toLowerCase() + " " + ((Concept) concept).getAssertedDefinition())); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); } return ret; }
public static IConcept makeProbability(IConcept concept) { if (!NS.isEvent(concept)) { return null; } String cName = cleanInternalId(concept.getLocalName()) + "Probability"; IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_PROBABILITY, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.PROBABILITY .name().toLowerCase() + " " + ((Concept) concept).getAssertedDefinition())); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); /* * probability is inherent to the event that's possible. */ OWL.restrictSome(ret, KLAB.p(NS.IS_INHERENT_TO_PROPERTY), concept); } return ret; }
public static IConcept makeOccurrence(IConcept concept) { if (!NS.isProcess(concept) && !NS.isThing(concept)) { return null; } String cName = cleanInternalId(concept.getLocalName()) + "Occurrence"; IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_PROBABILITY, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.OCCURRENCE .name().toLowerCase() + " " + ((Concept) concept).getAssertedDefinition())); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); /* * probability is inherent to the event that's possible. */ OWL.restrictSome(ret, KLAB.p(NS.IS_INHERENT_TO_PROPERTY), concept); } return ret; }
public static IConcept makeDistanceTo(INamespace namespace, String whatFrom) { String cName = "DistanceTo" + whatFrom; /* * make a ConceptCount if not there, and ensure it's a continuously quantifiable * quality. Must be in same ontology as the original concept. */ IConcept ret = namespace.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_DISTANCE, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.DISTANCE .name() .toLowerCase() + " " + "#" + whatFrom + "#" + namespace)); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); namespace.getOntology().define(ax); ret = namespace.getOntology().getConcept(cName); } return ret; }
public static IConcept makeUncertainty(IConcept concept) { if (concept.is(KLAB.c(NS.CORE_UNCERTAINTY))) { return null; } String cName = cleanInternalId(concept.getLocalName()) + "Uncertainty"; IConcept ret = concept.getOntology().getConcept(cName); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cName)); ax.add(Axiom.SubClass(NS.CORE_UNCERTAINTY, cName)); ax.add(Axiom .AnnotationAssertion(cName, NS.CONCEPT_DEFINITION_PROPERTY, Qualities.UNCERTAINTY .name().toLowerCase() + " " + ((Concept) concept).getAssertedDefinition())); ax.add(Axiom.AnnotationAssertion(cName, NS.BASE_DECLARATION, "true")); concept.getOntology().define(ax); ret = concept.getOntology().getConcept(cName); } return ret; }