/** 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 isPrettyNode(Node n) { // Order matters? - one connected objects may include list elements. if ( allowDeepPretty ) { if ( lists.containsKey(n) ) return true ; if ( nestedObjects.contains(n) ) return true ; } if ( RDF_Nil.equals(n) ) return true ; return false ; }
private Node graphLabel(Node x, Resource root) { if ( SecurityContext.allGraphsStr.equals(x) ) x = SecurityContext.allGraphs; if ( SecurityContext.allNamedGraphsStr.equals(x) ) x = SecurityContext.allNamedGraphs; if ( ! x.isURI() ) throw new AssemblerException(root, "Not a graph name: "+x); return x; }
public boolean trigger(Quad quad) { for ( Node p : cols.keySet() ) { if ( p.equals(quad.getPredicate()) ) return true ; } return false ; }
@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 boolean isSameOrVar(Node var, Node value) { return var.isVariable() || var.equals(value) ; } }
private /*static*/ Iterator<Triple> graphFind(Graph graph, Node s, Node p, Node o, Context context) { // This is the only place this is called. // It means we can add property functions here. // Fast-path common cases. if ( doingRDFSmember && RDFSmember.equals(p) ) return GraphContainerUtils.rdfsMember(graph, s, o) ; if ( doingListMember && ListMember.equals(p) ) return GraphList.listMember(graph, s, o) ; // Potentially just allow the cases above. //return graph.find(s, p, o) ; return graphFind2(graph, s, p, o, context) ; }
@Override public boolean equals(Expr other, boolean bySyntax) { if ( other == null ) return false ; if ( this == other ) return true ; // This is the equality condition Jena uses - lang tags are different by case. if ( ! ( other instanceof NodeValue ) ) return false ; NodeValue nv = (NodeValue)other ; return asNode().equals(nv.asNode()) ; // Not NodeFunctions.sameTerm (which smooshes language tags by case) }
/** * 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())); }
public boolean containsRealQuad(){ for(Quad quad : this.getQuads()){ if ( ! Quad.defaultGraphNodeGenerated.equals( quad.getGraph())){ return true; } } return false; }
@Override public boolean equalTo(Op other, NodeIsomorphismMap labelMap) { if ( ! (other instanceof OpGraph) ) return false ; OpGraph opGraph = (OpGraph)other ; if ( ! ( node.equals(opGraph.node) ) ) return false ; return getSubOp().equalTo(opGraph.getSubOp(), labelMap) ; } }
@Override public Op transform(OpGraph opGraph, Op x) { if ( opGraph.getNode().equals(oldGraphName) ) opGraph = new OpGraph(newGraphName, x) ; return super.transform(opGraph, x) ; }
@Override public boolean test(Triple triple) { Node p = triple.getPredicate() ; if ( ! triple.getPredicate().isURI() ) return false ; if (RDFSmember.equals(p) ) return true ; String u = triple.getPredicate().getURI() ; return membershipPattern.matcher(u).matches() ; } } ;
@Override public Op transform(OpGraph opGraph, Op x) { if ( opGraph.getNode().equals(oldGraphName) ) opGraph = new OpGraph(newGraphName, x) ; return super.transform(opGraph, x) ; }
@Override public boolean evaluate(final Object principal, Set<Action> actions, Node graphIRI, Triple triple) { return triple.getSubject().equals( principal ); }
@Test public void path_38() { // Same end points. List<Binding> x = eval(graph6, "?x", "(pathN+ :p)", "?x" ) ; assertEquals(2, x.size()) ; Node node1 = x.get(0).get(Var.alloc("x")) ; Node node2 = x.get(1).get(Var.alloc("x")) ; assertFalse(node1.equals(node2)) ; assertTrue(node1.equals(n1) || node1.equals(n2)) ; assertTrue(node2.equals(n1) || node2.equals(n2)) ; }
@Override public boolean contains(final RDFNode o) throws ReadDeniedException, AuthenticationRequiredException { // iterator check reads final SecuredNodeIterator<RDFNode> iter = iterator(); while (iter.hasNext()) { if (iter.next().asNode().equals(o.asNode())) { return true; } } return false; }
@Override public void visit(ExprAggregator eAgg) { Node n = changeNode(eAgg.getVar()); if (n.equals(eAgg.getVar())) { push(eAgg); } else { push(NodeValue.makeNode(n)); } }
@Test public void filtered5() { Predicate<Quad> filter = x-> x.getSubject().equals(s2) || x.getSubject().equals(s1); Txn.executeRead(basedsg, ()->{ DatasetGraph dsg = new DatasetGraphFilteredView(basedsg, filter, Arrays.asList(g1, g2)); long x0 = Iter.count(dsg.find(null, null, null, null)); assertEquals(3,x0); long x1 = Iter.count(dsg.find(g2, null, null, null)); assertEquals(2,x1); }); }