Package org.jrdf.graph

Examples of org.jrdf.graph.Triple


            TripleIterator iter;
            try {
                iter = m_factory.fromStream(data, RDFFormat.RDF_XML);
                entries = new ArrayList<RelationshipTuple>();
                for (int i = 0; iter.hasNext(); i++) {
                    Triple triple = iter.next();
                    String object = null;
                    boolean isLiteral = false;
                    URI typeURI = null;
                    ObjectNode oNode = triple.getObject();
                    if (oNode instanceof Literal) {
                        isLiteral = true;
                        typeURI = ((Literal) oNode).getDatatypeURI();
                    }
                    object = oNode.toString();
                    entries.add(new RelationshipTuple(triple.getSubject()
                                                              .toString(),
                                                      triple.getPredicate()
                                                              .toString(),
                                                      object,
                                                      isLiteral,
                                                      typeURI));
View Full Code Here


                TripleIteratorFactory.defaultInstance().fromStream(new ByteArrayInputStream(rdf), null,
                RDFFormat.RDF_XML);

        boolean found = false;
        while (it.hasNext()) {
            Triple t = it.next();

            sb.append(t.getSubject().stringValue() + ", ");
            sb.append(t.getPredicate().stringValue() + ", ");
            sb.append(t.getObject().stringValue() + "\n");

            sb.append("matching: " + s + " " + t.getSubject().stringValue()
                    + " " + (s.equals(t.getSubject().stringValue())) + "\n");
            sb.append("matching: " + p + " " + t.getPredicate().stringValue()
                    + " " + (p.equals(t.getPredicate().stringValue())) + "\n");
            sb.append("matching: " + o + " " + t.getObject().stringValue()
                    + " " + (o.equals(t.getObject().stringValue())) + "\n");

            if (s.equals(t.getSubject().stringValue())
                    && p.equals(t.getPredicate().stringValue())
                    && o.equals(t.getObject().stringValue())) {
                sb.append("Matched\n");
                found = true;
            }
        }
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.