org.openrdf.query.algebra.ValueConstant Java Examples

The following examples show how to use org.openrdf.query.algebra.ValueConstant. 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: PropertySetElem.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param predicate The predicate to set.
 */
public void setPredicate(ValueConstant predicate) {
	this.predicate = predicate;
}
 
Example #2
Source File: PropertySetElem.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return Returns the predicate.
 */
public ValueConstant getPredicate() {
	return predicate;
}
 
Example #3
Source File: SeenVisitor.java    From neo4j-sparql-extension with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void meet(ValueConstant node) throws RuntimeException {
	setSeen(node);
	super.meet(node);
}
 
Example #4
Source File: ConsistencyVisitor.java    From neo4j-sparql-extension with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void meet(ValueConstant node) throws RuntimeException {
	check(node);
	super.meet(node);
}
 
Example #5
Source File: Rule.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
private void extractConsequent(TupleExpr constructQuery, Projection projection, Extension extension) {
	StatementPattern consequent = new StatementPattern();
	Var sub = new Var();
	Var pred = new Var();
	Var obj = new Var();
	
	HashMap<String, ValueConstant> index = new HashMap<String, ValueConstant>();
	for (ExtensionElem extElem: extension.getElements()) {
		try {
			index.put(extElem.getName(), (ValueConstant) extElem.getExpr());
		} catch (ClassCastException e) {
			e.printStackTrace();
			throw new RuntimeException("Unsupported construct query rule: \n" + constructQuery.toString());
		}
	}
	
	for (ProjectionElem elem: projection.getProjectionElemList().getElements()) {
		Var currentComponent = null;
		if (elem.getTargetName().equals("subject")) {
			currentComponent = sub;
		} else if (elem.getTargetName().equals("predicate")) {
			currentComponent = pred;
		} else if (elem.getTargetName().equals("object")) {
			currentComponent = obj;
		} else {
			throw new RuntimeException("Unsupported construct query rule: " + constructQuery.toString());
		}
		
		ValueConstant valueConstant = index.get(elem.getSourceName());
		if (valueConstant != null) {
			currentComponent.setConstant(true);
			currentComponent.setValue(valueConstant.getValue());
			currentComponent.setName(elem.getSourceName());
		} else {
			currentComponent.setConstant(false);
			currentComponent.setName(elem.getSourceName());
		}
	}
	
	consequent.setSubjectVar(sub);
	consequent.setPredicateVar(pred);
	consequent.setObjectVar(obj);

	this.consequent = consequent;
}