Skip to content

Commit

Permalink
Handle 'each' properly
Browse files Browse the repository at this point in the history
  • Loading branch information
fvilla committed Dec 26, 2024
1 parent 4884a7e commit 6521cdd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ private boolean matchConcepts(KimConcept candidate, KimConcept pattern,
return false;
}

if (pattern.isCollective() != candidate.isCollective()) {
return false;
}

if (pattern.isNegated() != candidate.isNegated()) {
return false;
}

if (pattern.is(SemanticType.UNION) || pattern.is(SemanticType.INTERSECTION)) {
// pattern should have at most two arguments; we operate on a <tail, rest> basis.
if (pattern.getOperands().size() != 2) {
Expand Down Expand Up @@ -139,14 +147,6 @@ private boolean matchConcepts(KimConcept candidate, KimConcept pattern,
match(tail, reasonerService.declareConcept(pattern.getOperands().get(1)));
}

if (pattern.isCollective() != candidate.isCollective()) {
return false;
}

if (pattern.isNegated() != candidate.isNegated()) {
return false;
}

if (pattern.getSemanticModifier() != null) {

if (pattern.getSemanticModifier() != candidate.getSemanticModifier()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.integratedmodelling.klab.services.reasoner.internal;

import org.integratedmodelling.common.knowledge.ConceptImpl;
import org.integratedmodelling.common.knowledge.ObservableImpl;
import org.integratedmodelling.common.lang.Axiom;
import org.integratedmodelling.common.lang.kim.KimConceptImpl;
Expand Down Expand Up @@ -1117,9 +1118,7 @@ public Concept buildConcept() throws KlabValidationException {
axioms.add(Axiom.AnnotationAssertion(conceptId, NS.DISPLAY_LABEL_PROPERTY, cDs));
axioms.add(Axiom.AnnotationAssertion(conceptId, "rdfs:label", cId));
axioms.add(Axiom.SubClass(main.getNamespace() + ":" + main.getName(), conceptId));
// if (distributedInherency) {
// axioms.add(Axiom.AnnotationAssertion(conceptId, NS.INHERENCY_IS_DISTRIBUTED, "true"));
// }


/*
* add the core observable concept ID using NS.CORE_OBSERVABLE_PROPERTY
Expand All @@ -1140,6 +1139,16 @@ public Concept buildConcept() throws KlabValidationException {
ontology.define(axioms);
ret = ontology.getConcept(conceptId);

if (ret instanceof ConceptImpl concept) {
// ... which it should always be .... We need these to send over via JSON although the info is in metadata
if (type.contains(SemanticType.ABSTRACT)) {
concept.setAbstract(true);
}
if (collective) {
concept.setCollective(true);
}
}

this.axiomsAdded = true;

/*
Expand Down

0 comments on commit 6521cdd

Please # to comment.