org.apache.jena.graph.Triple.matches()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(132)

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

Triple.matches介绍

[英]Does this triple, used as a pattern match, the other triple (usually a ground triple)
[中]这个三元组用作模式匹配,另一个三元组(通常是地面三元组)是吗

代码示例

代码示例来源:origin: apache/jena

protected boolean slowContains( Triple t )
  {
    for ( Triple element : elements )
    {
      if ( t.matches( element ) )
      {
        return true;
      }
    }
  return false;
  }

代码示例来源:origin: org.apache.jena/jena-core

@Override
public boolean containsBySameValueAs( Triple t )
  {
  int i = size;
  while (i > 0) if (t.matches( elements[--i])) return true;
  return false;
  }

代码示例来源:origin: apache/jena

@Override
public boolean containsBySameValueAs( Triple t )
  {
  int i = size;
  while (i > 0) if (t.matches( elements[--i])) return true;
  return false;
  }

代码示例来源:origin: org.apache.jena/jena-core

protected boolean slowContains( Triple t )
  {
    for ( Triple element : elements )
    {
      if ( t.matches( element ) )
      {
        return true;
      }
    }
  return false;
  }

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
public boolean test(Triple t) {
  return tMatch.matches(t);
}

代码示例来源:origin: apache/jena

protected int findSlotBySameValueAs( Triple key )
  {
  int index = initialIndexFor( key );
  while (true)
    {
    Object current = keys[index];
    if (current == null) return index;
    if (key.matches( (Triple) current )) return ~index;
    if (--index < 0) index += capacity;
    }
  }

代码示例来源:origin: org.apache.jena/jena-core

protected int findSlotBySameValueAs( Triple key )
  {
  int index = initialIndexFor( key );
  while (true)
    {
    Object current = keys[index];
    if (current == null) return index;
    if (key.matches( (Triple) current )) return ~index;
    if (--index < 0) index += capacity;
    }
  }

代码示例来源:origin: apache/jena

protected boolean slowContains( Triple t )
  { 
  TripleBunch s = bunchMap.get( getIndexField( t ) );
  if (s == null)
    return false;
  else
    {
    Iterator<Triple> it = s.iterator();
    while (it.hasNext()) if (t.matches( it.next() )) return true;
    return false;
    }
  }

代码示例来源:origin: org.apache.jena/jena-core

protected boolean slowContains( Triple t )
  { 
  TripleBunch s = bunchMap.get( getIndexField( t ) );
  if (s == null)
    return false;
  else
    {
    Iterator<Triple> it = s.iterator();
    while (it.hasNext()) if (t.matches( it.next() )) return true;
    return false;
    }
  }

代码示例来源:origin: apache/jena

@Override
  protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
    List<Triple> results = new ArrayList<>();
    for ( Triple t : triples )
      if ( t.matches(m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject()) )
        results.add(t);
    return WrappedIterator.create(results.iterator());
  }
}

代码示例来源:origin: apache/jena

private boolean matches(Triple t, Node s, Node p, Node o) {
  s = nullAsAny(s);
  p = nullAsAny(p);
  o = nullAsAny(o);
  return t.matches(s, p, o);
}

代码示例来源:origin: apache/jena

private void testMatches( String pattern, String triple )
  { assertTrue( NodeCreateUtils.createTriple( pattern ).matches( NodeCreateUtils.createTriple( triple ) ) ); }

代码示例来源:origin: org.apache.jena/jena-core

private void testMatches( String pattern, String triple )
  { assertTrue( NodeCreateUtils.createTriple( pattern ).matches( NodeCreateUtils.createTriple( triple ) ) ); }

代码示例来源:origin: apache/jena

public void testMatchFails( String pattern, String triple )
  { assertFalse( NodeCreateUtils.createTriple( pattern ).matches( NodeCreateUtils.createTriple( triple ) ) ); }

代码示例来源:origin: org.apache.jena/jena-core

public void testMatchFails( String pattern, String triple )
  { assertFalse( NodeCreateUtils.createTriple( pattern ).matches( NodeCreateUtils.createTriple( triple ) ) ); }

代码示例来源:origin: apache/jena

public void testMatchesNodes()
  {
  assertTrue( NodeCreateUtils.createTriple( "S P O" ).matches( node("S" ), node( "P" ), node( "O" ) ) );
  assertTrue( NodeCreateUtils.createTriple( "?? P O" ).matches( node("Z" ), node( "P" ), node( "O" ) ) );
  assertTrue( NodeCreateUtils.createTriple( "S ?? O" ).matches( node("S" ), node( "Q" ), node( "O" ) ) );
  assertTrue( NodeCreateUtils.createTriple( "S P ??" ).matches( node("S" ), node( "P" ), node( "I" ) ) );
/* */
  assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "O" ) ) );
  assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("S" ), node( "Q" ), node( "O" ) ) );
  assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "I" ) ) );        
  }

代码示例来源:origin: org.apache.jena/jena-core

public void testMatchesNodes()
  {
  assertTrue( NodeCreateUtils.createTriple( "S P O" ).matches( node("S" ), node( "P" ), node( "O" ) ) );
  assertTrue( NodeCreateUtils.createTriple( "?? P O" ).matches( node("Z" ), node( "P" ), node( "O" ) ) );
  assertTrue( NodeCreateUtils.createTriple( "S ?? O" ).matches( node("S" ), node( "Q" ), node( "O" ) ) );
  assertTrue( NodeCreateUtils.createTriple( "S P ??" ).matches( node("S" ), node( "P" ), node( "I" ) ) );
/* */
  assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "O" ) ) );
  assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("S" ), node( "Q" ), node( "O" ) ) );
  assertFalse( NodeCreateUtils.createTriple( "S P O" ).matches( node("Z" ), node( "P" ), node( "I" ) ) );        
  }

相关文章