Java Code Examples for org.openrdf.query.algebra.StatementPattern#getContextVar()
The following examples show how to use
org.openrdf.query.algebra.StatementPattern#getContextVar() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubClassOf.java From neo4j-sparql-extension with GNU General Public License v3.0 | 6 votes |
/** * Transform a statement pattern according to OWL-2 subclass axiom. * * @param node the node to transform * @return list of nodes to visit next */ @Override public List<QueryModelNode> apply(StatementPattern node) { List<QueryModelNode> next = newNextList(); StatementPattern left = node.clone(); // replace the object with the subclass StatementPattern right = new StatementPattern( node.getSubjectVar(), node.getPredicateVar(), new ConstVar(vf.createURI(ce1)), node.getContextVar()); node.replaceWith( new Union(left, right)); next.add(left); next.add(right); return next; }
Example 2
Source File: SubPropertyOf.java From neo4j-sparql-extension with GNU General Public License v3.0 | 6 votes |
/** * Transform a statement pattern according to OWL-2 subproperty axiom. * * @param node the node to transform * @return list of nodes to visit next */ @Override public List<QueryModelNode> apply(StatementPattern node) { List<QueryModelNode> next = newNextList(); StatementPattern left = node.clone(); // replace the predicate with the subproperty StatementPattern right = new StatementPattern( node.getSubjectVar(), new ConstVar(vf.createURI(op1)), node.getObjectVar(), node.getContextVar()); node.replaceWith( new Union(left, right)); next.add(left); next.add(right); return next; }
Example 3
Source File: InverseObjectProperties.java From neo4j-sparql-extension with GNU General Public License v3.0 | 6 votes |
/** * Transform a statement pattern according to OWL-2 inverse properties * axiom. * * @param node the node to transform * @return list of nodes to visit next */ @Override public List<QueryModelNode> apply(StatementPattern node) { List<QueryModelNode> next = newNextList(); Var s = node.getSubjectVar(); Var p = node.getPredicateVar(); Var o = node.getObjectVar(); Var c = node.getContextVar(); URI uri = (URI) p.getValue(); String op = uri.stringValue(); Var p2; // check if need to replace with op1 or op2 if (op.equals(op1)) { p2 = new ConstVar(vf.createURI(op2)); } else { p2 = new ConstVar(vf.createURI(op1)); } StatementPattern left = node.clone(); // switch subject and object and replace predicate StatementPattern right = new StatementPattern(o, p2, s, c); node.replaceWith(new Union(left, right)); next.add(left); next.add(right); return next; }
Example 4
Source File: CumulusQueryOptimizer.java From cumulusrdf with Apache License 2.0 | 5 votes |
@Override public void meet(final StatementPattern pattern) { pattern.getSubjectVar().setValue(makeNativeValue(pattern.getSubjectVar().getValue())); pattern.getPredicateVar().setValue(makeNativeValue(pattern.getPredicateVar().getValue())); pattern.getObjectVar().setValue(makeNativeValue(pattern.getObjectVar().getValue())); if (pattern.getContextVar() != null) { pattern.getContextVar().setValue(makeNativeValue(pattern.getContextVar().getValue())); } }
Example 5
Source File: ObjectPropertyChain.java From neo4j-sparql-extension with GNU General Public License v3.0 | 5 votes |
/** * Transform a statement pattern according to OWL-2 property chain * axiom. * * @param node the node to transform * @return list of nodes to visit next */ @Override public List<QueryModelNode> apply(StatementPattern node) { List<QueryModelNode> next = newNextList(); Var s = node.getSubjectVar(); Var o = node.getObjectVar(); Var c = node.getContextVar(); TupleExpr left = node.clone(); TupleExpr right = getChain(s, o, c); node.replaceWith(new Union(left, right)); next.add(left); next.add(right); return next; }