use of com.inova8.intelligentgraph.results.ResourceResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_GetTraceFact_Tests method test_5.
/**
* Test 5.
*/
@Test
@Order(5)
void test_5() {
try {
IntelligentGraphRepository source = IntelligentGraphRepository.create(workingRep);
source.removeGraph("<http://inova8.com/calc2graph/contextGraph>");
Graph graph = source.addGraph("<http://inova8.com/calc2graph/contextGraph>");
Thing myCountry = graph.getThing(":myCountry");
myCountry.addFact(":myOption", "_customQueryOptions.get(\"time\").integerValue() ;", SCRIPT.GROOVY);
CustomQueryOptions customQueryOptions1 = new CustomQueryOptions();
customQueryOptions1.add("time", 42);
customQueryOptions1.add("name", "Peter");
Thing myCountry1 = graph.getThing(":myCountry");
Trace result = myCountry1.traceFact("<http://inova8.com/calc2graph/def/myOption>", customQueryOptions1);
Query.assertEqualsWOSpaces(// assertEquals
"<olstyle='list-style-type:none;'><li>Gettingfacts'<http://inova8.com/calc2graph/def/myOption>'of<ahref='http://inova8.com/calc2graph/def/myCountry'target='_blank'>myCountry</a></li></li><li>...usingoptions:[name="Peter"&time="42"^^<http://www.w3.org/2001/XMLSchema#int>]</li></li><li>...withincontexts:[file://src/test/resources/calc2graph.def.ttl,http://inova8.com/calc2graph/contextGraph,file://src/test/resources/calc2graph.data.ttl]</li></li><olstyle='list-style-type:none;'><li>Evaluatingpredicate<ahref='http://inova8.com/calc2graph/def/myOption'target='_blank'>myOption</a>of<ahref='http://inova8.com/calc2graph/def/myCountry'target='_blank'>myCountry</a>,byinvoking<b>groovy</b>script</li></li><li><divstyle='border:1pxsolidblack;'><pre><code>_customQueryOptions.get("time").integerValue();</code></pre></div></li><olstyle='list-style-type:none;'></ol><li>Evaluated<ahref='http://inova8.com/calc2graph/def/myOption'target='_blank'>myOption</a>of<ahref='http://inova8.com/calc2graph/def/myCountry'target='_blank'>myCountry</a>=42^^<ahref='http://www.w3.org/2001/XMLSchema#int'target='_blank'>int</a></li></li></ol><li>Calculated<ahref='http://inova8.com/calc2graph/def/myOption'target='_blank'>myOption</a>of<ahref='http://inova8.com/calc2graph/def/myCountry'target='_blank'>myCountry</a>=42^^<ahref='http://www.w3.org/2001/XMLSchema#int'target='_blank'>int</a></li></li><li>Retrievedcachedvalue<ahref='http://inova8.com/calc2graph/def/myOption'target='_blank'>myOption</a>of<ahref='http://inova8.com/calc2graph/def/myCountry'target='_blank'>myCountry</a>=42^^<ahref='http://www.w3.org/2001/XMLSchema#int'target='_blank'>int</a></li></li><li>Returnedfact'http://inova8.com/calc2graph/def/myOption'of<ahref='http://inova8.com/calc2graph/def/myCountry'target='_blank'>myCountry</a>=42^^<ahref='http://www.w3.org/2001/XMLSchema#int'target='_blank'>int</a></li></li><p></ol>", result.asHTML());
CustomQueryOptions customQueryOptions2 = new CustomQueryOptions();
customQueryOptions2.add("time", 43);
result = myCountry1.traceFact("<http://inova8.com/calc2graph/def/myOption>", customQueryOptions2);
Query.assertEqualsWOSpaces(// assertEquals
"1.Gettingfacts'<http://inova8.com/calc2graph/def/myOption>'ofmyCountry<http://inova8.com/calc2graph/def/myCountry>2....usingoptions:[time=\"43\"^^<http://www.w3.org/2001/XMLSchema#int>]3....withincontexts:[file://src/test/resources/calc2graph.def.ttl,http://inova8.com/calc2graph/contextGraph,file://src/test/resources/calc2graph.data.ttl]1.EvaluatingpredicatemyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>,byinvokinggroovyscript2._customQueryOptions.get(\"time\").integerValue();3.EvaluatedmyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=43^^int<http://www.w3.org/2001/XMLSchema#int>4.CalculatedmyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=43^^int<http://www.w3.org/2001/XMLSchema#int>5.RetrievedcachedvaluemyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=43^^int<http://www.w3.org/2001/XMLSchema#int>6.Returnedfact'http://inova8.com/calc2graph/def/myOption'ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=43^^int<http://www.w3.org/2001/XMLSchema#int>", result.asText());
result = myCountry1.traceFact("<http://inova8.com/calc2graph/def/myOption>&time='2019'^^xsd:int");
Query.assertEqualsWOSpaces(// assertEquals
"1.Gettingfacts'<http://inova8.com/calc2graph/def/myOption>&time='2019'^^xsd:int'ofmyCountry<http://inova8.com/calc2graph/def/myCountry>2....withincontexts:[file://src/test/resources/calc2graph.def.ttl,http://inova8.com/calc2graph/contextGraph,file://src/test/resources/calc2graph.data.ttl]1.EvaluatingpredicatemyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>,byinvokinggroovyscript2._customQueryOptions.get(\"time\").integerValue();3.EvaluatedmyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=2019^^int<http://www.w3.org/2001/XMLSchema#int>3.CalculatedmyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=2019^^int<http://www.w3.org/2001/XMLSchema#int>4.RetrievedcachedvaluemyOption<http://inova8.com/calc2graph/def/myOption>ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=2019^^int<http://www.w3.org/2001/XMLSchema#int>5.Returnedfact'http://inova8.com/calc2graph/def/myOption'ofmyCountry<http://inova8.com/calc2graph/def/myCountry>=2019^^int<http://www.w3.org/2001/XMLSchema#int>", result.asText());
ResourceResults results = myCountry1.getFacts("<http://inova8.com/calc2graph/def/myOption>&time='2020'^^xsd:int");
for (Resource result1 : results) {
Query.assertEqualsWOSpaces("2020", result1.stringValue());
}
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.ResourceResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_MultiGraphAddGetFact_Tests method test_10.
/**
* Test 10.
*/
@Test
@Order(10)
void test_10() {
try {
Graph graph1 = source.openGraph("<http://inova8.com/calc2graph/testGraph1>");
Thing myCountry = graph1.getThing(":Country");
String performanceCalculation = "2*3";
myCountry.addFact(":salesPerformance", performanceCalculation, SCRIPT.GROOVY);
ResourceResults results = myCountry.getFacts(":salesPerformance");
for (Resource result : results) {
assertEquals("6", result.getValue().stringValue());
}
source.closeGraph("<http://inova8.com/calc2graph/testGraph1>");
source.removeGraph("<http://inova8.com/calc2graph/testGraph1>");
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
use of com.inova8.intelligentgraph.results.ResourceResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_Eastman3D_GetPath_Tests method test_0.
/**
* Test 0.
*/
@Test
@Order(0)
void test_0() {
try {
Thing _this = source.getThing("eastman.BatteryLimit:Stripper.Bottoms");
//
ResourceResults facts = _this.getFacts("^plant:Transference@plant.TransferenceKind:ProcessFlow{1,3}");
assertEquals("[ {s=http://inova8.com/eastman/id/BatteryLimit/Stripper.Bottoms, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Valve/U8}; {s=http://inova8.com/eastman/id/Valve/U8, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Pump/G103}; {s=http://inova8.com/eastman/id/Pump/G103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Vessel/V103};]", facts.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.ResourceResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_Eastman3D_GetPath_Tests method test_5.
/**
* Test 5.
*/
@Test
@Order(5)
void test_5() {
try {
Thing _this = source.getThing("eastman.Signal:XMEAS17");
//
ResourceResults facts = _this.getFacts("^plant:attribute.providedBy/plant:attribute.of.PlantItem/^plant:Transference@plant.TransferenceKind:ProcessFlow{1,6}/^plant:attribute.of.PlantItem/plant:attribute.providedBy");
assertEquals("[ {s=http://inova8.com/eastman/id/Attribute/U1.valvePosition.XMV8, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMV8}; {s=http://inova8.com/eastman/id/Attribute/V103.level.XMEAS15, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS15}; {s=http://inova8.com/eastman/id/Attribute/V103.temperature.XMEAS18, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS18}; {s=http://inova8.com/eastman/id/Attribute/Stripper.Condensate.volumeFlow.XMEAS14, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS14}; {s=http://inova8.com/eastman/id/Attribute/Stripper.Feed.volumeFlow.XMEAS4, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS4}; {s=http://inova8.com/eastman/id/Attribute/V103.level.XMEAS15, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS15}; {s=http://inova8.com/eastman/id/Attribute/V103.temperature.XMEAS18, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS18}; {s=http://inova8.com/eastman/id/Attribute/Stripper.Condensate.volumeFlow.XMEAS14, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS14}; {s=http://inova8.com/eastman/id/Attribute/Stripper.Feed.volumeFlow.XMEAS4, p=http://inova8.com/plant/def/attribute.providedBy, o=http://inova8.com/eastman/id/Signal/XMEAS4};]", facts.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.ResourceResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_Eastman3D_GetPath_Tests method test_4.
/**
* Test 4.
*/
@Test
@Order(4)
void test_4() {
try {
Thing _this = source.getThing("eastman.Signal:XMEAS17");
//
ResourceResults facts = _this.getFacts("^plant:attribute.providedBy/plant:attribute.of.PlantItem/^plant:Transference@plant.TransferenceKind:ProcessFlow{1,6}");
assertEquals("[ {s=http://inova8.com/eastman/id/BatteryLimit/Stripper.Bottoms, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Valve/U8}; {s=http://inova8.com/eastman/id/Valve/U8, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Pump/G103}; {s=http://inova8.com/eastman/id/Pump/G103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Vessel/V103}; {s=http://inova8.com/eastman/id/Vessel/V103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Boiler/B103}; {s=http://inova8.com/eastman/id/Vessel/V103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/BatteryLimit/Stripper.Condensate}; {s=http://inova8.com/eastman/id/Vessel/V103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/BatteryLimit/Stripper.Feed}; {s=http://inova8.com/eastman/id/Boiler/B103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Vessel/V103}; {s=http://inova8.com/eastman/id/Vessel/V103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/Boiler/B103}; {s=http://inova8.com/eastman/id/Vessel/V103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/BatteryLimit/Stripper.Condensate}; {s=http://inova8.com/eastman/id/Vessel/V103, p=^http://inova8.com/plant/def/Transference@http://inova8.com/plant/def/TransferenceKind/ProcessFlow, o=http://inova8.com/eastman/id/BatteryLimit/Stripper.Feed};]", facts.toString());
// assertEquals("[http://inova8.com/eastman/id/Valve/U8;http://inova8.com/eastman/id/Pump/G103;http://inova8.com/eastman/id/Vessel/V103;http://inova8.com/eastman/id/Boiler/B103;http://inova8.com/eastman/id/BatteryLimit/Stripper.Condensate;http://inova8.com/eastman/id/BatteryLimit/Stripper.Feed;http://inova8.com/eastman/id/Vessel/V103;http://inova8.com/eastman/id/Boiler/B103;http://inova8.com/eastman/id/BatteryLimit/Stripper.Condensate;http://inova8.com/eastman/id/BatteryLimit/Stripper.Feed;]", facts.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
Aggregations