use of com.inova8.intelligentgraph.model.Resource 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.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_GetPath_Tests method test_7.
/**
* Test 7.
*/
@Test
@Order(7)
void test_7() {
try {
Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/Equipment_1"), null);
ResourceResults results = _this.getFacts(":connectedTo{1,3}");
ArrayList<String> resultsArrayList = new ArrayList<String>();
for (Resource result : results) {
resultsArrayList.add(result.stringValue());
}
assertEquals("[http://inova8.com/calc2graph/id/Equipment_2, http://inova8.com/calc2graph/id/Equipment_2_1, http://inova8.com/calc2graph/id/Equipment_3, http://inova8.com/calc2graph/id/Equipment_2_2, http://inova8.com/calc2graph/id/Equipment_4, http://inova8.com/calc2graph/id/Equipment_2_3]", resultsArrayList.toString());
PathResults paths = _this.getPaths(":connectedTo{1,3}");
ArrayList<String> pathArrayList = new ArrayList<String>();
for (Path path : paths) {
pathArrayList.add(path.toString());
}
assertEquals("[Path=[[http://inova8.com/calc2graph/id/Equipment_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2,DIRECT]\r\n" + "]\r\n" + ", Path=[[http://inova8.com/calc2graph/id/Equipment_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2_1,DIRECT]\r\n" + "]\r\n" + ", Path=[[http://inova8.com/calc2graph/id/Equipment_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2,DIRECT]\r\n" + "[http://inova8.com/calc2graph/id/Equipment_2,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_3,DIRECT]\r\n" + "]\r\n" + ", Path=[[http://inova8.com/calc2graph/id/Equipment_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2_1,DIRECT]\r\n" + "[http://inova8.com/calc2graph/id/Equipment_2_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2_2,DIRECT]\r\n" + "]\r\n" + ", Path=[[http://inova8.com/calc2graph/id/Equipment_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2,DIRECT]\r\n" + "[http://inova8.com/calc2graph/id/Equipment_2,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_3,DIRECT]\r\n" + "[http://inova8.com/calc2graph/id/Equipment_3,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_4,DIRECT]\r\n" + "]\r\n" + ", Path=[[http://inova8.com/calc2graph/id/Equipment_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2_1,DIRECT]\r\n" + "[http://inova8.com/calc2graph/id/Equipment_2_1,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2_2,DIRECT]\r\n" + "[http://inova8.com/calc2graph/id/Equipment_2_2,http://inova8.com/calc2graph/def/connectedTo,http://inova8.com/calc2graph/id/Equipment_2_3,DIRECT]\r\n" + "]\r\n" + "]", pathArrayList.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_GetFact_Tests method test_16.
/**
* Test 16.
*/
@Test
@Order(16)
void test_16() {
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/Location_BL2", result.stringValue());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.model.Resource in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_GetFact_Tests method test_4.
/**
* Test 4.
*/
@Test
@Order(4)
void test_4() {
try {
Thing _this = source.getThing(iri("http://inova8.com/calc2graph/id/Unit1"), null);
Resource result = _this.getFact(":massThroughput");
assertEquals("37.99999952316284", result.stringValue());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.model.Resource 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();
}
}
Aggregations