Search in sources :

Example 11 with Term

use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.

the class TestJUnit method testTextToTerm1.

public void testTextToTerm1() {
    String text = "fred(B,p(A))";
    Term t = Util.textToTerm(text);
    assertTrue("Util.textToTerm() converts \"fred(B,p(A))\" to a corresponding Term", t.hasFunctor("fred", 2) && t.arg(1).isVariable() && t.arg(1).name().equals("B") && t.arg(2).hasFunctor("p", 1) && t.arg(2).arg(1).isVariable() && t.arg(2).arg(1).name().equals("A"));
}
Also used : Term(org.jpl7.Term)

Example 12 with Term

use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.

the class TestJUnit method testBigInteger1.

public void testBigInteger1() {
    BigInteger a = new BigInteger(Long.toString(51L));
    // 51**51, too big for a long
    BigInteger b = a.pow(51);
    Term x = Query.oneSolution("X is 51**51").get("X");
    assertTrue("X is an org.jpl7.Integer", x.isInteger());
    // System.out.println("X.bigValue() = " + x.bigValue().toString());
    // System.out.println("b.bigValue() = " + b.toString());
    assertTrue("X is a big integer", x.isBigInteger());
    assertTrue("X's big value is 51**51", x.bigValue().equals(b));
}
Also used : BigInteger(java.math.BigInteger) Term(org.jpl7.Term)

Example 13 with Term

use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.

the class TestJUnit method testIsJNull2.

public void testIsJNull2() {
    Term t = Query.oneSolution("X = @(3)").get("X");
    assertFalse("@(3) . isJNull() fails", t.isJNull());
}
Also used : Term(org.jpl7.Term)

Example 14 with Term

use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.

the class TestJUnit method testHasMoreSolutions1.

public void testHasMoreSolutions1() {
    StringBuffer sb = new StringBuffer();
    Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
    Map<String, Term> soln;
    q.open();
    while (q.hasMoreSolutions()) {
        soln = q.nextSolution();
        sb.append(((Atom) soln.get("C")).name());
    }
    q.close();
    assertEquals("Query#hasMoreSolutions() + Query#nextSolution() work as intended", "prolog", sb.toString());
}
Also used : Query(org.jpl7.Query) Term(org.jpl7.Term)

Example 15 with Term

use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.

the class TestJUnit method testJRef1.

public void testJRef1() {
    int i = 76543;
    Integer I = new Integer(i);
    Query q = new Query("jpl_call(?,intValue,[],I2)", new Term[] { Term.objectToJRef(I) });
    Term I2 = q.oneSolution().get("I2");
    assertTrue(I2.isInteger() && I2.intValue() == i);
}
Also used : Integer(org.jpl7.Integer) BigInteger(java.math.BigInteger) Query(org.jpl7.Query) Term(org.jpl7.Term)

Aggregations

Term (org.jpl7.Term)86 Query (org.jpl7.Query)52 Variable (org.jpl7.Variable)29 Atom (org.jpl7.Atom)23 Compound (org.jpl7.Compound)23 Map (java.util.Map)19 BigInteger (java.math.BigInteger)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 Integer (org.jpl7.Integer)4 Term (org.apache.cassandra.cql3.Term)3 MarshalException (org.apache.cassandra.serializers.MarshalException)3 JAXBElement (javax.xml.bind.JAXBElement)2 Unmarshaller (javax.xml.bind.Unmarshaller)2 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)2 CodeType (org.geotoolkit.gml.xml.v311.CodeType)2 TimePositionType (org.geotoolkit.gml.xml.v311.TimePositionType)2 Capabilities (org.geotoolkit.sml.xml.v100.Capabilities)2 Classification (org.geotoolkit.sml.xml.v100.Classification)2 Classifier (org.geotoolkit.sml.xml.v100.Classifier)2