/** * Answer the triple associated with the node <code>n</code>. * * @param n * the node to use as the key * @return the associated triple, or <code>null</code> if none */ public static Triple getTriple(Graph graph, Node n) { // Must have rdf:type rdf:Statement if ( ! graph.contains(n, rdfType, statement) ) return null ; Node s = getObject(graph, n, subject) ; if ( s == null ) return null ; Node p = getObject(graph, n, predicate) ; if ( p == null ) return null ; Node o = getObject(graph, n, object) ; if ( o == null ) return null ; return new Triple(s,p,o) ; }