Search in sources :

Example 91 with Thing

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

the class Local_TFL_GetPath_Tests method test_3.

/**
 * Test 3.
 */
@Test
@Order(3)
void test_3() {
    try {
        Thing _this = source.getThing("londontube:Mornington_Crescent");
        PathResults paths = _this.getPaths(":connectsTo{1,2}");
        assertEquals("Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Kings_Cross_St._Pancras,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/South_Hampstead,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Mornington_Crescent,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Wembley_Central,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Warren_Street,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Camden_Town,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Camden_Town,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Mornington_Crescent,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Camden_Town,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Chalk_Farm,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Camden_Town,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Kentish_Town,DIRECT]\r\n" + "]\r\n" + "", paths.toString());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : PathResults(com.inova8.intelligentgraph.results.PathResults) 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 92 with Thing

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

the class Local_TFL_GetPath_Tests method test_5.

/**
 * Test 5.
 */
@Test
@Order(5)
void test_5() {
    try {
        Thing _this = source.getThing("londontube:Mornington_Crescent");
        PathResults paths = _this.getPaths(":online{1,3}/:hasStationOnLine[eq londontube:Oakleigh_Park]");
        assertEquals("", paths.toString());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
        e.printStackTrace();
    }
}
Also used : PathResults(com.inova8.intelligentgraph.results.PathResults) 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 93 with Thing

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

the class Local_TutorialTests method test_1.

/**
 * Test 1.
 */
@Test
@Order(1)
void test_1() {
    try {
        Repository workingRep = Query.createNativeLuceneIntelligentGraphRepository("src/test/resources/datadir/Local_TutorialTests1/");
        RepositoryConnection conn = workingRep.getConnection();
        conn.setNamespace("", "http://inova8.com/intelligentgraph/example1/");
        conn.setNamespace(XSD.PREFIX, XSD.NAMESPACE);
        conn.setNamespace(RDF.PREFIX, RDF.NAMESPACE);
        conn.setNamespace(RDFS.PREFIX, RDFS.NAMESPACE);
        conn.setNamespace(OWL.PREFIX, OWL.NAMESPACE);
        IntelligentGraphRepository source = IntelligentGraphRepository.create(workingRep);
        source.removeGraph("<http://inova8.com/intelligentgraph/example1>");
        Graph graph = source.addGraph("<http://inova8.com/intelligentgraph/example1>");
        source.removeGraph("<http://inova8.com/intelligentgraph/example1>");
        graph = source.addGraph("<http://inova8.com/intelligentgraph/example1>");
        Thing aPerson = graph.getThing(":aPerson");
        Thing Person = graph.getThing(":Person");
        aPerson.addFact(RDF.TYPE, Person).addFact(":hasHeight", "1.7", XSD.DOUBLE).addFact(":hasWeight", "62", XSD.DOUBLE);
        assertEquals("http://inova8.com/intelligentgraph/example1/aPerson", aPerson.stringValue());
        aPerson.addFact(":hasBMI", "height=_this.getFact(':hasHeight').doubleValue(); _this.getFact(':hasWeight').doubleValue()/(height*height)", SCRIPT.GROOVY);
        assertEquals("   1. Getting facts ':hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "   2. ...within contexts: [http://inova8.com/intelligentgraph/example1]\n" + "         1. Evaluating predicate hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> , by invoking groovy script\n" + "         2. height=_this.getFact(':hasHeight').doubleValue(); _this.getFact(':hasWeight').doubleValue()/(height*height)\n" + "\n" + "               1. Getting facts ':hasHeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "               2. Next fact 'http://inova8.com/intelligentgraph/example1/hasHeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 1.7\n" + "               3. Returned fact ':hasHeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 1.7^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "\n" + "               4. Getting facts ':hasWeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "               5. Next fact 'http://inova8.com/intelligentgraph/example1/hasWeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 62\n" + "               6. Returned fact ':hasWeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 62^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "\n" + "         3. Evaluated hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   3. Calculated hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   4. Retrieved cached value hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   5. Returned fact 'http://inova8.com/intelligentgraph/example1/hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>", aPerson.traceFact(":hasBMI").asText());
        assertEquals("21.453287197231838", aPerson.getFact(":hasBMI").stringValue());
        assertEquals("   1. Getting facts ':hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "   2. ...within contexts: [http://inova8.com/intelligentgraph/example1]\n" + "   3. Retrieved cached value hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   4. Retrieved cached value hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   5. Returned fact 'http://inova8.com/intelligentgraph/example1/hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>", aPerson.traceFact(":hasBMI").asText());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
    }
}
Also used : RepositoryConnection(org.eclipse.rdf4j.repository.RepositoryConnection) Repository(org.eclipse.rdf4j.repository.Repository) IntelligentGraphRepository(com.inova8.intelligentgraph.intelligentGraphRepository.IntelligentGraphRepository) IntelligentGraphRepository(com.inova8.intelligentgraph.intelligentGraphRepository.IntelligentGraphRepository) Graph(com.inova8.intelligentgraph.intelligentGraphRepository.Graph) 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 94 with Thing

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

the class PlantDemoTests method plantIIoTDemo_PathQL.

/**
 * Plant I io T demo path QL.
 */
@Test
@Order(2)
void plantIIoTDemo_PathQL() {
    try {
        source.removeGraph("<http://inova8.com/intelligentgraph/plantdemo/>");
        Graph graph = source.openGraph("<http://inova8.com/intelligentgraph/plantdemo/>");
        Thing unit4 = graph.getThing(":Unit.4");
        Thing feed41 = graph.getThing(":Feed.4.1");
        Thing product41 = graph.getThing(":Product.4.1");
        Thing product42 = graph.getThing(":Product.4.2");
        Thing flare41 = graph.getThing(":Flare.4.1");
        unit4.addFact(":hasFeed", feed41.addFact(":hasVolumeFlow", "_this.getSignal(\"<SEEQ://localhost:34216/api/signals/C8BB6BE4-1CC7-4803-B785-C383ACC31572>\", _customQueryOptions).doubleValue()", SCRIPT.GROOVY).addFact(":hasDensity", "0.85", XSD.DOUBLE));
        unit4.addFact(":hasProduct", product41.addFact(":hasVolumeFlow", "_this.getSignal(\"<SEEQ://localhost:34216/api/signals/1C6EE32D-25D3-4C20-AACD-7C8B2BF44D4F>\", _customQueryOptions).doubleValue()", SCRIPT.GROOVY).addFact(":hasDensity", "0.55", XSD.DOUBLE));
        unit4.addFact(":hasProduct", product42.addFact(":hasVolumeFlow", "_this.getSignal(\"<SEEQ://localhost:34216/api/signals/FF64D48B-B680-43E2-878F-17EA0E8DA3AA>\", _customQueryOptions).doubleValue()", SCRIPT.GROOVY).addFact(":hasDensity", "0.91", XSD.DOUBLE));
        unit4.addFact(":hasProduct", flare41.addFact(":hasVolumeFlow", "_this.getSignal(\"<SEEQ://localhost:34216/api/signals/88A59116-DA7E-467E-B83F-7D2E130ED64D>\", _customQueryOptions).doubleValue()", SCRIPT.GROOVY).addFact(":hasDensity", "0.10", XSD.DOUBLE));
        @SuppressWarnings("unused") Thing massFlow = graph.getThing(":MassFlow").addFact("<http://inova8.com/script/scriptCode>", "_this.getFact(':hasVolumeFlow', _customQueryOptions).doubleValue()* _this.getFact(':hasDensity', _customQueryOptions).doubleValue();", SCRIPT.GROOVY);
        for (com.inova8.intelligentgraph.model.Resource stream : unit4.getFacts(":hasProduct|:hasFeed")) {
            stream.addFact(":hasMassFlow", "<:MassFlow>", SCRIPT.GROOVY);
        }
        unit4.addFact(":totalProduction", "var totalProduction=_this.getFacts(':hasProduct/:hasMassFlow', _customQueryOptions).total(); return totalProduction; ", SCRIPT.GROOVY);
        unit4.addFact(":totalFeed", "var totalFeed= _this.getFacts(':hasFeed/:hasMassFlow', _customQueryOptions).total(); return totalFeed ", SCRIPT.GROOVY);
        unit4.addFact(":massBalance", "_this.getFact(':totalProduction', _customQueryOptions).doubleValue()-_this.getFact(':totalFeed', _customQueryOptions).doubleValue()  ", SCRIPT.GROOVY);
        unit4.addFact(":massBalanceRatio", "_this.getFact(':massBalance', _customQueryOptions).doubleValue()/_this.getFact(':totalFeed', _customQueryOptions).doubleValue()  ", SCRIPT.GROOVY);
        CustomQueryOptions customQueryOptions = new CustomQueryOptions();
        customQueryOptions.add("end", literal("2021-08-02T10:00:00Z", XSD.DATETIMESTAMP));
        assertEquals(42.778, feed41.getFact(":hasVolumeFlow", customQueryOptions).doubleValue());
        assertEquals(27.165, product41.getFact(":hasVolumeFlow", customQueryOptions).doubleValue());
        assertEquals(23.918333333333333, product42.getFact(":hasVolumeFlow", customQueryOptions).doubleValue());
        assertEquals(0.40631, flare41.getFact(":hasVolumeFlow", customQueryOptions).doubleValue());
        assertEquals(36.747064333333334, unit4.getFact(":totalProduction", customQueryOptions).doubleValue());
        assertEquals(36.3613, unit4.getFact(":totalFeed", customQueryOptions).doubleValue());
        assertEquals(0.38576433333333426, unit4.getFact(":massBalance", customQueryOptions).doubleValue());
        assertEquals(0.010609200807818594, unit4.getFact(":massBalanceRatio", customQueryOptions).doubleValue());
        @SuppressWarnings("unused") Thing massYield = graph.getThing(":MassYield").addFact("<http://inova8.com/script/scriptCode>", "_this.getFact(':hasMassFlow', _customQueryOptions).doubleValue()/ _this.getFact('^:hasProduct/:totalProduction', _customQueryOptions).doubleValue();", SCRIPT.GROOVY);
        for (com.inova8.intelligentgraph.model.Resource product : unit4.getFacts(":hasProduct")) {
            product.addFact(":hasMassYield", "<:MassYield>", SCRIPT.GROOVY);
        }
        assertEquals(0.4065834991462765, product41.getFact(":hasMassYield", customQueryOptions).doubleValue());
        String result = Query.runQuery(conn, "PREFIX plantdemo: <http://inova8.com/intelligentgraph/plantdemo/>\r\n" + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#/>\r\n" + "SELECT  ?g ?s ?p ?o ?end {VALUES(?s){(plantdemo:Feed.4.1)(plantdemo:Product.4.1)(plantdemo:Product.4.2)(plantdemo:Flare.4.1)} \r\n" + "                 VALUES(?p){(plantdemo:hasVolumeFlow)} \r\n" + "                 VALUES(?end){(\"2021-08-02T10:00:00Z\"^^xsd:dateTimeStamp)(\"2021-08-03T10:00:00Z\"^^xsd:dateTimeStamp)}\r\n" + "                graph ?g {?s ?p ?o}}");
        assertEquals("p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Feed.4.1;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-02T10:00:00Z;o=42.778;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Feed.4.1;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-03T10:00:00Z;o=42.431666666666665;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Product.4.1;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-02T10:00:00Z;o=27.165;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Product.4.1;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-03T10:00:00Z;o=27.136666666666667;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Product.4.2;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-02T10:00:00Z;o=23.918333333333333;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Product.4.2;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-03T10:00:00Z;o=24.605333333333334;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Flare.4.1;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-02T10:00:00Z;o=0.40631;\r\n" + "p=http://inova8.com/intelligentgraph/plantdemo/hasVolumeFlow;s=http://inova8.com/intelligentgraph/plantdemo/Flare.4.1;g=http://inova8.com/intelligentgraph/plantdemo/;end=2021-08-03T10:00:00Z;o=0.3337;\r\n" + "", result);
    } catch (Exception e) {
        assertEquals("", e.getMessage());
    }
}
Also used : CustomQueryOptions(com.inova8.intelligentgraph.context.CustomQueryOptions) com.inova8.intelligentgraph.model(com.inova8.intelligentgraph.model) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 95 with Thing

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

the class Remote_TutorialTests method test_1.

/**
 * Test 1.
 */
@Test
@Order(1)
void test_1() {
    try {
        IntelligentGraphRepository source = IntelligentGraphRepository.create("http://localhost:8080/rdf4j-server", "tutorial");
        // IntelligentGraphRepository source = IntelligentGraphRepository.create("http://host.docker.internal:8080/rdf4j-server","tutorial");
        source.prefix("<http://inova8.com/intelligentgraph/example1/>");
        source.prefix(RDFS.PREFIX, RDFS.NAMESPACE);
        source.removeGraph("<http://inova8.com/intelligentgraph/example1>");
        Graph graph = source.addGraph("<http://inova8.com/intelligentgraph/example1>");
        Thing aPerson = graph.getThing(":aPerson");
        Thing Person = graph.getThing(":Person");
        aPerson.addFact(RDF.TYPE, Person).addFact(":hasHeight", "1.7", XSD.DOUBLE).addFact(":hasWeight", "62", XSD.DOUBLE);
        assertEquals("http://inova8.com/intelligentgraph/example1/aPerson", aPerson.stringValue());
        aPerson.addFact(":hasBMI", "height=_this.getFact(':hasHeight').doubleValue(); _this.getFact(':hasWeight').doubleValue()/(height*height)", SCRIPT.GROOVY);
        assertEquals("   1. Getting facts ':hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "   2. ...within contexts: [http://inova8.com/intelligentgraph/example1]\n" + "         1. Evaluating predicate hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> , by invoking groovy script\n" + "         2. height=_this.getFact(':hasHeight').doubleValue(); _this.getFact(':hasWeight').doubleValue()/(height*height)\n" + "\n" + "               1. Getting facts ':hasHeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "               2. Next fact 'http://inova8.com/intelligentgraph/example1/hasHeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 1.7\n" + "               3. Returned fact ':hasHeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 1.7^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "\n" + "               4. Getting facts ':hasWeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "               5. Next fact 'http://inova8.com/intelligentgraph/example1/hasWeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 62\n" + "               6. Returned fact ':hasWeight' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 62^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "\n" + "         3. Evaluated hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   3. Calculated hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   4. Retrieved cached value hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   5. Returned fact 'http://inova8.com/intelligentgraph/example1/hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>", aPerson.traceFact(":hasBMI").asText());
        assertEquals("21.453287197231838", aPerson.getFact(":hasBMI").stringValue());
        assertEquals("   1. Getting facts ':hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson>\n" + "   2. ...within contexts: [http://inova8.com/intelligentgraph/example1]\n" + "   3. Retrieved cached value hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   4. Retrieved cached value hasBMI <http://inova8.com/intelligentgraph/example1/hasBMI> of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>\n" + "   5. Returned fact 'http://inova8.com/intelligentgraph/example1/hasBMI' of aPerson <http://inova8.com/intelligentgraph/example1/aPerson> = 21.453287197231838^^double <http://www.w3.org/2001/XMLSchema#double>", aPerson.traceFact(":hasBMI").asText());
    } catch (Exception e) {
        assertEquals("", e.getCause().getMessage());
    }
}
Also used : IntelligentGraphRepository(com.inova8.intelligentgraph.intelligentGraphRepository.IntelligentGraphRepository) Graph(com.inova8.intelligentgraph.intelligentGraphRepository.Graph) 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