public boolean isOut(Instance instance) { if (instance.getIdentifier() instanceof UnnumberedAnonymousID) return false; for (Out mode : signature.listOutModes()) { if (reasoner.isMemberOf((IRI) state.getIdentifier(), instance, mode.getConcept())) return true; } return false; }
/* (non-Javadoc) * @see ie.deri.wsmx.asm.State#add(org.omwg.ontology.Instance) */ public Grounding add(Instance instance) throws SynchronisationException, InvalidModelException, UpdateIllegalException { // FIXME check if instance is of correct mode and throw UpdateIllegal if not state.addInstance(instance); try { reasoner.deRegisterOntology((IRI) (state.getIdentifier())); } catch (Throwable t) { // silent // TODO log warn } try { reasoner.registerOntology(state); } catch (InconsistencyException e1) { logger.warn("Ontology registration failed:" + e1.getMessage(), e1); } for (In mode : signature.listInModes()) { if (reasoner.isMemberOf((IRI) state.getIdentifier(), instance, mode.getConcept())) try { return mode.getGrounding().iterator().next(); } catch (NotGroundedException e) { // FIXME return null; } } for (Out mode : signature.listOutModes()) { if (reasoner.isMemberOf((IRI) state.getIdentifier(), instance, mode.getConcept())) try { return mode.getGrounding().iterator().next(); } catch (NotGroundedException e) { return null; } } throw new UpdateIllegalException(); }
public boolean isOutConcept(Concept concept) { for (Out mode : signature.listOutModes()) { if (concept.equals(mode.getConcept())) return true; } return false; }