private Binding getBinding(Resource bindingNode) throws GraphUtilException { Literal name = GraphUtil.getUniqueObjectLiteral(graph, bindingNode, VARIABLE); Value value = GraphUtil.getUniqueObject(graph, bindingNode, VALUE); return new SimpleBinding(name.getLabel(), value); } }
private Binding getBinding(Resource bindingNode) throws GraphUtilException { Literal name = GraphUtil.getUniqueObjectLiteral(graph, bindingNode, VARIABLE); Value value = GraphUtil.getUniqueObject(graph, bindingNode, VALUE); return new SimpleBinding(name.getLabel(), value); } }
private Binding getBinding(Resource bindingNode) throws GraphUtilException { Literal name = GraphUtil.getUniqueObjectLiteral(graph, bindingNode, VARIABLE); Value value = GraphUtil.getUniqueObject(graph, bindingNode, VALUE); return new SimpleBinding(name.getLabel(), value); } }
@Override public void endRDF() throws RDFHandlerException { try { Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET); Literal booleanLit = GraphUtil.getUniqueObjectLiteral(graph, resultSetNode, BOOLEAN); if (booleanLit.equals(DAWGTestResultSetSchema.TRUE)) { value = true; } else if (booleanLit.equals(DAWGTestResultSetSchema.FALSE)) { value = false; } else { throw new RDFHandlerException("Invalid boolean value: " + booleanLit); } } catch (GraphUtilException e) { throw new RDFHandlerException(e.getMessage(), e); } } }
@Override public void endRDF() throws RDFHandlerException { try { Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET); Literal booleanLit = GraphUtil.getUniqueObjectLiteral(graph, resultSetNode, BOOLEAN); if (booleanLit.equals(DAWGTestResultSetSchema.TRUE)) { value = true; } else if (booleanLit.equals(DAWGTestResultSetSchema.FALSE)) { value = false; } else { throw new RDFHandlerException("Invalid boolean value: " + booleanLit); } } catch (GraphUtilException e) { throw new RDFHandlerException(e.getMessage(), e); } } }
@Override public void endRDF() throws RDFHandlerException { try { Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET); Literal booleanLit = GraphUtil.getUniqueObjectLiteral(graph, resultSetNode, BOOLEAN); if (booleanLit.equals(DAWGTestResultSetSchema.TRUE)) { value = true; } else if (booleanLit.equals(DAWGTestResultSetSchema.FALSE)) { value = false; } else { throw new RDFHandlerException("Invalid boolean value: " + booleanLit); } } catch (GraphUtilException e) { throw new RDFHandlerException(e.getMessage(), e); } } }
@Test @Category(TestSuites.Prepush.class) public void getRepositoryUsingManager() throws Exception { final Path confDir = Files.createTempDirectory("repomgr"); closeLater(() -> FileUtils.deleteDirectory(confDir.toFile())); RepositoryManager manager = new LocalRepositoryManager(confDir.toFile()); manager.initialize(); closeLater(manager::shutDown); Model graph = parseTurtleGraph(configFile); updateGraphForTestServer(graph); // Cleanup AGRepositoryConfig agConfig = getConfig(graph); deleteLater(agConfig.getRepositoryId(), agConfig.getCatalogId()); Resource node = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RepositoryConfigSchema.REPOSITORY); String id = GraphUtil.getUniqueObjectLiteral(graph, node, RepositoryConfigSchema.REPOSITORYID).stringValue(); RepositoryConfig config = RepositoryConfig.create(graph, node); config.validate(); manager.addRepositoryConfig(config); Repository repo = manager.getRepository(id); repo.initialize(); closeLater(repo::shutDown); Assert.assertEquals(0, repo.getConnection().size()); }