Package org.apache.clerezza.rdf.core

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


        try { // check to see if the user already has this permission
            while (existingPermissions.hasNext()) {
                NonLiteral permissionNode = (NonLiteral) existingPermissions.next().getObject();
                Iterator<Triple> permissionTriples = systemGraph.filter(permissionNode, PERMISSION.javaPermissionEntry, null);
                while (permissionTriples.hasNext()) {
                    Literal permission = (Literal) permissionTriples.next().getObject();
                    if (permissionString.equals(permission.getLexicalForm())) {
                        has = true;
                    }
                }

            }
View Full Code Here


  public static UriRef createEntityAnnotation(CandidateResource resource,
      EnhancementEngine engine, ContentItem ci, UriRef textAnnotation) {
    UriRef entityAnnotation = EnhancementEngineHelper
        .createEntityEnhancement(ci, engine);
    MGraph model = ci.getMetadata();
    Literal label = new PlainLiteralImpl(resource.label,
        new Language("en"));
    model.add(new TripleImpl(entityAnnotation, DC_RELATION,
        textAnnotation));
    model.add(new TripleImpl(entityAnnotation,
        ENHANCER_ENTITY_LABEL, label));
View Full Code Here

      EnhancementEngine engine, ContentItem ci,
      UriRef textAnnotation, Language language) {
    MGraph model = ci.getMetadata();
    UriRef entityAnnotation = EnhancementEngineHelper
        .createEntityEnhancement(ci, engine);
    Literal label = new PlainLiteralImpl(annotation.surfaceForm.name,
        language);
    model.add(new TripleImpl(entityAnnotation, DC_RELATION,
        textAnnotation));
    model.add(new TripleImpl(entityAnnotation,
        ENHANCER_ENTITY_LABEL, label));
View Full Code Here

                Iterator<Triple> it = graph.filter(alias, MAPS_TO_GRAPH_URIREF, null);
                while (it.hasNext()) {
                    Resource obj = it.next().getObject();
                    if (obj instanceof UriRef) return (UriRef) obj;
                }
                Literal litloc = LiteralFactory.getInstance().createTypedLiteral(
                    new UriRef(alias.getUnicodeString()));
                // Logical mappings failed, try physical mappings.
                it = graph.filter(null, RETRIEVED_FROM_URIREF, litloc);
                while (it.hasNext()) {
                    Resource obj = it.next().getSubject();
View Full Code Here

            Iterator<Triple> it = graph.filter(null, MAPS_TO_GRAPH_URIREF, graphName);
            while (it.hasNext()) {
                Resource obj = it.next().getSubject();
                if (obj instanceof UriRef) return buildPublicKey((UriRef) obj);
            }
            Literal litloc = LiteralFactory.getInstance().createTypedLiteral(
                new UriRef(graphName.getUnicodeString()));
            // Logical mappings failed, try physical mappings.
            it = graph.filter(null, RETRIEVED_FROM_URIREF, litloc);
            while (it.hasNext()) {
                Resource subj = it.next().getSubject();
View Full Code Here

                // isOntology |= RDF.type.equals(t.getPredicate()) && OWL.Ontology.equals(t.getObject());
                if (RETRIEVED_FROM_URIREF.equals(t.getPredicate())) remove.add(t);
            }
            graph.removeAll(remove);
            if (locator != null) {
                Literal litloc = LiteralFactory.getInstance().createTypedLiteral(
                    new UriRef(locator.toString()));
                graph.add(new TripleImpl(graphName, RETRIEVED_FROM_URIREF, litloc));
            }
        }
View Full Code Here

        MGraph metadata = ci.getMetadata();
        for(LinkedEntity linkedEntity : linkedEntities){
            Collection<UriRef> textAnnotations = new ArrayList<UriRef>(linkedEntity.getOccurrences().size());
            //first create the TextAnnotations for the Occurrences
            for(Occurrence occurrence : linkedEntity.getOccurrences()){
                Literal startLiteral = literalFactory.createTypedLiteral(occurrence.getStart());
                Literal endLiteral = literalFactory.createTypedLiteral(occurrence.getEnd());
                //search for existing text annotation
                Iterator<Triple> it = metadata.filter(null, ENHANCER_START, startLiteral);
                UriRef textAnnotation = null;
                while(it.hasNext()){
                    Triple t = it.next();
View Full Code Here

            }
        }
    }

    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

                    initialMentions.add(entity.getUri());
                } //else TODO support also Entities!!
            }
            //create the TextAnnotations for the co-mention
            for(Occurrence occurrence : comention.getOccurrences()){
                Literal startLiteral = literalFactory.createTypedLiteral(occurrence.getStart());
                Literal endLiteral = literalFactory.createTypedLiteral(occurrence.getEnd());
                //search for existing text annotation
                boolean ignore = false;
                //search for textAnnotations with the same end
                UriRef textAnnotation = null;
                Iterator<Triple> it = metadata.filter(null, ENHANCER_START, startLiteral);
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.