Package org.apache.clerezza.rdf.core

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


            // handle old value (if it exists)
            Iterator<Triple> iterator = inputGraph.filter(changeNode,
                    Ontology.oldValue, null);

            Resource oldValue = null;

            if (iterator.hasNext()) {

                oldValue = iterator.next().getObject();
                // Triple oldTriple = systemGraph.filter(null, predicateUriRef,
                // oldValue).next();
                Iterator<Triple> oldTriples = systemGraph.filter(userNode,
                        predicateUriRef, oldValue);
                if (oldTriples.hasNext()) {
                    oldTriple = oldTriples.next();
                }
            }

            Resource newValue = inputGraph
                    .filter(changeNode, Ontology.newValue, null).next()
                    .getObject();

            newTriple = new TripleImpl(userNode, predicateUriRef,
                    newValue);
View Full Code Here


     * Deletes a named user
     *
     * @param userName
     */
    private void remove(String userName) {
        Resource userResource = getNamedUser(userName).getNode();
        Iterator<Triple> userTriples = systemGraph.filter((NonLiteral) userResource, null, null);

        ArrayList<Triple> buffer = new ArrayList<Triple>();

        Lock readLock = systemGraph.getLock().readLock();
View Full Code Here

     * Deletes a named user
     *
     * @param userName
     */
    private void deleteRole(String roleName) {
        Resource roleResource = getNamedRole(roleName).getNode();
        Iterator<Triple> roleTriples = systemGraph.filter((NonLiteral) roleResource, null, null);

        ArrayList<Triple> buffer = new ArrayList<Triple>();

        Lock readLock = systemGraph.getLock().readLock();
View Full Code Here

        Lock readLock = systemGraph.getLock().readLock();
        readLock.lock();
        try {
            while (permissionTriples.hasNext()) {
                Triple triple = permissionTriples.next();
                Resource permissionResource = triple.getObject();
                buffer.add(new GraphNode(permissionResource, systemGraph));
            }
        } finally {
            readLock.unlock();
        }
View Full Code Here

     * must be a neater way of doing this...
     */
    private GraphNode getTitleNode(String title) {
        Iterator<Triple> triples = systemGraph.filter(null, DC.title, new PlainLiteralImpl(title));
        if (triples.hasNext()) {
            Resource resource = triples.next().getSubject();
            return new GraphNode(resource, systemGraph);
        }
        return null;
    }
View Full Code Here

        Iterator<Triple> oldTriples = systemGraph.filter(
                (NonLiteral) userNode.getNode(), predicate, null);

        ArrayList<Triple> oldBuffer = new ArrayList<Triple>();

        Resource oldObject = null;

        Lock readLock = systemGraph.getLock().readLock();
        readLock.lock();
        try {
            while (oldTriples.hasNext()) {
View Full Code Here

        readLock.lock();
        try {
            while (oldTriples.hasNext()) {
                Triple triple = oldTriples.next();

                Resource oldValue = triple.getObject();
                if (newValue.equals(oldValue)) {
                    return;
                }
                oldBuffer.add(triple);
            }
View Full Code Here

                        log.info("Iterate over values of property {}", property);
                    }
                    it = graph.filter(null, property, null);
                }
                while(it.hasNext()){
                    Resource value = it.next().getObject();
                    if(value instanceof Literal){
                        return ((Literal)value).getLexicalForm();
                    }
                }
                return null; //no more data
View Full Code Here

     * @return
     */
    private Integer parseParamLimit(final RDFBackend<Resource> backend, Collection<Resource>[] args,int index) {
        Integer limit = null;
        if(args.length > index && !args[index].isEmpty()){
            Resource value = args[index].iterator().next();
            try {
                limit = intTransformer.transform(backend, value);
                if(limit < 1){
                    limit = null;
                }
View Full Code Here

//                } else { //use the ContentItem as context
//                    contexts = java.util.Collections.singleton((Resource)ci.getUri());
//                }
            mimeTypes = new HashSet<String>();
            for(Iterator<Resource> params = concat(args).iterator();params.hasNext();){
                Resource param = params.next();
                String mediaTypeString = backend.stringValue(param);
                try {
                    mimeTypes.add(parseMimeType(mediaTypeString).get(null));
                } catch (IllegalArgumentException e) {
                    log.warn(String.format("Invalid mediaType '%s' (based on RFC 2046) parsed!",
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.