IConcept inherent = Observables.getInherentType(observable); IConcept cinh = getInherentType(context); if (cinh != null && inherent.is(cinh)) { return ret;
@Override public IConcept getEventType() { return Observables.getInherentType(getObservable().getType()); }
@Override public List<IObservableSemantics> getAlternativeObservables() { IConcept c = Observables.getInherentType(getObservable().getType()); if (c != null && NS.isObservable(c)) { return Collections.singletonList(new ObservableSemantics(c)); } return null; }
/** * Analyze an observable concept and return the main observable with all the original * identities and realms but no attributes; separately, return the list of the * attributes that were removed. * * @param observable * @return attribute profile * @throws KlabValidationException */ public static Pair<IConcept, Collection<IConcept>> separateAttributes(IKnowledge observable) throws KlabValidationException { IKnowledge obs = getBaseObservable(observable); ArrayList<IConcept> tret = new ArrayList<>(); ArrayList<IConcept> keep = new ArrayList<>(); for (IConcept zt : getTraits(observable)) { if (zt.is(KLAB.c(NS.CORE_IDENTITY_TRAIT)) || zt.is(KLAB.c(NS.CORE_REALM_TRAIT))) { keep.add(zt); } else { tret.add(zt); } } return new Pair<>(Observables.declareObservable((IConcept) (obs == null ? observable : obs), keep, Observables.getContextType(observable), Observables .getInherentType(observable)), tret); }
/** * Return the passed knowledge after removing any traits of the passed base type, or * the original knowledge if the trait was absent. * * @param knowledge * @return knowledge without the trait * @throws KlabValidationException */ public static IKnowledge removeTrait(IConcept knowledge, IConcept baseTrait) throws KlabValidationException { Pair<IConcept, Collection<IConcept>> trs = separateAttributes(knowledge); ArrayList<IConcept> traits = new ArrayList<>(); boolean found = false; for (IConcept tr : trs.getSecond()) { if (tr.is(baseTrait)) { found = true; } else { traits.add(tr); } } return found ? Observables.declareObservable(trs.getFirst(), traits, Observables .getContextType(knowledge), Observables .getInherentType(knowledge)) : knowledge; }
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; }
IConcept other = Observables.getInherentType(concept); if (other != null && !inherent.is(other)) { throw new KlabValidationException("cannot add inherent type " + inherent + " to concept "
IConcept other = getInherentType(main); if (other != null && !isCompatible(inherent, other)) { throw new KlabValidationException("cannot add inherent type " + inherent
IConcept ic1 = getInherentType(o1); IConcept ic2 = getInherentType(o2);
.getContextType(model.getObservable().getType()); IConcept inherent = Observables .getInherentType(model.getObservable().getType()); IConcept tinherent = Observables.getInherentType(tr);
private void observeConcept(IConcept concept, IMonitor monitor) throws KlabException { IConcept inherent = Observables.getInherentType(concept); boolean distributed = false;
.getInherentType(getObservable().getType());
IConcept inherent = Observables.getInherentType(k);