本文整理了Java中org.apache.jena.graph.Triple.objectMatches()
方法的一些代码示例,展示了Triple.objectMatches()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Triple.objectMatches()
方法的具体详情如下:
包路径:org.apache.jena.graph.Triple
类名称:Triple
方法名:objectMatches
暂无
代码示例来源:origin: SmartDataAnalytics/DL-Learner
/**
* Returns all triple patterns in given SPARQL query that have the given node in object position, i.e. the incoming
* triple patterns.
* @param query The SPARQL query.
* @param node the node
* @return
*/
public Set<Triple> extractIncomingTriplePatterns(Query query, Node node){
return extractTriplePattern(query, false).stream()
.filter(tp -> tp.objectMatches(node))
.collect(Collectors.toSet());
}
代码示例来源:origin: dice-group/NLIWOD
/**
* Returns all triple patterns in given SPARQL query that have the given
* node in object position, i.e. the incoming triple patterns.
*
* @param query The SPARQL query.
*/
public Set<Triple> extractIncomingTriplePatterns(final Query query, final Node node) {
Set<Triple> triplePatterns = extractTriplePattern(query, false);
// remove triple patterns not containing triple patterns with given node
// in subject position
for (Iterator<Triple> iterator = triplePatterns.iterator(); iterator.hasNext();) {
Triple triple = iterator.next();
if (!triple.objectMatches(node)) {
iterator.remove();
}
}
return triplePatterns;
}
代码示例来源:origin: dice-group/NLIWOD
/**
* Returns all triple patterns in given SPARQL query that have the given
* node in object position, i.e. the ingoing triple patterns.
*
* @param query The SPARQL query.
*/
public Set<Triple> extractIngoingTriplePatterns(final Query query, final Node node) {
Set<Triple> triplePatterns = extractTriplePattern(query, false);
// remove triple patterns not containing triple patterns with given node
// in object position
for (Iterator<Triple> iterator = triplePatterns.iterator(); iterator.hasNext();) {
Triple triple = iterator.next();
if (!triple.objectMatches(node)) {
iterator.remove();
}
}
return triplePatterns;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
@Override
public int compare(Triple o1, Triple o2) {
boolean same = o1.objectMatches(o2.getObject())
&& o2.predicateMatches(o2.getPredicate())
&& o1.getSubject().isVariable() && o2.getSubject().isVariable();
// && !var2IncomingTPs.containsKey(o1.getObject());
if (same) return 0;
return comp.compare(o1, o2);
}
});
代码示例来源:origin: apache/jena
public void testElementMatches()
{
assertTrue( NodeCreateUtils.createTriple( "S P O" ).subjectMatches( node( "S" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S P O" ).predicateMatches( node( "P" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S P O" ).objectMatches( node( "O" ) ) );
/* */
assertFalse( NodeCreateUtils.createTriple( "S P O" ).subjectMatches( node( "Z" ) ) );
assertFalse( NodeCreateUtils.createTriple( "S P O" ).predicateMatches( node( "Q" ) ) );
assertFalse( NodeCreateUtils.createTriple( "S P O" ).objectMatches( node( "I" ) ) );
/* */
assertTrue( NodeCreateUtils.createTriple( "?? P O" ).subjectMatches( node( "SUB" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S ?? O" ).predicateMatches( node( "PRED" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S P ??" ).objectMatches( node( "OBJ" ) ) );
}
代码示例来源:origin: org.apache.jena/jena-core
public void testElementMatches()
{
assertTrue( NodeCreateUtils.createTriple( "S P O" ).subjectMatches( node( "S" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S P O" ).predicateMatches( node( "P" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S P O" ).objectMatches( node( "O" ) ) );
/* */
assertFalse( NodeCreateUtils.createTriple( "S P O" ).subjectMatches( node( "Z" ) ) );
assertFalse( NodeCreateUtils.createTriple( "S P O" ).predicateMatches( node( "Q" ) ) );
assertFalse( NodeCreateUtils.createTriple( "S P O" ).objectMatches( node( "I" ) ) );
/* */
assertTrue( NodeCreateUtils.createTriple( "?? P O" ).subjectMatches( node( "SUB" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S ?? O" ).predicateMatches( node( "PRED" ) ) );
assertTrue( NodeCreateUtils.createTriple( "S P ??" ).objectMatches( node( "OBJ" ) ) );
}
内容来源于网络,如有侵权,请联系作者删除!