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

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

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

Triple.equals介绍

[英]Answer true if o is a Triple with the same subject, predicate, and object as this triple.
[中]

代码示例

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

@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: ch.epfl.bluebrain.nexus.org.topbraid/shacl

@Override
public boolean equals(Object obj) {
  if(obj instanceof JSTriple) {
    return triple.equals(((JSTriple)obj).triple);
  }
  else {
    return false;
  }
}

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

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

代码示例来源:origin: 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.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: TopQuadrant/shacl

@Override
public boolean equals(Object obj) {
  if(obj instanceof JSTriple) {
    return triple.equals(((JSTriple)obj).triple);
  }
  else {
    return false;
  }
}

代码示例来源:origin: io.github.luzzu/luzzu-ld-qualitymetrics-commons

@Override
public boolean equals(Object other){
  if (!(other instanceof SerialisableTriple)) return false;
  
  SerialisableTriple _otherSerialisableTriple = (SerialisableTriple) other;
  Triple _otherTriple = _otherSerialisableTriple.getTriple();
  
  return _otherTriple.equals(this.getTriple());
}

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

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: apache/jena

/**
   * 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: 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: ch.epfl.bluebrain.nexus.org.topbraid/shacl

private boolean containsByEquals(Graph g,Triple t) {
  ExtendedIterator<Triple> it = g.find(t);
  try {
    while (it.hasNext()) {
      if (t.equals(it.next())) 
        return true;
    }
  }
  finally {
    it.close();
  }
  return false;
}

代码示例来源:origin: TopQuadrant/shacl

private boolean containsByEquals(Graph g,Triple t) {
  ExtendedIterator<Triple> it = g.find(t);
  try {
    while (it.hasNext()) {
      if (t.equals(it.next())) 
        return true;
    }
  }
  finally {
    it.close();
  }
  return false;
}

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

@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: Galigator/openllet

private static boolean checkEntailment(final PelletInfGraph pellet, final Triple pattern, final boolean withExplanation)
{
  final 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: Galigator/openllet

private static boolean checkEntailment(final PelletInfGraph pellet, final Triple pattern, final boolean withExplanation)
{
  final 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: com.github.galigator.openllet/openllet-jena

private static boolean checkEntailment(final PelletInfGraph pellet, final Triple pattern, final boolean withExplanation)
{
  final 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: apache/jena

@ContractTest
public void testIteratorRemoveOneItem() {
  testingBunch.add(triple("a P b"));
  testingBunch.add(triple("c Q d"));
  testingBunch.add(triple("e R f"));
  ExtendedIterator<Triple> it = testingBunch.iterator();
  while (it.hasNext())
    if (it.next().equals(triple("c Q d")))
      it.remove();
  assertEquals(tripleSet("a P b; e R f"), testingBunch.iterator().toSet());
}

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

@ContractTest
public void testIteratorRemoveOneItem() {
  testingBunch.add(triple("a P b"));
  testingBunch.add(triple("c Q d"));
  testingBunch.add(triple("e R f"));
  ExtendedIterator<Triple> it = testingBunch.iterator();
  while (it.hasNext())
    if (it.next().equals(triple("c Q d")))
      it.remove();
  assertEquals(tripleSet("a P b; e R f"), testingBunch.iterator().toSet());
}

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

public void testIteratorRemoveOneItem()
  {
  TripleBunch b = getBunch();
  b.add( triple( "a P b" ) );
  b.add( triple( "c Q d" ) );
  b.add( triple( "e R f" ) );
  ExtendedIterator<Triple> it = b.iterator();
  while (it.hasNext()) if (it.next().equals( triple( "c Q d") )) it.remove();
  assertEquals( tripleSet( "a P b; e R f" ), b.iterator().toSet() );
  }

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

public void testIteratorRemoveOneItem()
  {
  TripleBunch b = getBunch();
  b.add( triple( "a P b" ) );
  b.add( triple( "c Q d" ) );
  b.add( triple( "e R f" ) );
  ExtendedIterator<Triple> it = b.iterator();
  while (it.hasNext()) if (it.next().equals( triple( "c Q d") )) it.remove();
  assertEquals( tripleSet( "a P b; e R f" ), b.iterator().toSet() );
  }

相关文章