1 6 7 package com.hp.hpl.jena.graph.query; 8 9 import com.hp.hpl.jena.graph.*; 10 11 16 17 public class Pattern 18 { 19 private Element S; 20 private Element P; 21 private Element O; 22 23 public Pattern( Element S, Element P, Element O ) 24 { 25 this.S = S; 26 this.P = P; 27 this.O = O; 28 } 29 30 34 public TripleMatch asTripleMatch( Domain d ) 35 { 36 return Triple.createMatch 37 ( S.asNodeMatch( d ), P.asNodeMatch( d ), O.asNodeMatch( d ) ); 38 } 39 40 48 public boolean match( Domain d, Triple t ) 49 { 50 return S.match( d, t.getSubject() ) 51 && P.match( d, t.getPredicate() ) 52 && O.match( d, t.getObject() ); 53 } 54 55 public String toString() 56 { return "<pattern " + S + " @" + P + " " + O + ">"; } 57 } 58 59 88 | Popular Tags |