Tabnine Logo
ResultSetCompare.equalsByTerm
Code IndexAdd Tabnine to your IDE (free)

How to use
equalsByTerm
method
in
org.apache.jena.sparql.resultset.ResultSetCompare

Best Java code snippets using org.apache.jena.sparql.resultset.ResultSetCompare.equalsByTerm (Showing top 20 results out of 315)

origin: apache/jena

@Test public void test_RS_1()
{
  ResultSetRewindable rs1 = new ResultSetMem() ;
  ByteArrayOutputStream arr = new ByteArrayOutputStream() ;
  ResultSetFormatter.outputAsXML(arr, rs1) ;
  rs1.reset() ;
  ByteArrayInputStream ins = new ByteArrayInputStream(arr.toByteArray()) ;
  ResultSet rs2 = ResultSetFactory.fromXML(ins) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_cmp_6()
{
  // Different variable, same values
  ResultSetRewindable rs1 = makeRewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ResultSetRewindable rs2 = makeRewindable("y", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  assertFalse(ResultSetCompare.equalsByTermAndOrder(rs1, rs2)) ;
  rs1.reset() ;
  rs2.reset() ;
  assertFalse(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_5()
{
  ResultSetRewindable rs1 = new ResultSetMem() ;
  ByteArrayOutputStream arr = new ByteArrayOutputStream() ;
  ResultSetFormatter.outputAsJSON(arr, rs1) ;
  rs1.reset() ;
  ByteArrayInputStream ins = new ByteArrayInputStream(arr.toByteArray()) ;
  ResultSet rs2 = ResultSetFactory.fromJSON(ins) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_2()
{
  ResultSetRewindable rs1 = makeRewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ByteArrayOutputStream arr = new ByteArrayOutputStream() ;
  ResultSetFormatter.outputAsXML(arr, rs1) ;
  rs1.reset() ;
  ByteArrayInputStream ins = new ByteArrayInputStream(arr.toByteArray()) ;
  ResultSet rs2 = ResultSetFactory.fromXML(ins) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_cmp_1()
{
  ResultSetRewindable rs1 = new ResultSetMem() ;
  ResultSetRewindable rs2 = new ResultSetMem() ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
  rs1.reset() ;
  rs2.reset() ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_6()
{
  ResultSetRewindable rs1 = make2Rewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ByteArrayOutputStream arr = new ByteArrayOutputStream() ;
  ResultSetFormatter.outputAsJSON(arr, rs1) ;
  rs1.reset() ;
  ByteArrayInputStream ins = new ByteArrayInputStream(arr.toByteArray()) ;
  ResultSet rs2 = ResultSetFactory.fromJSON(ins) ;    // Test using the DAWG examples
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_cmp_4()
{
  ResultSet rs1 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ResultSet rs2 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}
origin: apache/jena

@Test public void test_RS_cmp_5()
{
  // Same variable, different values
  ResultSetRewindable rs1 = makeRewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local:1")) ;
  ResultSetRewindable rs2 = makeRewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local:2")) ;
  assertFalse(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
  rs1.reset() ;
  rs2.reset() ;
  assertFalse(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}
origin: apache/jena

@Test public void test_resultset_01() {
  // write(data)-read-compare
  ByteArrayOutputStream out = new ByteArrayOutputStream() ;
  ResultSetMgr.write(out, test_rs, lang) ;
  test_rs.reset(); 
  ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) ;
  
  ResultSet rs = ResultSetMgr.read(in, lang) ;
  ResultSetRewindable rsw = ResultSetFactory.makeRewindable(rs) ;
  if ( ! lang.equals(SPARQLResultSetCSV) )
    // CSV is not faithful
    assertTrue(ResultSetCompare.equalsByTerm(test_rs, rsw)) ;
  rsw.reset();
  test_rs.reset(); 
  
  out = new ByteArrayOutputStream() ;
  // Round trip the output from above - write(rsw)-read-compare
  ResultSetMgr.write(out, rsw, lang) ;
  in = new ByteArrayInputStream(out.toByteArray()) ;
  ResultSet rs2 = ResultSetMgr.read(in, lang) ;
  // Not test_rs -- CSV round-trips to itself.
  assertTrue(ResultSetCompare.equalsByTerm(rsw, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_cmp_3()
{
  ResultSet rs1 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ResultSet rs2 = new ResultSetMem() ;
  assertFalse(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}
origin: apache/jena

@Test public void test_RS_1_str()
{
  ResultSetRewindable rs1 = new ResultSetMem() ;
  String x = ResultSetFormatter.asXMLString(rs1) ;
  rs1.reset() ;
  InputStream in = new ByteArrayInputStream(StrUtils.asUTF8bytes(x));
  ResultSet rs2 = ResultSetFactory.fromXML(in) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}
origin: apache/jena

@Test public void test_RS_cmp_2()
{
  ResultSet rs1 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ResultSet rs2 = new ResultSetMem() ;
  assertFalse(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}
origin: apache/jena

@Test public void test_RS_2_str()
{
  ResultSetRewindable rs1 = makeRewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  String x = ResultSetFormatter.asXMLString(rs1) ;
  rs1.reset() ;
  InputStream in = new ByteArrayInputStream(StrUtils.asUTF8bytes(x));
  ResultSet rs2 = ResultSetFactory.fromXML(in) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}
origin: apache/jena

private static boolean equalTables(Table table1, Table table2) {
  ResultSet rs1 =  ResultSetFactory.create(table1.iterator(null), table1.getVarNames()) ;
  ResultSet rs2 =  ResultSetFactory.create(table2.iterator(null), table2.getVarNames()) ;
  return ResultSetCompare.equalsByTerm(rs1, rs2) ;
}
origin: apache/jena

  public static boolean equalsByTerm(Table table1, Table table2) {
    ResultSet rs1 = ResultSetFactory.create(table1.iterator(null), table1.getVarNames()) ;
    ResultSet rs2 = ResultSetFactory.create(table2.iterator(null), table2.getVarNames()) ;
    return ResultSetCompare.equalsByTerm(rs1, rs2) ;
  }
}
origin: apache/jena

@Test public void test_RS_3()
{
  ResultSetRewindable rs1 = new ResultSetMem() ;
  Model model = RDFOutput.encodeAsModel(rs1) ;
  rs1.reset() ;
  ResultSet rs2 = RDFInput.fromRDF(model) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_cmp_value_1()
{
  ResultSetRewindable rs1 = makeRewindable("x", NodeFactoryExtra.parseNode("123")) ;
  ResultSetRewindable rs2 = makeRewindable("x", NodeFactoryExtra.parseNode("0123")) ;
  assertFalse(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
  assertTrue(ResultSetCompare.equalsByValue(rs1, rs2)) ;
}

origin: apache/jena

@Test public void test_RS_union_1() 
{
  ResultSet rs1 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ResultSet rs2 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  ResultSet rs3 = make2("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  assertTrue(ResultSetCompare.equalsByTerm(rs3, ResultSetUtils.union(rs1, rs2))) ;
}
origin: apache/jena

@Test public void test_RS_4()
{
  ResultSetRewindable rs1 = makeRewindable("x", org.apache.jena.graph.NodeFactory.createURI("tag:local")) ;
  Model model = RDFOutput.encodeAsModel(rs1) ;
  rs1.reset() ;
  ResultSetRewindable rs2 = ResultSetFactory.makeRewindable(RDFInput.fromRDF(model)) ;
  boolean b = ResultSetCompare.equalsByTerm(rs1, rs2) ;
  if ( ! b )
  {
    rs1.reset() ;
    rs2.reset() ;
    ResultSetFormatter.out(rs1) ;
    ResultSetFormatter.out(rs2) ;
  }
  
  assertTrue(b) ;
}

origin: apache/jena

private void isotest(String[] rs1$2, String[] rs2$2)
{
  ResultSetRewindable rs1 = ResultSetFactory.makeRewindable(BuilderResultSet.build(SSE.parseItem(StrUtils.strjoinNL(rs1$)))) ;
  ResultSetRewindable rs2 = ResultSetFactory.makeRewindable(BuilderResultSet.build(SSE.parseItem(StrUtils.strjoinNL(rs2$)))) ;
  assertTrue(ResultSetCompare.isomorphic(rs1, rs2)) ;
  rs1.reset() ;
  rs2.reset() ;   
  assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2)) ;
  assertTrue(ResultSetCompare.equalsByValue(rs1, rs2)) ;
}
org.apache.jena.sparql.resultsetResultSetCompareequalsByTerm

Javadoc

compare two result sets for equivalence. Equivalence means: A row rs1 has one matching row in rs2, and vice versa. A row is only matched once. Rows match if they have the same variables with the same values, bNodes must map to a consistent other bNodes. Term comparisons of nodes. Destructive - rs1 and rs2 are both read, possibly to exhaustion.

Popular methods of ResultSetCompare

  • equalsByValue
  • equal
    Compare two bindings, use the node equality test provided
  • equalsByTest
  • isomorphic
    Compare two result sets for bNode isomorphism equivalence. Only does RDF term comparison.
  • compareHeader
  • containedIn
  • convert
  • equalsByTermAndOrder
    compare two result sets for equivalence. Equivalence means: Each row in rs1 matchs the same index ro
  • equalsByValueAndOrder
    Compare two result sets for equivalence. Equivalence means: Each row in rs1 matches the same index r
  • equalsExact
    compare two result sets for exact equality equivalence. Exact equalitymeans: Each row in rs1 matches
  • equivalent
  • equivalentByOrder
  • equivalent,
  • equivalentByOrder

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getContentResolver (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now