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

x33g5p2x  于2022-01-28 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(217)

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

Query.equals介绍

[英]Are two queries equals - tests shape and details. Equality means that the queries do the same thing, including same variables, in the same places. Being unequals does not mean the queries do different things. For example, reordering a group or union means that a query is different. Two instances of a query parsed from the same string are equal.
[中]两个查询相等——测试形状和细节。相等意味着查询在相同的位置执行相同的操作,包括相同的变量。不平等并不意味着查询会做不同的事情。例如,对组或联合重新排序意味着查询是不同的。从同一字符串解析的查询的两个实例相等。

代码示例

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

@Override
public boolean equalTo(Element other, NodeIsomorphismMap isoMap)
{
  if ( ! ( other instanceof ElementSubQuery) )
    return false ;
  ElementSubQuery el = (ElementSubQuery)other ;
  return query.equals(el.query) ;
}

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

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (obj == null)
    return false;
  if (getClass() != obj.getClass())
    return false;
  PartitionedQueryN other = (PartitionedQueryN) obj;
  if (partitionVars == null) {
    if (other.partitionVars != null)
      return false;
  } else if (!partitionVars.equals(other.partitionVars))
    return false;
  if (query == null) {
    if (other.query != null)
      return false;
  } else if (!query.equals(other.query))
    return false;
  return true;
}

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

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (!super.equals(obj))
    return false;
  if (getClass() != obj.getClass())
    return false;
  SparqlStmtQuery other = (SparqlStmtQuery) obj;
  if (query == null) {
    if (other.query != null)
      return false;
  } else if (!query.equals(other.query))
    return false;
  return true;
}

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

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (obj == null)
    return false;
  if (getClass() != obj.getClass())
    return false;
  PartitionedQuery1 other = (PartitionedQuery1) obj;
  if (query == null) {
    if (other.query != null)
      return false;
  } else if (!query.equals(other.query))
    return false;
  if (partitionVar == null) {
    if (other.partitionVar != null)
      return false;
  } else if (!partitionVar.equals(other.partitionVar))
    return false;
  return true;
}

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

@Override
  public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) {
    if (this == obj)
      return true;
    if (!super.equals(obj))
      return false;
    if (getClass() != obj.getClass())
      return false;
    OpSubQueryExecution other = (OpSubQueryExecution) obj;
    if (qef == null) {
      if (other.qef != null)
        return false;
    } else if (!qef.equals(other.qef))
      return false;
    if (query == null) {
      if (other.query != null)
        return false;
    } else if (!query.equals(other.query))
      return false;
    return true;
  }
}

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

@Override
  public boolean equalTo(Op obj, NodeIsomorphismMap labelMap) {
    if (this == obj)
      return true;
    if (!super.equals(obj))
      return false;
    if (getClass() != obj.getClass())
      return false;
    OpSubQueryExecution other = (OpSubQueryExecution) obj;
    if (qef == null) {
      if (other.qef != null)
        return false;
    } else if (!qef.equals(other.qef))
      return false;
    if (query == null) {
      if (other.query != null)
        return false;
    } else if (!query.equals(other.query))
      return false;
    return true;
  }
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

if(!q1.equals(q2)) {

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

private static void test(String input, String expected) {
  if ( expected == null )
    expected = input ;
  String qs = gen(PRE, input) ;
  String qsExpected = gen(PRE, expected) ;
  
  Query query = QueryFactory.create(qs, Syntax.syntaxARQ) ;
  Query query2 = QueryTransformOps.transform(query, new ElementTransformCleanGroupsOfOne()) ;
  Query queryExpected = QueryFactory.create(qsExpected, Syntax.syntaxARQ) ;
  
  Op op1 = Algebra.compile(query) ;
  Op op2 = Algebra.compile(query2) ;
  assertEquals("Algebra different", op1, op2) ;
  
  boolean modified = ! query.equals(query2) ;
  boolean expectModification = !queryExpected.equals(query) ;
  assertEquals("Expect query modifed?", expectModification, modified) ;
}

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

private  void test(String qs1, String qs2, boolean result)
{
  Query q1 = null ;
  Query q2 = null ;
  try { q1 = QueryFactory.create(qs1, Syntax.syntaxSPARQL) ; }
  catch (Exception ex) { fail("Building query 1") ; }
  
  try { q2 = QueryFactory.create(qs2, Syntax.syntaxSPARQL) ; }
  catch (Exception ex) { fail("Building query 2") ; }
  boolean b = false ;
  try { b = q1.equals(q2) ; }
  catch (Exception ex) { 
    ex.printStackTrace(System.err) ;
    
    fail("Evaluating .equals") ; }
    
  if ( result )
    assertTrue(b) ;
   else
    assertFalse(b) ;
   }

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

throw new QueryCheckException("reparsed query hashCode does not equal parsed input query \nQuery (hashCode: " + query.hashCode() + ")=\n" + query + "\n\nQuery2 (hashCode: " + query2.hashCode() + ")=\n" + query2) ;
if ( ! query.equals(query2) ) 
  throw new QueryCheckException("reparsed output does not equal parsed input") ;

相关文章