Search in sources :

Example 26 with Query

use of org.hypertrace.entity.data.service.v1.Query in project packages-jpl by SWI-Prolog.

the class TestOLD method test10.

private static void test10() {
    System.err.println("test10:");
    System.err.println("  java_lib_version = " + JPL.version_string());
    System.err.println("  c_lib_version = " + org.jpl7.fli.Prolog.get_c_lib_version());
    System.err.println("  pl_lib_version = " + new Query(new Compound("jpl_pl_lib_version", new Term[] { new Variable("V") })).oneSolution().get("V"));
    System.err.println("  java.version = " + System.getProperty("java.version"));
    System.err.println("  os.name = " + System.getProperty("os.name"));
    System.err.println("  os.arch = " + System.getProperty("os.arch"));
    System.err.println("  os.version = " + System.getProperty("os.version"));
    System.err.println();
}
Also used : Variable(org.jpl7.Variable) Query(org.jpl7.Query) Compound(org.jpl7.Compound) Term(org.jpl7.Term)

Example 27 with Query

use of org.hypertrace.entity.data.service.v1.Query in project packages-jpl by SWI-Prolog.

the class TestOLD method test10o.

private static void test10o() {
    System.err.println("test10o:");
    Term l2b = Util.termArrayToList(new Term[] { new Variable("A"), new Variable("B"), new Variable("C"), new Variable("D"), new Variable("E") });
    Query q9b = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2b }));
    Map<String, Term>[] s9bs = q9b.allSolutions();
    for (int i = 0; i < s9bs.length; i++) {
        System.err.println("  append(Xs,Ys,[A,B,C,D,E]) -> " + Util.toString(s9bs[i]));
    }
    System.err.println();
}
Also used : Variable(org.jpl7.Variable) Query(org.jpl7.Query) Compound(org.jpl7.Compound) Term(org.jpl7.Term) Map(java.util.Map)

Example 28 with Query

use of org.hypertrace.entity.data.service.v1.Query in project packages-jpl by SWI-Prolog.

the class TestOLD method test10m.

private static void test10m() {
    String text = "append(Xs,Ys,[_,_,_,_,_])";
    Query q = new Query(text);
    Map<String, Term>[] ss = q.allSolutions();
    System.err.println("test10m:");
    System.err.println("  all solutions of " + text);
    for (int i = 0; i < ss.length; i++) {
        System.err.println("  " + Util.toString(ss[i]));
    }
    System.err.println();
}
Also used : Query(org.jpl7.Query) Map(java.util.Map)

Example 29 with Query

use of org.hypertrace.entity.data.service.v1.Query in project packages-jpl by SWI-Prolog.

the class TestJUnit method testOpenGetClose1.

public void testOpenGetClose1() {
    StringBuffer sb = new StringBuffer();
    Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
    Map<String, Term> soln;
    q.open();
    while ((soln = q.getSolution()) != null) {
        sb.append(((Atom) soln.get("C")).name());
    }
    q.close();
    assertEquals("prolog", sb.toString());
}
Also used : Query(org.jpl7.Query) Term(org.jpl7.Term)

Example 30 with Query

use of org.hypertrace.entity.data.service.v1.Query in project packages-jpl by SWI-Prolog.

the class AddWithThreads method run.

public void run() {
    for (int i = 0; i < REPS; i++) {
        // System.out.println("Asserting test('" + i + "')");
        Query queryA = new Query("assert(" + namespace + "(test('" + i + "')))");
        Thread.yield();
        // System.out.println("adding query: " + queryA);
        // boolean retA = queryA.hasMoreElements();
        queryA.close();
    }
    latch.countDown();
}
Also used : Query(org.jpl7.Query)

Aggregations

Query (org.jpl7.Query)88 Term (org.jpl7.Term)52 Variable (org.jpl7.Variable)32 Query (org.hypertrace.entity.data.service.v1.Query)31 Map (java.util.Map)27 Test (org.junit.jupiter.api.Test)27 Atom (org.jpl7.Atom)21 Compound (org.jpl7.Compound)18 Filter (org.hypertrace.core.documentstore.Filter)17 Test (org.junit.Test)16 AttributeFilter (org.hypertrace.entity.data.service.v1.AttributeFilter)15 Query (com.google.datastore.v1.Query)14 ArrayList (java.util.ArrayList)10 Entity (org.hypertrace.entity.data.service.v1.Entity)9 EntityQueryRequest (org.hypertrace.entity.query.service.v1.EntityQueryRequest)8 GqlQuery (com.google.datastore.v1.GqlQuery)7 Integer (org.jpl7.Integer)6 IOException (java.io.IOException)5 Collections (java.util.Collections)5 List (java.util.List)5