Package org.jrdf.graph

Examples of org.jrdf.graph.Triple


        }
    }

    private void globalIteratorRemove(Iterator<Triple> triples) throws GraphException {
        while (triples.hasNext()) {
            Triple triple = triples.next();
            localizeAndRemove(triple.getSubject(), triple.getPredicate(), triple.getObject());
        }
    }
View Full Code Here


        return m_next != null;
    }

    @Override
    public Triple next() throws TrippiException {
        Triple last = m_next;
        m_next = getNext();
        return last;
    }
View Full Code Here

        m_next = getNext();
        return last;
    }

    private Triple getNext() throws TrippiException {
        Triple next;
        if (!m_add) // purging entries
        {
            next = m_baseIter.next();
            while (next != null && matches(next, m_filter)) {
                m_changeMade = true;
View Full Code Here

        Set<RelationshipTuple> tuples = new HashSet<RelationshipTuple>();

        TripleIterator iter = null;
        try {
            iter = TripleIteratorFactory.defaultInstance().fromStream(dsContent, RDFFormat.RDF_XML);
            Triple triple;
            while (iter.hasNext()) {
                triple = iter.next();
                tuples.add(RelationshipTuple.fromTriple(triple));
            }
        } finally {
View Full Code Here

                                   String relationship,
                                   String object,
                                   boolean isLiteral,
                                   String datatype) throws ServerException {

        Triple toAdd =
                createTriple(subject, relationship, object, isLiteral, datatype);
        Datastream relsDatastream = GetDatastream(dsId, null);
        XMLDatastreamProcessor dsxml = null;
        if (relsDatastream == null) {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

                                     String relationship,
                                     String object,
                                     boolean isLiteral,
                                     String datatype) throws ServerException {

        Triple toPurge =
                createTriple(subject, relationship, object, isLiteral, datatype);

        Datastream relsDatastream = GetDatastream(dsId, null);
        if (relsDatastream == null) {
            // relationship does not exist
View Full Code Here

        }

        try {
            TripleIterator it = RI.findTriples(s, p, null, 0);
            while (it.hasNext()) {
                Triple t = it.next();
                String pred = t.getPredicate().toString();

                Set<String> values = rels.get(pred);
                if (values == null) {
                    values = new HashSet<String>();
                }
                values.add(t.getObject().stringValue());
                rels.put(pred, values);
            }

        } catch (TrippiException e) {
            throw new MelcoeXacmlException("Error finding relationships " + e.getMessage(), e);
View Full Code Here

        }

        try {
            TripleIterator it = RI.findTriples(null, p, o, 0);
            while (it.hasNext()) {
                Triple t = it.next();
                String pred = t.getPredicate().toString();

                Set<String> values = rels.get(pred);
                if (values == null) {
                    values = new HashSet<String>();
                }
                values.add(t.getSubject().stringValue());
                rels.put(pred, values);
            }

        } catch (TrippiException e) {
            throw new MelcoeXacmlException("Error finding relationships " + e.getMessage(), e);
View Full Code Here

            if (variable.length() == 1 && "spo".contains(variable)) {
                try {
                    TripleIterator triples = RI.findTriples(queryLang, query, 0, true);
                    if (triples != null ) {
                        while (triples.hasNext()) {
                            Triple triple = triples.next();
                            switch(variable.charAt(0)) {
                                case 's':
                                    res.add(triple.getSubject().stringValue());
                                    break;
                                case 'p':
                                    res.add(triple.getPredicate().stringValue());
                                    break;
                                case 'o':
                                    res.add(triple.getObject().stringValue());
                                    break;
                            }
                        }
                    }
                } catch (TrippiException e) {
View Full Code Here

            SubjectNode snode = new SimpleURIReference(new URI(resourceID));
            PredicateNode pnode = new SimpleURIReference(new URI(attribute));
            TripleIterator triples = m_resourceIndex.findTriples(snode, pnode, null, 0);
            results = new HashSet<String>();
            while (triples.hasNext()){
                Triple triple = triples.next();
                String object = triple.getObject().stringValue();
                results.add(object);
            }
        }
        catch (TrippiException e){
            logger.warn("Error retreiving triples in attributeFinder",e);
View Full Code Here

TOP

Related Classes of org.jrdf.graph.Triple

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.