Esempio n. 1
0
 def addSentencesTrueByRules(cls, sentencesByForm, model):
     """ generated source for method addSentencesTrueByRules """
     prover = AimaProver(model.getDescription())
     for form in model.getConstantSentenceForms():
         for result in prover.askAll(query, ImmutableSet.of()):
             ConcurrencyUtils.checkForInterruption()
             # Variables may end up being replaced with functions, which is not
             # what we want here, so we have to double-check that the form is correct.
             if form.matches(result):
                 sentencesByForm.put(form, result)
Esempio n. 2
0
 def applyAmbiguities(cls, originalRule, ambiguitiesByOriginalForm, model):
     """ generated source for method applyAmbiguities """
     rules = Lists.newArrayList(originalRule)
     # Each literal can potentially multiply the number of rules we have, so
     # we apply each literal separately to the entire list of rules so far.
     for literal in Iterables.concat(ImmutableSet.of(originalRule.getHead()), originalRule.getBody()):
         for rule in rules:
             Preconditions.checkArgument(originalRule.arity() == rule.arity())
             newRules.addAll(applyAmbiguitiesForLiteral(literal, rule, ambiguitiesByOriginalForm, model))
         rules = newRules
     return rules
Esempio n. 3
0
 def load(self):
     """ Creates and configures the context. """
     if not self.__context:     # Avoid loading the same context twice
         props = self._load_config()
         log.debug("Connecting to %s as %s" %
                 (props.getProperty("abiquo.endpoint"),
                     self.__config.user))
         self.__context = AbiquoContextFactory().createContext(
                 self.__config.user, self.__config.password,
                 ImmutableSet.of(NullLoggingModule()), props)
         # Close context automatically when exiting
         atexit.register(self.__del__)
         return self.__context
Esempio n. 4
0
 def create(cls, form):
     """ generated source for method create """
     return cls.create(form, ImmutableSet.of())
Esempio n. 5
0
 def createStrataDependencyGraph(cls, dependencyGraph):
     """ generated source for method createStrataDependencyGraph """
     strataDependencyGraph = HashMultimap.create()
     for entry in dependencyGraph.entries():
         strataDependencyGraph.put(ImmutableSet.of(entry.getKey()), ImmutableSet.of(entry.getValue()))
     return strataDependencyGraph
Esempio n. 6
0
 def createAllStrata(cls, allElements):
     """ generated source for method createAllStrata """
     result = Sets.newHashSet()
     for element in allElements:
         result.add(ImmutableSet.of(element))
     return result