比较Jena中的两个SPARQL查询

时间:2017-03-18 20:30:52

标签: sparql jena

我想知道两个SPARQL查询在逻辑上是否相同,例如假设我有以下两个查询,我怎么知道它们是否相同?

String query1= "SELECT ?name where { <http://www.example.com/P500> a <http://www.example.com/Parking>; " +
                "<http://www.example.com/name> ?name .}";

        String query2= "SELECT ?name where { <http://www.example.com/P500> <http://www.example.com/name> ?name;" +
                " a <http://www.example.com/Parking> .}";

以下代码不执行逻辑比较:

System.out.println("Compare query pattern");
        System.out.println(q1.getQueryPattern().equalTo(q2.getQueryPattern(),null));

        Op qop1 = Algebra.compile(q1) ;
        Op qop2 = Algebra.compile(q2) ;

        System.out.println("Compare query operator");
        System.out.println(qop1.equalTo(qop2,null));

0 个答案:

没有答案