本文整理了Java中org.apache.jena.graph.Node.matches()
方法的一些代码示例,展示了Node.matches()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.matches()
方法的具体详情如下:
包路径:org.apache.jena.graph.Node
类名称:Node
方法名:matches
[英]Answer true iff this node accepts the other one as a match. The default is an equality test; it is over-ridden in subclasses to provide the appropriate semantics for literals, ANY, and variables.
[中]如果此节点接受另一个作为匹配项,则回答true。默认情况下是平等测试;它在子类中过于繁杂,无法为文本、任意文本和变量提供适当的语义。
代码示例来源:origin: apache/jena
private static boolean nodeMatches(Node thisNode, Node otherNode)
{
// otherNode may be Node.ANY, and this works out.
return otherNode.matches(thisNode) ;
}
代码示例来源:origin: apache/jena
public boolean predicateMatches( Node p )
{ return pred.matches( p ); }
代码示例来源:origin: org.apache.jena/jena-core
public boolean subjectMatches( Node s )
{ return subj.matches( s ); }
代码示例来源:origin: apache/jena
public boolean matches( Node s, Node p, Node o )
{ return subj.matches( s ) && pred.matches( p ) && obj.matches( o ); }
代码示例来源:origin: apache/jena
public boolean objectMatches( Node o )
{ return obj.matches( o ); }
代码示例来源:origin: apache/jena
public boolean subjectMatches( Node s )
{ return subj.matches( s ); }
代码示例来源:origin: org.apache.jena/jena-core
public boolean objectMatches( Node o )
{ return obj.matches( o ); }
代码示例来源:origin: apache/jena
private boolean matchedBy( Node s, Node p, Node o )
{ return s.matches( subj ) && p.matches( pred ) && o.matches( obj ); }
代码示例来源:origin: org.apache.jena/jena-core
public boolean matches( Node s, Node p, Node o )
{ return subj.matches( s ) && pred.matches( p ) && obj.matches( o ); }
代码示例来源:origin: org.apache.jena/jena-core
private boolean matchedBy( Node s, Node p, Node o )
{ return s.matches( subj ) && p.matches( pred ) && o.matches( obj ); }
代码示例来源:origin: org.apache.jena/jena-core
public boolean predicateMatches( Node p )
{ return pred.matches( p ); }
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public boolean hasAnchor(Node node) {
Objects.requireNonNull(node);
return node.matches(anchorVar);
}
// private TreeMultimap<Node, RDFResourceTree> edge2Children = TreeMultimap.create(
代码示例来源:origin: SmartDataAnalytics/DL-Learner
/**
* Find nodes matching the data in the given tree.
*/
private List<RDFResourceTree> getMatchingTreeNodes(RDFResourceTree tree, Node node) {
List<RDFResourceTree> treeNodes = new ArrayList<>();
TreeTraversal<RDFResourceTree> treeTraversal = new PreOrderTreeTraversal<>(tree);
treeTraversal.forEachRemaining(treeNode -> {
if(treeNode.getData().matches(node)) {
treeNodes.add(treeNode);
}
});
return treeNodes;
}
代码示例来源:origin: org.apache.jena/jena-core
public void testSimpleMatches()
{
assertTrue( NodeCreateUtils.create( "S").matches( NodeCreateUtils.create( "S" ) ) );
assertFalse( "", NodeCreateUtils.create( "S").matches( NodeCreateUtils.create( "T" ) ) );
assertFalse( "", NodeCreateUtils.create( "S" ).matches( null ) );
assertTrue( NodeCreateUtils.create( "_X").matches( NodeCreateUtils.create( "_X" ) ) );
assertFalse( "", NodeCreateUtils.create( "_X").matches( NodeCreateUtils.create( "_Y" ) ) );
assertFalse( "", NodeCreateUtils.create( "_X").matches( null ) );
assertTrue( NodeCreateUtils.create( "10" ).matches( NodeCreateUtils.create( "10" ) ) );
assertFalse( "", NodeCreateUtils.create( "10" ).matches( NodeCreateUtils.create( "11" ) ) );
assertFalse( "", NodeCreateUtils.create( "10" ).matches( null ) );
assertTrue( Node.ANY.matches( NodeCreateUtils.create( "S" ) ) );
assertTrue( Node.ANY.matches( NodeCreateUtils.create( "_X" ) ) );
assertTrue( Node.ANY.matches( NodeCreateUtils.create( "10" ) ) );
assertFalse( "", Node.ANY.matches( null ) );
}
代码示例来源:origin: apache/jena
public void testSimpleMatches()
{
assertTrue( NodeCreateUtils.create( "S").matches( NodeCreateUtils.create( "S" ) ) );
assertFalse( "", NodeCreateUtils.create( "S").matches( NodeCreateUtils.create( "T" ) ) );
assertFalse( "", NodeCreateUtils.create( "S" ).matches( null ) );
assertTrue( NodeCreateUtils.create( "_X").matches( NodeCreateUtils.create( "_X" ) ) );
assertFalse( "", NodeCreateUtils.create( "_X").matches( NodeCreateUtils.create( "_Y" ) ) );
assertFalse( "", NodeCreateUtils.create( "_X").matches( null ) );
assertTrue( NodeCreateUtils.create( "10" ).matches( NodeCreateUtils.create( "10" ) ) );
assertFalse( "", NodeCreateUtils.create( "10" ).matches( NodeCreateUtils.create( "11" ) ) );
assertFalse( "", NodeCreateUtils.create( "10" ).matches( null ) );
assertTrue( Node.ANY.matches( NodeCreateUtils.create( "S" ) ) );
assertTrue( Node.ANY.matches( NodeCreateUtils.create( "_X" ) ) );
assertTrue( Node.ANY.matches( NodeCreateUtils.create( "10" ) ) );
assertFalse( "", Node.ANY.matches( null ) );
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
protected RDFResourceTree processLiteralNodes(RDFResourceTree tree1, RDFResourceTree tree2) {
RDFDatatype d1 = tree1.getData().getLiteralDatatype();
RDFDatatype d2 = tree2.getData().getLiteralDatatype();
RDFResourceTree newTree;
if(d1 != null && d1.equals(d2)){
newTree = new RDFResourceTree(d1);
// TODO collect literal values
} else {
newTree = RDFResourceTree.newLiteralNode();
}
if(tree1.getAnchorVar() != null && tree1.getAnchorVar().matches(tree2.getAnchorVar())) {
newTree.setAnchorVar(tree1.getAnchorVar());
}
return newTree;
}
代码示例来源:origin: apache/jena
public void testFloatVsDouble()
{
Node A = NodeCreateUtils.create( "'1'xsd:float" );
Node B = NodeCreateUtils.create( "'1'xsd:double" );
assertFalse( A.equals( B ) );
assertFalse( A.sameValueAs( B ) );
assertFalse( B.sameValueAs( A ) );
assertFalse( A.matches( B ) );
assertFalse( B.matches( A ) );
}
代码示例来源:origin: apache/jena
public void testDataMatches()
{
TypeMapper tm = TypeMapper.getInstance();
RDFDatatype dt1 = tm.getTypeByValue( new Integer( 10 ) );
RDFDatatype dt2 = tm.getTypeByValue( new Short( (short) 10 ) );
Node a = NodeFactory.createLiteral( "10", dt1 );
Node b = NodeFactory.createLiteral( "10", dt2 );
assertDiffer( "types must make a difference", a, b );
assertTrue( "A and B must express the same value", a.sameValueAs( b ) );
assertTrue( "matching literals must respect sameValueAs", a.matches( b ) );
}
代码示例来源:origin: org.apache.jena/jena-core
public void testDataMatches()
{
TypeMapper tm = TypeMapper.getInstance();
RDFDatatype dt1 = tm.getTypeByValue( new Integer( 10 ) );
RDFDatatype dt2 = tm.getTypeByValue( new Short( (short) 10 ) );
Node a = NodeFactory.createLiteral( "10", dt1 );
Node b = NodeFactory.createLiteral( "10", dt2 );
assertDiffer( "types must make a difference", a, b );
assertTrue( "A and B must express the same value", a.sameValueAs( b ) );
assertTrue( "matching literals must respect sameValueAs", a.matches( b ) );
}
代码示例来源:origin: org.apache.jena/jena-core
public void testFloatVsDouble()
{
Node A = NodeCreateUtils.create( "'1'xsd:float" );
Node B = NodeCreateUtils.create( "'1'xsd:double" );
assertFalse( A.equals( B ) );
assertFalse( A.sameValueAs( B ) );
assertFalse( B.sameValueAs( A ) );
assertFalse( A.matches( B ) );
assertFalse( B.matches( A ) );
}
内容来源于网络,如有侵权,请联系作者删除!