Java Code Examples for org.apache.jena.sparql.util.FmtUtils#stringForRDFNode()

The following examples show how to use org.apache.jena.sparql.util.FmtUtils#stringForRDFNode() . 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: TextOutputStar.java    From RDFstarTools with Apache License 2.0 5 votes vote down vote up
@Override
protected String getVarValueAsString(QuerySolution rBind, String varName) {
    final RDFNode obj = rBind.get(varName);

    if ( obj == null ) {
        return super.getVarValueAsString(rBind, varName);
    }
    else if ( obj.asNode() instanceof Node_Triple ) {
    	final Triple t = ( (Node_Triple) obj.asNode() ).get();
    	return getAsString(t);
    }
    else {
    	return FmtUtils.stringForRDFNode(obj, context);
    }
}
 
Example 2
Source File: PathExpression.java    From shacl with Apache License 2.0 5 votes vote down vote up
public PathExpression(RDFNode expr, Resource path, NodeExpression input) {
	super(expr, input);
	this.path = path;
	if(path.isAnon()) {
		pathString = SHACLPaths.getPathString(path);
		Path jenaPath = (Path) SHACLPaths.getJenaPath(pathString, path.getModel());
		eval = new PathEvaluator(jenaPath, expr.getModel());
	}
	else {
		pathString = FmtUtils.stringForRDFNode(path);
		eval = new PathEvaluator(JenaUtil.asProperty(path));
	}
	eval.setInput(input);
}
 
Example 3
Source File: ConstantTermExpression.java    From shacl with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return FmtUtils.stringForRDFNode(getRDFNode());
}