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; }
private String scopeQuery(IResolutionScope context, IObservableSemantics observable) { String ret = ""; String namespaceId = context.getResolutionNamespace() == null ? DUMMY_NAMESPACE_ID : context.getResolutionNamespace().getId(); if (!namespaceId.equals(DUMMY_NAMESPACE_ID)) { // ret += "(model.isprivate AND model.namespaceid = '" + namespaceId // + "')"; ret += "(model.namespaceid = '" + namespaceId + "')"; } ret += (ret.isEmpty() ? "" : " OR ") + "((NOT model.isprivate) AND (NOT model.inscenario))"; if (context.getScenarios() != null && context.getScenarios().size() > 0) { ret += " OR (" + joinStringConditions("model.namespaceid", context.getScenarios(), "OR") + ")"; } if (NS.isCountable(observable)) { if (context.isForInstantiation() || ((org.integratedmodelling.common.vocabulary.ObservableSemantics) observable) .isInstantiator()) { ret = "(" + ret + ") AND model.isreification"; } else { ret = "(" + ret + ") AND (NOT model.isreification)"; } } return ret; }
IConcept refContext = (NS.isCountable(getObservable()) && !(this instanceof KIMModel && ((KIMModel) this).isInstantiator)) ? getObservable().getType()
if (trg != null && !NS.isCountable(trg)) { context.error("the target context ('for') of a role must be a subject or an event", KIMLanguageObject .lineNumber(rolest || !(NS.isCountable(restricted) || NS.isProcess(restricted))) { context.error("the target scenario ('in') of a role must be a process, subject or event", KIMLanguageObject
if (NS.isCountable(c.getFirst())) { obs.setInstantiator(true);
|| (observable.getType().isAbstract() && NS.isCountable(observable) && context.isForInstantiation()); Map<IConcept, Pair<List<IModel>, ICoverage>> modelCache = new HashMap<>();
refContext = (NS.isCountable(ko) && !isInstantiator) ? ko.getType() : Observables.getContextType(ko.getType()); if (!NS.isCountable(dependency.getObservable())) { context.error("archetypes in learning processes must be subjects or events", dependency .getFirstLineNumber());
if (trg != null && !NS.isCountable(trg)) { context.error("the target context ('for') of a role must be a subject or an event", lineNumber(statement .getTargetObservable())); if (restricted == null || !(NS.isCountable(restricted) || NS.isProcess(restricted))) { context.error("the target scenario ('in') of a role must be a process, subject or event", lineNumber(statement
.get(KIMScope.Type.DEPENDENCY_OBSERVABLE), statement .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 if (!NS.isCountable(observable.getType()) || observable.getType().isAbstract()) { context.error("generic dependencies ('every') are only allowed with non-abstract, countable observables", lineNumber(statement));
if (!NS.isCountable(ret)) { context.error(cid.getId() + " is not a countable concept: you cannot count this", lineNumber(cid));