Package org.apache.clerezza.rdf.core.impl

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl


     */
    private static void initTestData() {
        UriRef entity1 = new UriRef("http://www.test.org/entity1");
        MGraph entity1Data = new SimpleMGraph();
        entity1Data.add(new TripleImpl(entity1,RDF.type, SKOS.Concept));
        entity1Data.add(new TripleImpl(entity1,SKOS.prefLabel, new PlainLiteralImpl("test", EN)));
        entity1Data.add(new TripleImpl(entity1,SKOS.prefLabel, new PlainLiteralImpl("Test", DE)));
        entityData.put(entity1, entity1Data);
       
        MGraph entity2Data = new SimpleMGraph();
        UriRef entity2 = new UriRef("http://www.test.org/entity2");
        entity2Data.add(new TripleImpl(entity2, RDF.type, SKOS.Concept));
        entity2Data.add(new TripleImpl(entity2,SKOS.prefLabel, new PlainLiteralImpl("sub-test", EN)));
        entity2Data.add(new TripleImpl(entity2,SKOS.prefLabel, new PlainLiteralImpl("Untertest", DE)));
        entity2Data.add(new TripleImpl(entity2,SKOS.broader, entity1));
        entityData.put(entity2, entity2Data);
    }
View Full Code Here


    public Resource createLiteral(String content, Locale language, URI type) {
        logger.debug("creating literal with content \"{}\", language {}, datatype {}",
            new Object[] {content, language, type});
        if (type == null) {
            if(language == null){
                return new PlainLiteralImpl(content);
            } else {
                return new PlainLiteralImpl(content, new Language(language.getLanguage()));
            }
        } else {
            return new TypedLiteralImpl(content, XSD.getXsdUriRef(type));
        }
    }
View Full Code Here

        TripleCollection recipeIndexTripleCollection = tcManager.getMGraph(new UriRef(recipeIndexLocation));
        recipeIndexTripleCollection.add(recipeTriple);

        if (recipeDescription != null && !recipeDescription.isEmpty()) {
            Triple descriptionTriple = new TripleImpl(recipeID, Symbols.description, new PlainLiteralImpl(
                    recipeDescription));
            tripleCollection.add(descriptionTriple);

            recipeIndexTripleCollection.add(descriptionTriple);
        }
View Full Code Here

        String[] parts = stanbolSyntax.split("->");

        String body = parts[0].trim();
        String head = parts[1].trim();

        tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.ruleName, new PlainLiteralImpl(rule
                .getRuleName())));
        if (description != null && !description.isEmpty()) {
            tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.description, new PlainLiteralImpl(
                    description)));
        }
        tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.ruleBody, new PlainLiteralImpl(body)));
        tripleCollection.add(new TripleImpl(rule.getRuleID(), Symbols.ruleHead, new PlainLiteralImpl(head)));

        if (description != null) {
            rule.setDescription(description);
        }
View Full Code Here

    public static void main(String[] args) throws Exception {
        JenaSerializerProvider p = new JenaSerializerProvider();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        MGraph g = new SimpleMGraph();
        g.add(new TripleImpl(new UriRef("urn:test"),new UriRef("http://test.org/test"),new PlainLiteralImpl("test")));
        p.serialize(out, g, SupportedFormat.N_TRIPLE);
        System.out.println(new String(out.toByteArray(),Charset.forName("UTF-8")));
    }
View Full Code Here

            throw new IllegalArgumentException("The ep:ExecutionPlan instance MUST NOT be NULL!");
        }
        NonLiteral node = new BNode();
        graph.add(new TripleImpl(epNode, HAS_EXECUTION_NODE, node));
        graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION_NODE));
        graph.add(new TripleImpl(node,ENGINE,new PlainLiteralImpl(engineName)));
        if(dependsOn != null){
            for(NonLiteral dependend : dependsOn){
                if(dependend != null){
                    graph.add(new TripleImpl(node, DEPENDS_ON, dependend));
                }
View Full Code Here

        if(chainName == null || chainName.isEmpty()){
            throw new IllegalArgumentException("The parsed Chain name MUST NOT be NULL nor empty!");
        }
        NonLiteral node = new BNode();
        graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION_PLAN));
        graph.add(new TripleImpl(node, CHAIN,new PlainLiteralImpl(chainName)));
        return node;
    }
View Full Code Here

            throw new IllegalArgumentException("The parsed graph MUST NOT be NULL!");
        }
        if(chainName == null || chainName.isEmpty()){
            throw new IllegalArgumentException("The parsed chain name MUST NOT be NULL nor empty!");
        }
        Iterator<Triple> it = graph.filter(null, CHAIN, new PlainLiteralImpl(chainName));
        if(it.hasNext()){
            return it.next().getSubject();
        } else {
            return null;
        }
View Full Code Here

    public static void setExecutionCompleted(MGraph graph,NonLiteral execution,String message){
        Literal dateTime = lf.createTypedLiteral(new Date());
        setStatus(graph, execution,STATUS_COMPLETED);
        graph.add(new TripleImpl(execution, COMPLETED, dateTime));
        if(message != null){
            graph.add(new TripleImpl(execution, STATUS_MESSAGE, new PlainLiteralImpl(message)));
        }
    }
View Full Code Here

    public static void setExecutionFaild(MGraph graph,NonLiteral execution,String message){
        Literal dateTime = lf.createTypedLiteral(new Date());
        setStatus(graph, execution,STATUS_FAILED);
        graph.add(new TripleImpl(execution, COMPLETED, dateTime));
        if(message != null){
            graph.add(new TripleImpl(execution, STATUS_MESSAGE, new PlainLiteralImpl(message)));
        } else {
            throw new IllegalArgumentException("For faild Execution a STATUS message is required!");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

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.