コード例 #1
0
 /* (non-Javadoc)
  * @see ie.deri.wsmx.asm.State#add(org.omwg.logicalexpression.MembershipMolecule)
  */
 public void add(MembershipMolecule fact) {
   logger.info("Adding membership molecule " + fact);
   // TODO write this more elegant once factory convenience creators are fixed
   Set<MembershipMolecule> mms = new HashSet<MembershipMolecule>();
   mms.add(fact);
   facts.add(cFactory.facts.createMoleculeFact(mms, new HashSet<AttributeValueMolecule>()));
   Axiom axiom =
       factory.createAxiom(
           factory.createIRI(
               "http://www.wsmx.org/choreography/state/membership" + membershipCounter++));
   axiom.addDefinition(fact);
   try {
     logger.debug("Adding MM axiom: " + fact);
     state.addAxiom(axiom);
   } catch (SynchronisationException e) {
     logger.warn("Failed to add membership molecule to state.", e);
   } catch (InvalidModelException e) {
     logger.warn("Failed to add membership molecule to state.", e);
   }
   for (StateModificationListener listener : listeners) {
     listener.addedMembership(this, fact);
   }
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see ie.deri.wsmx.asm.State#add(org.omwg.logicalexpression.AttributeValueMolecule)
  */
 public void add(AttributeValueMolecule fact) {
   facts.add(
       cFactory.facts.createMoleculeFact(
           new HashSet<MembershipMolecule>(),
           new HashSet<AttributeValueMolecule>(
               Arrays.asList(new AttributeValueMolecule[] {fact}))));
   Axiom axiom =
       factory.createAxiom(
           factory.createIRI(
               "http://www.wsmx.org/choreography/state/attribute" + attributeCounter++));
   axiom.addDefinition(fact);
   try {
     logger.debug("Adding AVM axiom: " + fact);
     axioms.put(fact, axiom);
     state.addAxiom(axiom);
   } catch (SynchronisationException e) {
     logger.warn("Failed to add attribute value to state.", e);
   } catch (InvalidModelException e) {
     logger.warn("Failed to add attribute value to state.", e);
   }
   for (StateModificationListener listener : listeners) {
     listener.addedAttribute(this, fact);
   }
 }