List of usage examples for org.apache.commons.rdf.api Triple equals
@Override public boolean equals(Object other);
From source file:example.UserGuideTest.java
@Test public void triple() throws Exception { BlankNodeOrIRI subject = factory.createBlankNode(); IRI predicate = factory.createIRI("http://example.com/says"); RDFTerm object = factory.createLiteral("Hello"); Triple triple = factory.createTriple(subject, predicate, object); BlankNodeOrIRI subj = triple.getSubject(); System.out.println(subj.ntriplesString()); IRI pred = triple.getPredicate();/* ww w .jav a 2s. c o m*/ System.out.println(pred.getIRIString()); RDFTerm obj = triple.getObject(); System.out.println(obj.ntriplesString()); if (subj instanceof IRI) { String s = ((IRI) subj).getIRIString(); System.out.println(s); } // .. if (obj instanceof Literal) { IRI type = ((Literal) obj).getDatatype(); System.out.println(type); } System.out.println(triple.equals(factory.createTriple(subj, pred, obj))); }