/** * {@inheritDoc} */ @Override public URI toEdgeURI(final Object key) { try { final String id = key.toString(); return vf.createURI(EDGE_NAMESPACE, URLEncoder.encode(id, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
@Override public void setUp() throws Exception { super.setUp(); bob = f.createURI(EX_NS, "bob"); }
@Override public void setUp() throws Exception { super.setUp(); // m_repo = new RemoteRepository(m_serviceURL); // Load the test data set. doLoadFile(); bob = f.createURI(EX_NS, "bob"); alice = f.createURI(EX_NS, "alice"); graph1 = f.createURI(EX_NS, "graph1"); graph2 = f.createURI(EX_NS, "graph2"); }
private void populate(int n) throws RepositoryException { ValueFactory vf = con.getValueFactory(); for (int i = 0; i < n; i++) { con.add(vf.createURI("urn:test:root"), vf.createURI("urn:test:hasChild"), vf.createURI("urn:test:node" + i)); } con.add(vf.createURI("urn:test:root"), vf.createURI("urn:test:hasChild"), vf.createURI("urn:test:node-end")); }
public void testBound() { doLoadData(); final ValueFactory vf = om.getValueFactory(); final URI workeruri = vf.createURI("gpo:#123"); IGPO workergpo = om.getGPO(workeruri); final URI worksFor = vf.createURI("attr:/employee#worksFor"); final URI notWorksFor = vf.createURI("attr:/employee#notWorksFor"); assertTrue(workergpo.isBound(worksFor)); assertFalse(workergpo.isBound(notWorksFor)); }
private void setupNamespaces() throws IOException, RDFParseException, RepositoryException { testCon.setNamespace(EXAMPLE, EXAMPLE_NS); testCon.setNamespace(RDF_PREFIX, "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); testCon.setNamespace(RDFS_PREFIX, RDFS_NS); // Translated from earlier RDF document. Is this line even necessary? testCon.add(vf.createURI(EXAMPLE_NS, "Main"), vf.createURI(RDFS_NS, "label"), vf.createLiteral("Main Node")); }
@Override public void setUp() throws Exception { super.setUp(); bob = f.createURI(EX_NS, "bob"); }
public void testStatements() { doLoadData(); final ValueFactory vf = om.getValueFactory(); final URI workeruri = vf.createURI("gpo:#123"); IGPO workergpo = om.getGPO(workeruri); assertTrue(workergpo.getStatements().size() == 6); final URI worksFor = vf.createURI("attr:/employee#worksFor"); workergpo.removeValues(worksFor); assertTrue(workergpo.getStatements().size() == 4); }
private void doDelete(final RepositoryConnection conn, final int loop, final int index) throws RepositoryException { final ValueFactory vf = conn.getValueFactory(); final URI context = vf.createURI("context:loop:" + loop + ":item:" + index); final Collection<Statement> statements = getStatementsForContext(conn, context); for (Statement statement : statements) { conn.remove(statement, context); } }
@Test public void testQueryDefaultGraph() throws Exception { URI graph = vf.createURI("urn:test:default"); testCon.add(vf.createURI(URN_TEST_S1), vf.createURI(URN_TEST_P1), vf.createURI(URN_TEST_O1)); assertThat(size(graph), is(equalTo(0))); testCon.add(vf.createURI("urn:test:s2"), vf.createURI(URN_TEST_P2), vf.createURI("urn:test:o2"), graph); assertThat(size(graph), is(equalTo(1))); }
private void doInsert(final RepositoryConnection conn, final int loop, final int index) throws RepositoryException { final ValueFactory vf = conn.getValueFactory(); final URI c = vf.createURI("context:loop:" + loop + ":item:" + index); final URI s = vf.createURI("subject:loop:" + loop + ":item:" + index); for (int x = 0; x < NUM_STATEMENTS_PER_INSERT; ++x) { final URI p = vf.createURI("predicate:" + x); final Literal o = vf.createLiteral("SomeValue"); conn.add(s, p, o, c); } }
@Test public void testInferredStatementCount() throws Exception { assertThat(testCon.isEmpty(), is(equalTo(true))); int inferred = getTotalStatementCount(testCon); URI root = vf.createURI("urn:root"); testCon.add(root, RDF.TYPE, RDF.LIST); testCon.remove(root, RDF.TYPE, RDF.LIST); assertThat(testCon.isEmpty(), is(equalTo(true))); assertThat(getTotalStatementCount(testCon), is(equalTo(inferred))); }
@Test public void testCreateURI1() throws Exception { URI picasso1 = vf.createURI(EXAMPLE_NS, PICASSO); URI picasso2 = vf.createURI(EXAMPLE_NS + PICASSO); con.begin(); con.addStatement(picasso1, paints, guernica); con.addStatement(picasso2, paints, guernica); con.commit(); assertEquals("createURI(Sring) and createURI(String, String) should create equal URIs", 1, con.size()); }
private void addTripleMap(KR2RMLMapping mapping, Resource mappingRes, Worksheet worksheet, Workspace workspace, TriplesMap trMap) throws RepositoryException { URI trMapUri = f.createURI(Namespaces.KARMA_DEV + trMap.getId()); addTripleMapMetadata(mapping, mappingRes, worksheet, trMap, trMapUri); addSubjectMap(mapping, mappingRes, trMap, trMapUri, workspace); addPredicateObjectMaps(mapping, mappingRes, trMap, trMapUri, workspace, worksheet); }
public void testLoadSilent() throws Exception { final String update = "LOAD SILENT <file:src/test/com/bigdata/rdf/rio/NOT-FOUND.rdf>"; final String ns = "http://bigdata.com/test/data#"; m_repo.prepareUpdate(update).evaluate(); assertFalse(hasStatement(f.createURI(ns, "mike"), RDFS.LABEL, f.createLiteral("Michael Personick"), true)); }
public void testRemoveValues() { doLoadData(); final ValueFactory vf = om.getValueFactory(); final URI workeruri = vf.createURI("gpo:#123"); IGPO workergpo = om.getGPO(workeruri); final URI worksFor = vf.createURI("attr:/employee#worksFor"); assertFalse(workergpo.getLinksOut(worksFor).isEmpty()); assertFalse(workergpo.getValues(worksFor).isEmpty()); workergpo.removeValues(worksFor); assertTrue(workergpo.getValues(worksFor).isEmpty()); assertTrue(workergpo.getLinksOut(worksFor).isEmpty()); }
public void testLinkSetsIn() { doLoadData(); final ValueFactory vf = om.getValueFactory(); final URI clssuri = vf.createURI("gpo:#1"); IGPO clssgpo = om.getGPO(clssuri); final URI linkURI = vf.createURI("attr:/type"); ILinkSet ls = clssgpo.getLinksIn(linkURI); assertTrue(ls.getOwner() == clssgpo); assertTrue(ls.isLinkSetIn()); assertTrue(ls.getLinkProperty().equals(linkURI)); checkLinkSet(ls, 2); }
private void setupNamespaces() throws IOException, RDFParseException, RepositoryException { testCon.setNamespace(EXAMPLE, EXAMPLE_NS); testCon.setNamespace(RDF_PREFIX, "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); testCon.setNamespace(RDFS_PREFIX, RDFS_NS); // Translated from earlier RDF document. Is this line even necessary? testCon.add(vf.createURI(EXAMPLE_NS, "Main"), vf.createURI(RDFS_NS, "label"), vf.createLiteral("Main Node")); }
public void testHashCode() { doLoadData(); final ValueFactory vf = om.getValueFactory(); final URI clssuri = vf.createURI("gpo:#1"); IGPO clssgpo = om.getGPO(clssuri); assertTrue(clssgpo.hashCode() == clssgpo.getId().hashCode()); assertTrue(clssgpo.hashCode() == clssuri.hashCode()); }
@Test public void testCreateURI2() throws Exception { URI picasso1 = vf.createURI(EXAMPLE_NS + PICASSO); URI picasso2 = vf.createURI(EXAMPLE_NS, PICASSO); con.begin(); con.addStatement(picasso1, paints, guernica); con.addStatement(picasso2, paints, guernica); con.commit(); assertEquals("createURI(Sring) and createURI(String, String) should create equal URIs", 1, con.size()); }