com.hp.hpl.jena.graph.Triple.predicateMatches()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中com.hp.hpl.jena.graph.Triple.predicateMatches()方法的一些代码示例,展示了Triple.predicateMatches()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Triple.predicateMatches()方法的具体详情如下:
包路径:com.hp.hpl.jena.graph.Triple
类名称:Triple
方法名:predicateMatches

Triple.predicateMatches介绍

暂无

代码示例

代码示例来源:origin: net.sf.taverna.t2.activities/sadi-activity

/**
 * Returns the list of triples that match the give subject and predicate. If
 * the predicate is null any triple with the same subject will be returned.
 * 
 * @param triples
 *            the triples to filter
 * @param subject
 *            the subject to match
 * @param predicate
 *            the predicate to match
 * @return the list of triples that match the give subject and predicate
 */
public static List<Triple> filterTriples(Collection<Triple> triples, Node subject,
    Node predicate) {
  List<Triple> resultTriples = new ArrayList<Triple>();
  for (Triple triple : triples) {
    if (triple.subjectMatches(subject)) {
      if (predicate == null || triple.predicateMatches(predicate)) {
        resultTriples.add(triple);
      }
    }
  }
  return resultTriples;
}

代码示例来源:origin: AskNowQA/AutoSPARQL

for (Iterator<Triple> iterator = triples.iterator(); iterator.hasNext();) {
  Triple triple = iterator.next();
  if(triple.predicateMatches(RDF.type.asNode())){
    String subjectVarName = triple.getSubject().getName();
    String objectVarName = triple.getObject().getName();

代码示例来源:origin: AskNowQA/AutoSPARQL

for(Iterator<Triple> iter = triples.iterator(); iter.hasNext();){
  Triple t = iter.next();
  if(t.predicateMatches(RDF.type.asNode()) && t.getSubject().isVariable() && t.getObject().isURI()){
    variableToClass.put(t.getSubject(), t.getObject());
    iter.remove();

相关文章