use of com.tinkerpop.blueprints.impls.sail.SailGraph in project frames by tinkerpop.
the class SailFramesTest method setUp.
@Before
public void setUp() throws Exception {
sail = new MemoryStore();
sailGraph = new SailGraph(sail);
}
use of com.tinkerpop.blueprints.impls.sail.SailGraph in project frames by tinkerpop.
the class SailFramesTest method testAll.
@Test
public void testAll() throws Exception {
URI planet = new URIImpl("http://example.org/terms/planet");
URI gasGiant = new URIImpl("http://example.org/terms/gasGiant");
URI narrower = new URIImpl("http://www.w3.org/2004/02/skos/core#narrower");
SailConnection sc = sail.getConnection();
try {
sc.begin();
sc.addStatement(planet, RDFS.LABEL, new LiteralImpl("planet", "en"));
sc.addStatement(gasGiant, RDFS.LABEL, new LiteralImpl("gas giant", "en"));
sc.addStatement(planet, narrower, gasGiant);
sc.commit();
} finally {
sc.close();
}
Vertex p = sailGraph.getVertex(planet.stringValue());
FramedGraph<SailGraph> framedGraph = new FramedGraphFactory().create(sailGraph);
Concept planetFrame = framedGraph.frame(p, Concept.class);
assertNotNull(planetFrame);
assertEquals("uri", planetFrame.getKind());
//assertEquals("...", planetFrame.getValue());
RDFFrame label = planetFrame.getLabel();
assertNotNull(label);
assertEquals("literal", label.getKind());
assertEquals("en", label.getLang());
assertEquals("planet", label.getValue());
Iterable<Concept> narrowerConcepts = planetFrame.getNarrower();
int counter = 0;
for (Concept c : narrowerConcepts) {
counter++;
}
assertEquals(counter, 1);
Concept gasGiantFrame = narrowerConcepts.iterator().next();
label = gasGiantFrame.getLabel();
assertEquals("literal", label.getKind());
assertEquals("en", label.getLang());
assertEquals("gas giant", label.getValue());
}
Aggregations