Search in sources :

Example 1 with FunctionBody

use of org.whole.lang.semantics.model.FunctionBody in project whole by wholeplatform.

the class SemanticsDynamicCompilerVisitor method visit.

@Override
public void visit(SemanticFunction entity) {
    FunctionBody rules = entity.getRules();
    if (Matcher.match(SemanticsEntityDescriptorEnum.InferenceRules, rules)) {
        // TODO not supported yet
        setResultIterator(IteratorFactory.emptyIterator().withSourceEntity(entity));
        return;
    }
    IEntityIterator<?> ac = new ActionCallIterator("whole:org.whole.lang.semantics:SemanticsActions:1.0.0#Translate Normalized Function to Query", null);
    stagedVisit(ac.evaluate(entity, getBindings()));
    IEntityIterator<?> functionBehavior = getResultIterator();
    FunctionLibraryRegistry.instance().putFunctionCode(getLibraryUri(entity) + "#" + entity.getName().getValue(), functionBehavior);
}
Also used : ActionCallIterator(org.whole.lang.actions.iterators.ActionCallIterator) FunctionBody(org.whole.lang.semantics.model.FunctionBody)

Example 2 with FunctionBody

use of org.whole.lang.semantics.model.FunctionBody in project whole by wholeplatform.

the class SemanticsInterpreterVisitor method visit.

@Override
public void visit(SemanticFunction entity) {
    FunctionBody rules = entity.getRules();
    if (Matcher.match(SemanticsEntityDescriptorEnum.InferenceRules, rules))
        return;
    FunctionLibraryRegistry.instance().putFunctionModel(getLibraryUri(entity) + "#" + entity.getName().getValue(), entity);
    IBindingManager bm = getBindings();
    if (!bm.wIsSet("LazyInterpretation") || !bm.wBooleanValue("LazyInterpretation"))
        DynamicCompilerOperation.compile(entity, getBindings());
}
Also used : FunctionBody(org.whole.lang.semantics.model.FunctionBody) IBindingManager(org.whole.lang.bindings.IBindingManager)

Aggregations

FunctionBody (org.whole.lang.semantics.model.FunctionBody)2 ActionCallIterator (org.whole.lang.actions.iterators.ActionCallIterator)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1