Package eu.admire.dispel.parser.v4.builder

Examples of eu.admire.dispel.parser.v4.builder.SequenceStrategy


        String function = "use uk.org.ogsadai.SQLQuery;" +
                "PE( <Connection expression> => <Connection data>) A() {" +
                "SQLQuery sqlq = new SQLQuery;" +
                "return PE( <Connection expression = sqlq.expression; Connection expression = sqlq.expression>" +
                " => <Connection data = sqlq.data> ); }";
        DISPELGraphBuilder builder = runDISPEL(new StringReader(function));
        String dispel = FunctionToDISPEL.convert(builder.getFunctions().get("A"));
    }
View Full Code Here


        mRegistry.registerProcessingElement("b.B");
        String function = "use a.A; use b.B; " +
                "PE<A> f(PE<B> b) {" +
                "A a = new A; b.out => a.in; " +
                "return A( <> => <Connection data = a.data> ); }";
        DISPELGraphBuilder builder = runDISPEL(new StringReader(function));
        String dispel = FunctionToDISPEL.convert(builder.getFunctions().get("f"));
        System.out.println(dispel);
        runDISPEL(new StringReader(dispel));
        TestCase.assertFalse("Function DISPEL cannot be parsed.", mHasError);
    }
View Full Code Here

        reg.name = "fun.f";
        reg.dispel = "package fun { Real f(Integer i, String s) { return 1; } }";
        reg.type = DispelObjectType.FUNCTION;
        mRegistry.register("fun.f", reg);
        String function = "use fun.f; void g() { Real r = f(1, \"s\"); f(2, \"x\"); }";
        DISPELGraphBuilder builder = runDISPEL(new StringReader(function));
        String dispel = FunctionToDISPEL.convert(builder.getFunctions().get("g"));
        System.out.println(dispel);
        runDISPEL(new StringReader(dispel));
        TestCase.assertFalse("Function DISPEL cannot be parsed.", mHasError);
    }
View Full Code Here

    @Test
    public void testCrossValidationFunction() throws Exception
    {
        mRegistry = new InMemoryAdmireRegistry(
                new File("test/unit/eu/admire/dispel/engine/ProcessingElementRegistration.dispel"));
        DISPELGraphBuilder builder = runDISPEL(
                new FileReader("test/unit/eu/admire/dispel/parser/v4/converter/RegisterCrossValidationFunctions.dispel"));
        for (Entry<String, RegisteredObject> reg : builder.getRegistered().entrySet())
        {
            System.out.println("Registering " + reg.getKey());
            DispelObject object = new DispelObject(reg.getKey(), reg.getValue().getObject());
            mRegistry.register(reg.getKey(), object);
        }
        String dispel = FunctionToDISPEL.convert(builder.getFunctions().get("eu.admire.CrossValidationTest"));
        runDISPEL(new StringReader(dispel));
        TestCase.assertFalse("Function DISPEL cannot be parsed.", mHasError);
    }
View Full Code Here

    public void testLTypesExample() throws Exception
    {
        mRegistry.registerProcessingElement("uk.org.ogsadai.SQLQuery");
        mRegistry.registerProcessingElement("uk.org.ogsadai.ListConcatenate");
        mRegistry.registerProcessingElement("eu.admire.madeup.DuplicatePruner");
        DISPELGraphBuilder builder =
            runDISPEL(new FileReader("test/unit/eu/admire/dispel/parser/v4/converter/ltype_example2.dispel"));
        Function function = builder.getFunctions().get("eu.admire.makeCorroboratedSQLQuery");
        System.out.println(FunctionToDISPEL.convert(function));
    }
View Full Code Here

    public DISPELGraphBuilder runDISPEL(Reader reader)
    throws IOException, RecognitionException
    {
        DISPELCompiler compiler = new DISPELCompiler();
        compiler.addErrorListener(this);
        DISPELGraphBuilder builder = new DISPELGraphBuilder(
           mRegistry, new SimpleDispelOptimiser());
        compiler.setRequestBuilder(builder);
        compiler.parse(reader);
        return builder;
    }
View Full Code Here

    {
        DISPELCompiler compiler = new DISPELCompiler();
        InMemoryAdmireRegistry registry = new InMemoryAdmireRegistry();
        registry.registerProcessingElement("eu.admire.Results");
        registry.registerProcessingElement("uk.org.ogsadai.Echo");
        DISPELGraphBuilder builder =
            new DISPELGraphBuilder(registry, new SimpleDispelOptimiser());
        compiler.setRequestBuilder(builder);
        compiler.parse(new FileReader(DISPEL_PATH + "FunctionCreatingPE.dispel"));
        assertTrue(!builder.getSubmittedGraphs().isEmpty());
        Graph graph = builder.getSubmittedGraphs().iterator().next();
        String dot = DotGenerator.generate(graph);
        System.out.println(dot);
//        writeFile(dot);
    }
View Full Code Here

    private void insertComposite(
            RequestContext context, Graph graph, RequestNode node, String impl)
        throws TransformationException
    {
        DISPELGraphBuilder builder =
            new DISPELGraphBuilder(mAdmireRegistry, mDispelOptimiser);
        DISPELCompiler compiler = new DISPELCompiler();
        compiler.setRequestBuilder(builder);
        SimpleErrorListener errorListener = new SimpleErrorListener();
        compiler.addErrorListener(errorListener);
        compiler.parse(impl);
        if (errorListener.haveErrors())
        {
            throw new TransformationException(
                    "Implementation of processing element '" +
                    node.getName() + "' cannot be parsed.");

        }

        RegisteredObject registeredObject = builder.getRegistered().get(node.getName());
       
        if (!(registeredObject.getObject() instanceof ProcessingElementType))
        {
            throw new TransformationException(
                "Cannot handle registered objects of type: " +
View Full Code Here

    }
   
    @Test
    public void testStrict() throws Exception
    {
        DISPELGraphBuilder builder =
            runDISPEL(new StringReader(
                "Type A is PE(<Connection:String input> => <>); " +
                "A a = new A; |- \"xxxx\" -|:String => a.input; submit a; "));
        Graph graph = builder.getSubmittedGraphs().iterator().next();
        TypeValidator validator = new TypeValidator();
        validator.setTypeChecker(new StrictTypeChecker());
        validator.transform(null, graph);
    }
View Full Code Here

    public DISPELGraphBuilder runDISPEL(Reader reader) throws IOException
    {
        DISPELCompiler compiler = new DISPELCompiler();
        compiler.addErrorListener(this);
        DISPELGraphBuilder builder = new DISPELGraphBuilder(
            mRegistry, new SimpleDispelOptimiser());
        compiler.setRequestBuilder(builder);
        compiler.parse(reader);
        return builder;
    }
View Full Code Here

TOP

Related Classes of eu.admire.dispel.parser.v4.builder.SequenceStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.