Search in sources :

Example 81 with Resource

use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.

the class Example7_Tests method example7_6.

/**
 * Example 7 6.
 */
@Test
@Order(6)
void example7_6() {
    try {
        Thing aPerson = source.getThing(":aPerson");
        Resource femaleParent = aPerson.getFact(":hasFamilialRelativeBMI");
        assertEquals(1.006889937409004, femaleParent.doubleValue());
    } catch (Exception e) {
        assertEquals("", e.getCause().getMessage());
    }
}
Also used : Resource(com.inova8.intelligentgraph.model.Resource) Thing(com.inova8.intelligentgraph.model.Thing) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 82 with Resource

use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.

the class Example7_Tests method example7_1.

/**
 * Example 7 1.
 */
@Test
@Order(1)
void example7_1() {
    try {
        Thing aPerson = source.getThing(":aPerson");
        Resource femaleParent = aPerson.getFact(":hasParent{0,4}/:hasParent[:hasGender :Female]");
        assertEquals("http://inova8.com/intelligentgraph/example7/Another3", femaleParent.stringValue());
    } catch (Exception e) {
        assertEquals("", e.getCause().getMessage());
    }
}
Also used : Resource(com.inova8.intelligentgraph.model.Resource) Thing(com.inova8.intelligentgraph.model.Thing) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 83 with Resource

use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.

the class ExampleLanguageTest_Tests method example1_2.

/**
 * Example 1 2.
 */
@Test
@Order(2)
void example1_2() {
    try {
        Thing peter = source.getThing(":aPerson");
        Resource bmi = peter.getFact(":hasBMIjs");
        assertEquals("21.453287197231838", bmi.stringValue());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : Resource(com.inova8.intelligentgraph.model.Resource) Thing(com.inova8.intelligentgraph.model.Thing) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 84 with Resource

use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.

the class ExampleLanguageTest_Tests method example1_1.

/**
 * Example 1 1.
 */
@Test
@Order(1)
void example1_1() {
    try {
        Thing peter = source.getThing(":aPerson");
        Resource bmi = peter.getFact(":hasBMIgroovy");
        assertEquals("21.453287197231838", bmi.stringValue());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : Resource(com.inova8.intelligentgraph.model.Resource) Thing(com.inova8.intelligentgraph.model.Thing) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 85 with Resource

use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.

the class ExampleLanguageTest_Tests method example1_5.

/**
 * Example 1 5.
 */
@Test
@Order(5)
void example1_5() {
    try {
        Thing peter = source.getThing(":aPerson");
        CustomQueryOptions customQueryOptions = new CustomQueryOptions();
        // customQueryOptions.add("aOption", LocalDate.of(2018,2,13));
        // customQueryOptions.add("aOption", LocalDateTime.of(2018,2,13,6,30));
        // customQueryOptions.add("aOption", LocalTime.of(6,30));
        customQueryOptions.add("aOption", LocalDateTime.parse("2018-02-14T06:30"));
        Resource bmi = peter.getFact(":hasCustomQueryOptionTest", customQueryOptions);
        assertEquals("\"2018-02-14T06:30:00.0\"^^<http://www.w3.org/2001/XMLSchema#dateTime>", bmi.stringValue());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : CustomQueryOptions(com.inova8.intelligentgraph.context.CustomQueryOptions) Resource(com.inova8.intelligentgraph.model.Resource) Thing(com.inova8.intelligentgraph.model.Thing) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Aggregations

Resource (com.inova8.intelligentgraph.model.Resource)140 Order (org.junit.jupiter.api.Order)135 Test (org.junit.jupiter.api.Test)135 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)135 Thing (com.inova8.intelligentgraph.model.Thing)113 ResourceResults (com.inova8.intelligentgraph.results.ResourceResults)26 IntelligentGraphRepository (com.inova8.intelligentgraph.intelligentGraphRepository.IntelligentGraphRepository)20 Graph (com.inova8.intelligentgraph.intelligentGraphRepository.Graph)19 QueryEvaluationException (org.eclipse.rdf4j.query.QueryEvaluationException)11 CustomQueryOptions (com.inova8.intelligentgraph.context.CustomQueryOptions)9 PathPatternException (com.inova8.pathql.processor.PathPatternException)8 RecognitionException (org.antlr.v4.runtime.RecognitionException)8 ArrayList (java.util.ArrayList)7 IRI (org.eclipse.rdf4j.model.IRI)7 RepositoryException (org.eclipse.rdf4j.repository.RepositoryException)7 Repository (org.eclipse.rdf4j.repository.Repository)6 RepositoryConnection (org.eclipse.rdf4j.repository.RepositoryConnection)6 NullValueReturnedException (com.inova8.intelligentgraph.exceptions.NullValueReturnedException)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 BindingSet (org.eclipse.rdf4j.query.BindingSet)5