@Override public boolean select(IKnowledge o) { return NS.isProcess(o); } };
/** * true for all objects - i.e., subjects, processes and events. * * @param o * @return true if object */ public static boolean isObject(ISemantic o) { return isThing(o) || isProcess(o) || isEvent(o); }
if (NS.isProcess(obs)) { if (last != null) { ret.add(last);
if (NS.isThing((IConcept) o)) { srets.add(b); } else if (NS.isProcess((IConcept) o)) { prets.add(b); } else if (NS.isTrait((IConcept) o)) {
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; }
private IConcept chooseDirectAccessorType(IKnowledge ob) throws KlabValidationException { if (NS.isQuality(ob)) { return KLAB.c(NS.STATE_CONTEXTUALIZER); } else if (NS.isThing(ob)) { return KLAB.c(NS.SUBJECT_CONTEXTUALIZER); } else if (NS.isProcess(ob)) { return KLAB.c(NS.PROCESS_CONTEXTUALIZER); } else if (NS.isEvent(ob)) { return KLAB.c(NS.EVENT_INSTANTIATOR); } throw new KlabValidationException("subject model has observable that doesn't match any accessor type"); }
private static IConcept getContextType(IKnowledge concept, boolean recurse) { if (!(concept instanceof IConcept)) { return null; } IConcept ret = null; if (recurse && (NS.isAttribute(concept) || NS.isRealm(concept) || NS.isClass(concept) || NS.isConfiguration(concept))) { IConcept described = getDescribedQuality((IConcept) concept); ret = described == null ? null : getContextType(described, false); } else if (recurse && (NS.isIdentity(concept) || NS.isProcess(concept))) { Collection<IConcept> described = getApplicableObservables(concept); ret = described.size() > 0 ? NS.getLeastGeneralCommonConcept(described) : null; } else { Collection<IConcept> cls = OWL .getRestrictedClasses((IConcept) concept, KLAB .p(NS.HAS_CONTEXT_PROPERTY)); ret = cls.isEmpty() ? null : cls.iterator().next(); } if (ret == null && NS.isObservable(concept)) { IConcept inherent = getInherentType(concept); if (inherent != null) { ret = getContextType(inherent, false); } } return ret; }
} else if (NS.isEvent(concept)) { ret = subject.newEvent(new ObservableSemantics(concept), scale, name); } else if (NS.isProcess(concept)) { ret = subject.newProcess(new ObservableSemantics(concept), scale, name); } else {
@Override public boolean match(IConcept o) { if (namespace != null && !o.getConceptSpace().equals(namespace.getId())) { return false; } if (match != null && !o.is(match)) { return false; } if (isAdmitted(SearchType.CONCEPT)) { return true; } boolean isProcess = NS.isProcess(o); if (isProcess && !isAdmitted(SearchType.PROCESS)) { return false; } boolean isTrait = NS.isTrait(o); if (isTrait && !isAdmitted(SearchType.TRAIT)) { return false; } boolean isQuality = NS.isQuality(o); if (isQuality && !isAdmitted(SearchType.QUALITY)) { return false; } return true; }
private IConcept getExpectedDirectContextualizer() { if (observables.size() < 1 || observables.get(0).getType() == null) { return null; } if (NS.isThing(getObservable())) { return isInstantiator ? KLAB.c(NS.SUBJECT_INSTANTIATOR) : KLAB.c(NS.SUBJECT_CONTEXTUALIZER); } else if (NS.isProcess(getObservable())) { return KLAB.c(NS.PROCESS_CONTEXTUALIZER); } else if (NS.isEvent(getObservable())) { return isInstantiator ? KLAB.c(NS.EVENT_INSTANTIATOR) : KLAB.c(NS.EVENT_CONTEXTUALIZER); } else if (isInstantiator && NS.isRelationship(getObservable())) { return KLAB.c(NS.RELATIONSHIP_INSTANTIATOR); } else if (NS.isFunctionalRelationship(getObservable())) { return KLAB.c(NS.FUNCTIONAL_RELATIONSHIP_CONTEXTUALIZER); } else if (NS.isStructuralRelationship(getObservable())) { return KLAB.c(NS.STRUCTURAL_RELATIONSHIP_CONTEXTUALIZER); } return null; }
|| NS.isProcess(restricted))) { context.error("the target scenario ('in') of a role must be a process, subject or event", KIMLanguageObject .lineNumber(rolest
.getActions(), ((ResolutionScope) scope).monitor); } else if (contextualizer instanceof IProcessContextualizer || (!model.getActions().isEmpty() && NS.isProcess(model.getObservable()))) {
if (coreConcept != null && !NS.isProcess(coreConcept)) { context.error("only processes can use the 'affects' clause, to define the qualities they modify in their context", lineNumber(statement)); && !(NS.isProcess(coreConcept) || NS.isEvent(coreConcept))) { context.error("only processes can use the 'confers' clause, to define traits they confer to their context subjects", lineNumber(statement)); || NS.isProcess(restricted))) { context.error("the target scenario ('in') of a role must be a process, subject or event", lineNumber(statement .getRestrictedObservable()));
.getDcontext(), null); if (!((statement.isEach() && NS.isCountable(dctx)) || (statement.isEach() && NS.isProcess(dctx)))) { context.error("distributing dependencies must be on countable observables (subjects or events) if 'each' is given, or on processes if not", lineNumber(statement .getDcontext()));