Search in sources :

Example 46 with Resource

use of com.inova8.intelligentgraph.model.Resource 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 47 with Resource

use of com.inova8.intelligentgraph.model.Resource 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 48 with Resource

use of com.inova8.intelligentgraph.model.Resource 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)

Example 49 with Resource

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

the class Local_GetFact_Tests method test_19.

/**
 * Test 19.
 */
@Test
@Order(19)
void test_19() {
    try {
        Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/BatteryLimit1"), null);
        Resource result = _this.getFact(":Location@:appearsOn[ rdfs:label '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)

Example 50 with Resource

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

the class Local_GetFact_Tests method test_17.

/**
 * Test 17.
 */
@Test
@Order(17)
void test_17() {
    try {
        Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/Calc2Graph1"), null);
        Resource result = _this.getFact("^:Location@:appearsOn[eq id:BatteryLimit2]");
        assertEquals("http://inova8.com/calc2graph/id/BatteryLimit2", 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

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