Search in sources :

Example 61 with Thing

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

the class Local_GetFact_Tests method test_34.

/**
 * Test 34.
 */
@Test
@Order(34)
void test_34() {
    try {
        source = IntelligentGraphRepository.create(workingRep);
        Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/BatteryLimit3"), null);
        Resource result = _this.getFact("<http://inova8.com/calc2graph/def/massYield>");
        assertEquals("0.26315789803903855", result.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 62 with Thing

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

the class Local_GetFact_Tests method test_35.

/**
 * Test 35.
 */
@Test
@Order(35)
void test_35() {
    try {
        source = IntelligentGraphRepository.create(workingRep);
        source.removeGraph("<http://inova8.com/calc2graph/contextGraph>");
        Graph graph = source.addGraph("<http://inova8.com/calc2graph/contextGraph>");
        Thing myCountry = graph.getThing(":Country1");
        myCountry.addFact(":time", "_customQueryOptions.get(\"time\") ;", SCRIPT.GROOVY);
        CustomQueryOptions customQueryOptions = new CustomQueryOptions();
        customQueryOptions.add("time", 42);
        customQueryOptions.add("name", "Peter");
        Thing myCountry1 = graph.getThing(":Country1");
        Resource result = myCountry1.getFact("<http://inova8.com/calc2graph/def/time>", customQueryOptions);
        assertEquals("42", result.stringValue());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : Graph(com.inova8.intelligentgraph.intelligentGraphRepository.Graph) 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)

Example 63 with Thing

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

the class Local_GetFact_Tests method test_8.

/**
 * Test 8.
 */
@Test
@Order(8)
void test_8() {
    try {
        Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/BatteryLimit2"), null);
        Resource result = _this.getFact("^:hasProductBatteryLimit").getFact(":massThroughput");
        assertEquals("37.99999952316284", result.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 64 with Thing

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

the class Local_GetFact_Tests method test_10.

/**
 * Test 10.
 */
@Test
@Order(10)
void test_10() {
    try {
        Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/BatteryLimit2"), null);
        Float result = _this.getFact("^:hasProductBatteryLimit/:massThroughput").floatValue();
        assertEquals("38.0", result.toString());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : 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 65 with Thing

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

the class Local_GetFact_Tests method test_23.

/**
 * Test 23.
 */
@Test
@Order(23)
void test_23() {
    try {
        Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/BatteryLimit1"), null);
        Resource result = _this.getFact(":Location@:appearsOn#[:location.Map  id:Calc2Graph2 ]");
        assertEquals("http://inova8.com/calc2graph/id/Location_BL1_2", result.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)

Aggregations

Thing (com.inova8.intelligentgraph.model.Thing)211 Order (org.junit.jupiter.api.Order)189 Test (org.junit.jupiter.api.Test)189 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)189 Resource (com.inova8.intelligentgraph.model.Resource)112 Graph (com.inova8.intelligentgraph.intelligentGraphRepository.Graph)45 IntelligentGraphRepository (com.inova8.intelligentgraph.intelligentGraphRepository.IntelligentGraphRepository)36 ResourceResults (com.inova8.intelligentgraph.results.ResourceResults)33 PathResults (com.inova8.intelligentgraph.results.PathResults)29 CustomQueryOptions (com.inova8.intelligentgraph.context.CustomQueryOptions)20 IRI (org.eclipse.rdf4j.model.IRI)13 Value (org.eclipse.rdf4j.model.Value)13 Path (com.inova8.intelligentgraph.path.Path)11 PathPatternException (com.inova8.pathql.processor.PathPatternException)11 RecognitionException (org.antlr.v4.runtime.RecognitionException)11 Trace (com.inova8.intelligentgraph.evaluator.Trace)10 QueryEvaluationException (org.eclipse.rdf4j.query.QueryEvaluationException)9 RepositoryConnection (org.eclipse.rdf4j.repository.RepositoryConnection)9 EvaluationContext (com.inova8.intelligentgraph.evaluator.EvaluationContext)8 SimpleLiteral (org.eclipse.rdf4j.model.impl.SimpleLiteral)8