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

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

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

Triple.equals介绍

[英]Answer true if o is a Triple with the same subject, predicate, and object as this triple.
[中]如果o是一个与此三元组具有相同主语、谓语和宾语的三元组,则回答true。

代码示例

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

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

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

@Override
public void remove( Triple t )
  {
  changes += 1;
  for (int i = 0; i < size; i += 1)
    {
    if (t.equals( elements[i] ))
      { elements[i] = elements[--size];
      return; }
    }
  }

代码示例来源:origin: paulhoule/infovore

public boolean equals(Object o) {
  if (!(o instanceof WritableTriple))
    return false;
  
  WritableTriple that=(WritableTriple) o;
  return that.getTriple().equals(getTriple());
}

代码示例来源:origin: com.hp.hpl.jena/arq

public boolean equivalent(OpBGP opBGP)
{
  BasicPattern bgp = opBGP.getPattern() ;
  if ( bgp.size() != 1 ) return false ;
  Triple t = bgp.get(0) ;
  return triple.equals(t) ;  
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public boolean equivalent(OpBGP opBGP)
{
  BasicPattern bgp = opBGP.getPattern() ;
  if ( bgp.size() != 1 ) return false ;
  Triple t = bgp.get(0) ;
  return triple.equals(t) ;  
}

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

/**
   * Compare two derivations. This is a shallow comparison, two derivations 
   * are the same if they contain the same conclusion, rule and match list. 
   * They do not need to be derived from the same (or any) infGraph.
   */
  @Override
  public boolean equals(Object other) {
    if (other instanceof RuleDerivation) {
      RuleDerivation otherD = (RuleDerivation)other;
      return conclusion.equals(otherD.getConclusion()) &&
          matches.equals(otherD.getMatches()) &&
          rule.equals(otherD.getRule());
    } else {
      return false;
    }
  }
}

代码示例来源:origin: net.sourceforge.owlapi/pellet-jena-ignazio1977

public Graph explain(Triple pattern) {
  if( !pattern.equals( INCONCISTENCY_TRIPLE ) ) {
    if( !pattern.isConcrete() ) {
      if( log.isLoggable( Level.WARNING ) ) {

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public boolean equals(Object other)
{
  if ( this == other) return true ;
  if ( ! ( other instanceof TriplePath) )
    return false ;
  TriplePath tp = (TriplePath)other ;
  // True if one is true and one is false
  if ( tp.isTriple() ^ this.isTriple() )
    return false ;
  if ( isTriple() )
    return asTriple().equals(tp.asTriple()) ;
  else        
    return subject.equals(tp.subject) && object.equals(tp.object) && path.equals(tp.path) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
public boolean equals(Object other)
{
  if ( this == other) return true ;
  if ( ! ( other instanceof TriplePath) )
    return false ;
  TriplePath tp = (TriplePath)other ;
  // True if one is true and one is false
  if ( tp.isTriple() ^ this.isTriple() )
    return false ;
  if ( isTriple() )
    return asTriple().equals(tp.asTriple()) ;
  else        
    return subject.equals(tp.subject) && object.equals(tp.object) && path.equals(tp.path) ;
}

代码示例来源:origin: net.sourceforge.owlapi/pellet-jena-ignazio1977

private static boolean checkEntailment(PelletInfGraph pellet, Triple pattern, boolean withExplanation) {
  boolean doExplanation = pellet.getKB().doExplanation();
  pellet.getKB().setDoExplanation( withExplanation );
  
  boolean entailed = false;
  if( pattern.equals( INCONCISTENCY_TRIPLE ) ) {
    entailed = !pellet.isConsistent();
  }
  else {
    entailed = pellet.containsTriple( pattern );
  }
  
  pellet.getKB().setDoExplanation( doExplanation );
  
  return entailed;
}

代码示例来源:origin: Quetzal-RDF/quetzal

protected ConjunctiveQuery replace(ConjunctiveQuery q, Triple oldT, Triple newT) {
  ElementTriplesBlock newPattern = new ElementTriplesBlock();
  for (Triple t:q.getTriples()) {
    if (t.equals(oldT)) {
      newPattern.addTriple(newT);
    } else {
      newPattern.addTriple(t);
    }
  }
  ConjunctiveQuery ret = q.cloneConjQuery();
  ret.setQueryPattern(newPattern);
  for (ElementFilter ef: q.getFilters()) {
    ret.addFilter(ef.getExpr());
  }
  return ret;
}

代码示例来源:origin: com.hp.hpl.jena/arq

public Node reifyAs(Node node, Triple triple)
{
  if ( node == null )
    node = Node.createAnon() ;
  else
  {
    Triple t = getTriple(node) ; 
    
    if ( t != null && ! t.equals(triple) )
      throw new AlreadyReifiedException(node) ;
    if ( t != null )
      // Already there
      return node ;
  }
  
  graph.add(new Triple(node, rdfType, statement)) ;
  graph.add(new Triple(node, subject, triple.getSubject())) ;
  graph.add(new Triple(node, predicate, triple.getPredicate())) ;
  graph.add(new Triple(node, object, triple.getObject())) ;
  // Check it's a well-formed reification by Jena's uniqueness rules 
  Triple t = getTriple(node) ;
  if ( t == null )
    throw new CannotReifyException(node) ;
  return node ;
}

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

if ( t != null && ! t.equals(triple) )
  throw new AlreadyReifiedException(node) ;
if ( t != null )

相关文章