Package com.ontology2.centipede.shell

Examples of com.ontology2.centipede.shell.ResourceAwareObject


    Map<String, Object> local;
   
    private void runStep(MavenManagedJar jar, List<String> flowArgs, FlowStep that) throws Exception {
        if(that instanceof JobStep) {
            JobStep jobStep=(JobStep) that;
            this.runJob(jar, jobStep.getStepArgs(local,flowArgs));
        } else if(that instanceof AssignmentStep) {
            AssignmentStep ass=(AssignmentStep) that;
            local=ass.process(local, flowArgs);
        } else {
            throw new RuntimeException("Could not process step of type "+that.getClass());
View Full Code Here


            local=that.process(local, flowArgs);
        }

        {
            Assert.assertTrue(steps.get(j) instanceof SpringStep);
            SpringStep step0=(SpringStep) steps.get(j++);
            List<String> args=step0.getStepArgs(local,flowArgs);

            assertEquals(4,args.size());

            int i=0;
            assertEquals("run",args.get(i++));
            assertEquals("freebaseRDFPrefilter",args.get(i++));
            assertEquals("s3n://freebase-dumps/freebase-rdf-1942-12-07-00-00/",args.get(i++));
            assertEquals("/preprocessed/1942-12-07-00-00/",args.get(i++));
        }

        {
            Assert.assertTrue(steps.get(j) instanceof SpringStep);
            SpringStep step1=(SpringStep) steps.get(j++);
            List<String> args=step1.getStepArgs(local,flowArgs);

            assertEquals(6,args.size());

            int i=0;
            assertEquals("run",args.get(i++));
            assertEquals("pse3",args.get(i++));
            assertEquals("-r",args.get(i++));
            assertEquals("210",args.get(i++));
            assertEquals("/preprocessed/1942-12-07-00-00/",args.get(i++));
            assertEquals("s3n://basekb-now/1942-12-07-00-00/",args.get(i++));
        }

        {
            Assert.assertTrue(steps.get(j) instanceof SpringStep);
            SpringStep step2=(SpringStep) steps.get(j++);
            List<String> args=step2.getStepArgs(local,flowArgs);

            assertEquals(4,args.size());

            int i=0;
            assertEquals("run",args.get(i++));
View Full Code Here

            return out;
        }

        Map<String,String> that=awsInstanceMap.get(instanceType).getHadoopParameters();
        for(Map.Entry<String,String> item:that.entrySet())
            out.put(new HadoopConfigurationVariable(item.getKey()),item.getValue());

        return out;
    }
View Full Code Here

        return parts;
    }

    static List<String> splitTriple(String obj) throws InvalidNodeException {
        if (!obj.endsWith(".")) {
            throw new InvalidNodeException();
        }

        obj=obj.substring(0,obj.length()-1);
        List<String> parts=Lists.newArrayList(lineSplitter.split(obj));
        if (parts.size()!=3) {
            throw new InvalidNodeException();
        }
        return parts;
    }
View Full Code Here

        if (prefixMap.containsKey(parts.get(0))) {
            return "<"+prefixMap.get(parts.get(0))+parts.get(1)+">";
        }
       
     
        throw new InvalidNodeException();
    }
View Full Code Here

    };
   
    public static List<String> splitPrefixDeclaration(String obj) throws InvalidPrefixException {
        List<String> parts=Lists.newArrayList(Splitter.on(" ").split(obj));
        if (parts.size()!=3) {
            throw new InvalidPrefixException();
        }

        String prefix=parts.get(1);
        String mapsTo=parts.get(2)

        if (!prefix.endsWith(":")) {
            throw new InvalidPrefixException();
        }

        parts.set(1, prefix.substring(0, prefix.length()-1));

        if (!mapsTo.startsWith("<") || !mapsTo.endsWith(">.")) {
            throw new InvalidPrefixException();
        }

        parts.set(2, mapsTo.substring(1, mapsTo.length()-2));

        return parts;
View Full Code Here

        Triple t1=new Triple(s1a,p1a,o1a);
        Triple t2=new Triple(s1b,p1b,o1b);
        assertTrue(t1!=t2);
        assertEquals(t1,t2);

        Economizer<Triple> e=new TripleEconomizer();

        Triple t3=e.economize(t1);
        Triple t4=e.economize(t2);

        assertTrue(t3.getSubject()==t4.getSubject());
        assertTrue(t3.getObject()==t4.getObject());
        assertTrue(t3.getPredicate()==t4.getPredicate());
View Full Code Here

                    }
                });
    }

    public static Node ParseNode(String lexicalForm) throws ParseException {
        NodeParser parser=new NodeParser(new StringReader(lexicalForm));
        parser.parse();
        return parser.getNodeValue();
    };
View Full Code Here

TOP

Related Classes of com.ontology2.centipede.shell.ResourceAwareObject

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.