本文整理汇总了Java中com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode类的典型用法代码示例。如果您正苦于以下问题:Java NodeValueNode类的具体用法?Java NodeValueNode怎么用?Java NodeValueNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeValueNode类属于com.hp.hpl.jena.sparql.expr.nodevalue包,在下文中一共展示了NodeValueNode类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDataType
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
public void testDataType()
{
List<Triple> pattern = new ArrayList<Triple>();
pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
NodeRelation intvalue = search("table2", "intvalue", rels);
NodeRelation value = search("table2", "value", rels);
pattern.clear();
pattern.add(Triple.create(Node.createVariable("s"), RDFS.label.asNode(), Node.createVariable("o")));
rels = translate(pattern, "optimizer/filtertests.n3");
NodeRelation langliteral = search("table1", "label_en", rels);
Expr filterint = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDint.getURI())));
Expr filterstring = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDstring.getURI())));
assertEquals("DATATYPE(intliteral) = xsd:int should be TRUE", Expression.TRUE, TransformExprToSQLApplyer.convert(filterint, intvalue));
assertEquals("DATATYPE(simpleliteral) = xsd:string should be TRUE", Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, value));
assertEquals("DATATYPE(langliteral) = xsd:string should be TRUE", Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, langliteral));
}
示例2: TermConstructorConverter
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
public TermConstructorConverter(TermConstructorType type, List<Expr> exprs) {
this.type = type;
if (type.equals(TermConstructorType.typedLiteral)) {
Node dtype = ((NodeValueNode) exprs.get(2)).getNode();
this.dtype = ResourceFactory.createResource(((Node_URI) dtype).getURI());
} else {
this.dtype = null;
}
String langStr = ((NodeValueString) exprs.get(1)).asString();
if (type.equals(TermConstructorType.plainLiteral) && !langStr.isEmpty()) {
this.langStr = langStr;
} else {
this.langStr = null;
}
this.expr = exprs.get(0);
}
示例3: evaluate
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
@Override
public Expr evaluate(NodeTest nodeTest, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) {
IsATest isATest = (IsATest) nodeTest;
Var tmpVar = Var.alloc(Var.alloc(VarIDGenerator.createID()));
elementGroup.addTriplePattern(new Triple(var.asNode(), RDF.type.asNode(), tmpVar.asNode()));
return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createURI(isATest.getPathExpression(new SesameValueBackend()).replace("<", "").replace(">", "").replaceFirst("is-a ", ""))));
}
示例4: evaluate
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
@Override
public Expr evaluate(NodeTest nodeTest, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) {
PathEqualityTest pathEqualityTest = (PathEqualityTest) nodeTest;
Var tmpVar = LDPathEvaluator.evaluate(pathEqualityTest.getPath(), elementGroup, var, evaluatorConfiguration);
if(pathEqualityTest.getNode() instanceof org.openrdf.model.impl.LiteralImpl) {
return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createLiteral(((LiteralImpl) pathEqualityTest.getNode()).getLabel().toString())));
} else {
return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createURI(pathEqualityTest.getNode().toString())));
}
}
示例5: evaluate
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
@Override
public Var evaluate(NodeSelector nodeSelector, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) {
UnionSelector unionSelector = (UnionSelector) nodeSelector;
NodeSelector nodeSelectorLeft = unionSelector.getLeft();
NodeSelector nodeSelectorRight = unionSelector.getRight();
ElementGroup leftGroup = new ElementGroup();
ElementGroup rightGroup = new ElementGroup();
Var leftVar = LDPathEvaluator.evaluate(nodeSelectorLeft, leftGroup, var, evaluatorConfiguration);
Var rightVar = LDPathEvaluator.evaluate(nodeSelectorRight, rightGroup, var, evaluatorConfiguration);
Var subVar = Var.alloc(VarIDGenerator.createID());
Query leftSubQuery = new Query();
leftGroup.addElement(new ElementBind(subVar, new NodeValueNode(leftVar.asNode())));
leftSubQuery.setQueryPattern(leftGroup);
leftSubQuery.addResultVar(var);
leftSubQuery.addResultVar(subVar);
leftSubQuery.setQuerySelectType();
ElementSubQuery leftESubQuery = new ElementSubQuery(leftSubQuery);
Query rightSubQuery = new Query();
rightGroup.addElement(new ElementBind(subVar, new NodeValueNode(rightVar.asNode())));
rightSubQuery.setQueryPattern(rightGroup);
rightSubQuery.addResultVar(var);
rightSubQuery.addResultVar(subVar);
rightSubQuery.setQuerySelectType();
ElementSubQuery rightESubQuery = new ElementSubQuery(rightSubQuery);
ElementUnion elementUnion = new ElementUnion();
elementUnion.addElement(leftESubQuery);
elementUnion.addElement(rightESubQuery);
elementGroup.addElement(elementUnion);
return subVar;
}
示例6: adapt
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
@Override
protected SparqlQueryBuilder adapt(SparqlQueryBuilder builder) {
builder = builder.addResultVariable(
Nodes.CONCEPT.getNode(0).getName(),
new NodeValueNode(rootNode)).addResultVariable(Nodes.CONCEPT.getLabelNode(0));
for (int currentIndex = 1; currentIndex <= depth; currentIndex++) {
builder = addResultVariables(builder, currentIndex);
}
return builder;
}
示例7: adapt
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
@Override
protected SparqlQueryBuilder adapt(SparqlQueryBuilder builder) {
return builder
.addResultVariable(CONCEPT.getName(), new NodeValueNode(createURI(getConceptUri())))
.addResultVariable(PREDICATE)
.addResultVariable(OBJECT)
.addResultVariable(SOURCE);
}
示例8: createUriValueNode
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
public NodeValueNode createUriValueNode() {
return new NodeValueNode(createUriNode());
}
示例9: create
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
@Override
public Expr create(String value) {
return new E_Equals(uri, new NodeValueNode(createURI(value)));
}
示例10: createDifferentNodesExpression
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
private E_NotEquals createDifferentNodesExpression(Node left, Node right) {
return new E_NotEquals(new NodeValueNode(left), new NodeValueNode(right));
}
示例11: getConceptUriExpr
import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueNode; //导入依赖的package包/类
protected NodeValueNode getConceptUriExpr() {
return new NodeValueNode(getConceptUriNode());
}