Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.Literal


            }
        }
    }

    private void addTypedLiteral(UriRef field, Object literalValue){
        Literal literal;
        try {
            literal = RdfResourceUtils.createLiteral(literalValue);
        } catch (NoConvertorException e){
            log.info("No Converter for value type "+literalValue.getClass()
                    +" (parsed for field "+field+") use toString() to get String representation");
View Full Code Here


            log.warn("NULL parsed as value in remove method for symbol "+getId()+" and field "+field+" -> call ignored");
        }
        graphNode.deleteProperty(new UriRef(field), new UriRef(reference));
    }
    protected void removeTypedLiteral(UriRef field, Object object){
        Literal literal;
        try{
            literal = RdfResourceUtils.createLiteral(object);
        } catch (NoConvertorException e){
            log.info("No Converter for value type "+object.getClass()
                    +" (parsed for field "+field+") use toString() Method to get String representation");
View Full Code Here

     * @return The collection with the literal values
     */
    public static Collection<String> getLiteralValues(Iterator<Literal> literals){
        Collection<String> results = new ArrayList<String>();
        while(literals.hasNext()){
            Literal act = literals.next();
            results.add(act.getLexicalForm());
        }
        return results;
    }
View Full Code Here

            languageSet.add(getLanguage(lang));
        }
        boolean containsNull = languageSet.contains(null);
        List<String> results = new ArrayList<String>();
        while (literals.hasNext()) {
            Literal act = literals.next();
            if (act instanceof PlainLiteral) {
                PlainLiteral pl = (PlainLiteral) act;
                if (languageSet.contains(pl.getLanguage())) {
                    results.add(0, pl.getLexicalForm()); //add to front
                }
            } else if (containsNull) { //add also all types Literals, because the do not define an language!
                results.add(act.getLexicalForm()); //append to the end
            }
        }
        return results;
    }
View Full Code Here

       
        System.out.println("BEFORE ========================================================");
        serializer.serialize(System.out, userNode.getGraph(), SupportedFormat.TURTLE);
           
        Iterator<Literal> oldPasswordsSha1 = userNode.getLiterals(PERMISSION.passwordSha1);
        Literal oldPasswordSha1 = oldPasswordsSha1.next();
        // no exception, if there is no value, let it break totally, if more than one - it is broken elsewhere
       
        userNode.addPropertyValue(PERMISSION.passwordSha1, passwordSha1);
        // workaround for possible issue in verification re. PlainLiteral vs. xsd:string
        // userNode.addProperty(PERMISSION.passwordSha1, new PlainLiteralImpl(passwordSha1));
View Full Code Here

        if(selectedTextIterator.hasNext()){
            // test if the selected text is part of the TEXT_TO_TEST
            selectedTextResource = selectedTextIterator.next().getObject();
            assertTrue("fise:selected-text MUST BE of type PlainLiteral (uri: "+textAnnotation+")",
                selectedTextResource instanceof PlainLiteral);
            Literal selectedText = (Literal)selectedTextResource;
            assertTrue("The parsed content MUST contain the fise:selected-text value '"
                +selectedText.getLexicalForm()+"' (uri: "+textAnnotation+")!",content.contains(selectedText.getLexicalForm()));
        } else {
            selectedTextResource = null; //no selected text
        }
        //check against an expected value
        Resource expectedSelectedText = expectedValues.get(ENHANCER_SELECTED_TEXT);
View Full Code Here

     * @return a collection of all existing/created text annotations for the parsed anchor
     */
    private Collection<NonLiteral> processTextAnnotation(MGraph enhancements, String text, UriRef ciId, String anchor, Double confidence) {
        Collection<NonLiteral> textAnnotations = new ArrayList<NonLiteral>();
        int anchorLength = anchor.length();
        Literal anchorLiteral = new PlainLiteralImpl(anchor);
        //first search for existing TextAnnotations for the anchor
        Map<Integer, Collection<NonLiteral>> existingTextAnnotationsMap = searchExistingTextAnnotations(enhancements, anchorLiteral);

        for (int current = text.indexOf(anchor); current >= 0; current = text.indexOf(anchor, current + 1)) {
            Collection<NonLiteral> existingTextAnnotations = existingTextAnnotationsMap.get(current);
View Full Code Here

                    //override the matched label
                    label = actLabel;
                }
            }
        } //else the matched label will be the best to use
        Literal literal;
        if (label.getLanguage() == null) {
            literal = new PlainLiteralImpl(label.getText());
        } else {
            literal = new PlainLiteralImpl(label.getText(), new Language(label.getLanguage()));
        }
View Full Code Here

     * @param graph
     * @param execution
     * @param message An optional message
     */
    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

     * @param graph
     * @param execution
     * @param message An message describing why the execution failed
     */
    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 {
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.Literal

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.