/** Test whether this is a quad for the default graph (not the default graphs by explicit name) */ public static boolean isDefaultGraphGenerated(Node node) { // The node used by the quad generator for the default graph // Not the named graph that refers to the default graph. return defaultGraphNodeGenerated.equals(node) ; }
/** Default, concrete graph (either generated or explicitly named) -- not triple-in-quad*/ public static boolean isUnionGraph(Node node) { return unionGraph.equals(node) ; }
/** Answer true iff this node accepts the other one as a match. The default is an equality test; it is over-ridden in subclasses to provide the appropriate semantics for literals, ANY, and variables. @param other a node to test for matching @return true iff this node accepts the other as a match */ public boolean matches( Node other ) { return equals( other ); }
@Override public boolean mightBeEqual(SomeResource r) { if (r!=null && (r instanceof FixedResource)) { FixedResource f = (FixedResource)r; return hash == f.hash && node.equals(f.node); // PURE SYNTAX } else { return false; } } }
/** Test whether this is a quad for the default graph (not the default graphs by explicit name) */ public static boolean isDefaultGraphGenerated(Node node) { // The node used by the quad generator for the default graph // Not the named graph that refers to the default graph. return defaultGraphNodeGenerated.equals(node) ; }
private boolean isSameOrVar(Node var, Node value) { return var.isVariable() || var.equals(value) ; } }
/** * Compare two patterns and return true if arg is a more * specific (more grounded) version of this one. * Does not handle functors. */ public boolean subsumes(TriplePattern arg) { return (subject.isVariable() || subject.equals(arg.subject)) && (predicate.isVariable() || predicate.equals(arg.predicate)) && (object.isVariable() || object.equals(arg.object)); }
@Override public boolean equalTo(Op other, NodeIsomorphismMap labelMap) { if ( ! ( other instanceof OpQuadPattern ) ) return false ; OpQuadPattern opQuad = (OpQuadPattern)other ; if ( ! graphNode.equals(opQuad.graphNode) ) return false ; return triples.equiv(opQuad.triples, labelMap) ; }
@Override public boolean equals(Object other) { if ( this == other ) return true ; if ( ! ( other instanceof PropFuncArg ) ) return false ; PropFuncArg pfArg = (PropFuncArg)other ; if ( isNode() ) return arg.equals(pfArg.arg) ; return argList.equals(pfArg.argList) ; }
private static void update(Node node, PatternTriple elt) { if ( Var.isVar(node) ) { if ( node.equals(elt.subject.getNode()) ) elt.subject = PatternElements.TERM ; if ( node.equals(elt.predicate.getNode()) ) elt.predicate = PatternElements.TERM ; if ( node.equals(elt.object.getNode()) ) elt.object = PatternElements.TERM ; } }
private void addPatterns(Item predicate, double numProp) { double wSP = weightSP ; double wPO = weightPO ; wPO = Math.min(numProp, wPO) ; wSP = Math.min(numProp, wSP) ; if ( NodeConst.nodeRDFType.equals(predicate.getNode()) ) // ? rdf:type <Object> -- Avoid as can be very, very bad. wPO = weightTypeO ; addPatterns(predicate, numProp, wSP, wPO) ; }
private void addPatterns(Item predicate, double numProp) { double wSP = weightSP ; double wPO = weightPO ; wPO = Math.min(numProp, wPO) ; wSP = Math.min(numProp, wSP) ; if ( NodeConst.nodeRDFType.equals(predicate.getNode()) ) // ? rdf:type <Object> -- Avoid as can be very, very bad. wPO = weightTypeO ; addPatterns(predicate, numProp, wSP, wPO) ; }
private void addPatternsSmall(Item predicate, double numProp) { double wSP = weightSP_small ; double wPO = weightPO_small ; wPO = Math.min(numProp, wPO) ; wSP = Math.min(numProp, wSP) ; if ( predicate.isNode() && NodeConst.nodeRDFType.equals(predicate.getNode()) ) wPO = weightTypeO_small ; addPatterns(predicate, numProp, wSP, wPO) ; }
/** * Validate a triple add to see if it should reinvoke the hook. If so * then the inference will be restarted at next prepare time. Incremental * re-processing is not yet supported. */ @Override public boolean needsRerun(FBRuleInfGraph infGraph, Triple t) { return (t.getPredicate().equals(OWL.intersectionOf.asNode())); }
private static boolean equalNode(Node m, Node n) { // m should not be null unless .getMatchXXXX used to get the node. // Language tag canonicalization n = fixupNode(n) ; m = fixupNode(m) ; return (m==null) || (m == Node.ANY) || m.equals(n) ; }
public static boolean nodeIso(Node n1, Node n2, NodeIsomorphismMap isoMap) { if ( isoMap != null && Var.isBlankNodeVar(n1) && Var.isBlankNodeVar(n2) ) return isoMap.makeIsomorhpic(n1, n2) ; return n1.equals(n2) ; } }
@Override public boolean doCheck( Node n, EnhGraph g ) { for (Iterator<Resource> i = ((OntModel) g).getProfile().getAnnotationProperties(); i.hasNext(); ) { if (i.next().asNode().equals( n )) { // a built-in annotation property return true; } } return g.asGraph().contains( n, RDF.type.asNode(), OWL.AnnotationProperty.asNode() ); } }
@Override public boolean equalTo(Op other, NodeIsomorphismMap labelMap) { if ( ! (other instanceof OpService) ) return false ; OpService opService = (OpService)other ; if ( ! ( serviceNode.equals(opService.serviceNode) ) ) return false ; if ( opService.getSilent() != getSilent() ) return false ; return getSubOp().equalTo(opService.getSubOp(), labelMap) ; }
@Override public boolean doCheck( Node n, EnhGraph g ) { return n.equals( RDF.nil.asNode() ) || g.asGraph().contains( n, RDF.type.asNode(), RDF.List.asNode() ); } }