Package org.apache.clerezza.rdf.core

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


            // check mixin types
            Iterator<Triple> mixins = graph.filter(nodeSubject, CMSAdapterVocabulary.JCR_MIXIN_TYPES, null);
            String mixinType = "";
            while (mixins.hasNext()) {
                Resource r = mixins.next().getObject();
                try {
                    mixinType = RDFBridgeHelper.getShortURIFromResource(r);
                    if (!mixinType.contentEquals("")) {
                        n.addMixin(mixinType);
                    }
View Full Code Here


        createDefaultPropertiesForCMS(n, subject);

        while (it.hasNext()) {
            Triple t = it.next();
            String propURI = t.getPredicate().getUnicodeString();
            Resource resource = t.getObject();

            String propValue = "";
            if (resource instanceof Literal) {
                propValue = RDFBridgeHelper.getResourceStringValue(subject, t.getPredicate(), graph);
            } else if (resource instanceof UriRef) {
                propValue = RDFBridgeHelper.removeEndCharacters(resource.toString());
            } else {
                propValue = resource.toString();
            }

            if (propVals.containsKey(propURI)) {
                PropertyInfo pInfo = propVals.get(propURI);
                pInfo.addPropertyValue(propValue);
View Full Code Here

                        String shortPredicate = NamespaceEnum.getShortName(predicate);
                        if (shortPredicate.equals(predicate)) {
                            log.warn("Failed to obtain short name for URI: {}", predicate);
                            continue;
                        }
                        Resource resource = t.getObject();

                        String propValue = "";
                        if (resource instanceof Literal) {
                            propValue = RDFBridgeHelper.getResourceStringValue(resource);
                        } else if (resource instanceof UriRef) {
                            propValue = ((UriRef) resource).getUnicodeString();
                        } else {
                            propValue = resource.toString();
                        }

                        if (constraints.containsKey(shortPredicate)) {
                            constraints.get(shortPredicate).add(propValue);
                        } else {
View Full Code Here

                        "an empty String as engine name (property "+ENGINE+")!");
            }
            engineNames.add(engine);
            Collection<NonLiteral> dependsOn = new HashSet<NonLiteral>();
            for(Iterator<Triple> t = executionPlan.filter(node, DEPENDS_ON, null);t.hasNext();){
                Resource o = t.next().getObject();
                if(o instanceof NonLiteral){
                    dependsOn.add((NonLiteral)o);
                } else {
                    throw new ChainException("Execution Node "+node+" defines the literal '" +
                        o+"' as value for the "+DEPENDS_ON +" property. However this" +
View Full Code Here

        }
        Set<NonLiteral> executionNodes = new HashSet<NonLiteral>();
        Iterator<Triple> it = ep.filter(executionPlanNode, HAS_EXECUTION_NODE, null);
        while(it.hasNext()){
            Triple t = it.next();
            Resource node = t.getObject();
            if(node instanceof NonLiteral){
                executionNodes.add((NonLiteral)node);
            } else {
                throw new IllegalStateException("The value of the "+HAS_EXECUTION_NODE
                    + " property MUST BE a NonLiteral (triple: "+t+")!");
View Full Code Here

        LiteralFactory lf = LiteralFactory.getInstance();
        TypedLiteral oiri = lf.createTypedLiteral(new UriRef(ontologyIri.toString()));
        TypedLiteral viri = versionIri == null ? null : lf.createTypedLiteral(new UriRef(versionIri
                .toString()));
        for (Iterator<Triple> it = graph.filter(null, HAS_ONTOLOGY_IRI_URIREF, oiri); it.hasNext();) {
            Resource subj = it.next().getSubject();
            log.debug(" -- Ontology IRI match found. Scanning");
            log.debug(" -- Resource : {}", subj);
            if (!(subj instanceof UriRef)) {
                log.debug(" ---- (uncomparable: skipping...)");
                continue;
View Full Code Here

                     * Anonymous implementation of an Adapter that converts the filtered Triples of the
                     * resulting graph to RdfRepresentations
                     */
                    @Override
                    public RdfRepresentation adapt(Triple value, Class<RdfRepresentation> type) {
                        Resource object = value.getObject();
                        if (object == null) {
                            return null;
                        } else if (object instanceof UriRef) {
                            return valueFavtory.createRdfRepresentation((UriRef) object, resultGraph);
                        } else {
                            log.warn("Unable to create representation for FieldQueryResult " + object
                                     + " because this Resource is not of Type UriRef (type: "
                                     + object.getClass() + ") -> result gets ignored");
                            return null;
                        }
                    }
                }, RdfRepresentation.class);
        return resultIterator;
View Full Code Here

     */
    public static NonLiteral getExecutionNode(TripleCollection graph, NonLiteral execution){
        Iterator<Triple> it = graph.filter(execution, EXECUTION_NODE, null);
        if(it.hasNext()){
            Triple t = it.next();
            Resource o = t.getObject();
            if(o instanceof NonLiteral){
                return (NonLiteral)o;
            } else {
                throw new IllegalStateException("Value of property "+ EXECUTION_NODE
                    + "MUST BE of type NonLiteral (triple: '"+t+"')!");
View Full Code Here

     */
    public static NonLiteral getExecutionPlanNode(TripleCollection em, NonLiteral chainExecutionNode){
        Iterator<Triple> it = em.filter(chainExecutionNode, EXECUTION_PLAN, null);
        if(it.hasNext()){
            Triple t = it.next();
            Resource r = t.getObject();
            if(r instanceof NonLiteral){
                return (NonLiteral)r;
            } else {
                throw new IllegalStateException("Value of the property "+EXECUTION_PLAN
                    + " MUST BE a NonLiteral (triple: '"+t+"')!");
View Full Code Here

     * @param graph
     * @return lexical value of specified resource it exists and an instance of {@link Literal}, otherwise it
     *         returns empty string
     */
    public static String getResourceStringValue(NonLiteral subject, UriRef predicate, MGraph graph) {
        Resource r = getResource(subject, predicate, graph);
        return getResourceStringValue(r);
    }
View Full Code Here

TOP

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

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.