@Override protected BNode getAnonymousNode(Object key) { BNode node = bnodeMap.get(key); if (node == null) { node = rdfFactory.createBNode(); bnodeMap.put(key, node); } return node; }
private Resource createResource(String resource) { // Blank node without any given identifier if (resource.equals("_:")) { return vf.createBNode(); } else if (resource.startsWith("_:")) { return vf.createBNode(resource.substring(2)); } else { return vf.createURI(resource); } }
@Override public BNode getBNode(BID bid) { BNode bnode = bnodeCache.get(bid); if (bnode == null) { bnode = vf.createBNode(bid.getId()); bnodeCache.put(bid, bnode); bidCache.put(bnode, bid); } return bnode; }
@Override public BNode getBNode(BID bid) { BNode bnode = bnodeCache.get(bid); if (bnode == null) { bnode = vf.createBNode(bid.getId()); bnodeCache.put(bid, bnode); bidCache.put(bnode, bid); } return bnode; }
@Override public BNode createBlankNode() { return this.repository.getValueFactory().createBNode(); }
private static org.openrdf.model.Resource stringToResource(String resource, ValueFactory vf) { if(resource.startsWith("_:")) { return vf.createBNode(resource.substring(2)); } else { return vf.createURI(resource); } } }
private static Resource createResource(String str) { if (str.startsWith("_")) { return VALUE_FACTORY.createBNode(str.substring(2)); } return VALUE_FACTORY.createURI(str); }
private void addAll(List<? extends Value> list) { if (start == null) { start = vf.createBNode(); } for (Value element : list) { addTo((Resource) start, element); } }
@Override public ValueConstant visit(ASTBNode node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createBNode(node.getID())); }
/** * Creates an anonymous object with no rdf:type. */ public RDFObject createObject() { if (connection == null) throw new IllegalStateException("No ObjectConnection"); BNode node = connection.getValueFactory().createBNode(); return createBean(node, resolver.resolveBlankEntity()); }
private BNode mapBNode(BNode bNode) { BNode result = bNodesMap.get(bNode.getID()); if (result == null) { result = con.getRepository().getValueFactory().createBNode(); bNodesMap.put(bNode.getID(), result); } return result; }
private void addLogicalSource(KR2RMLMapping mapping, Worksheet worksheet, Resource mappingRes, URI trMapUri) throws RepositoryException { // Add the Logical table information BNode logTableBNode = f.createBNode(); con.add(logTableBNode, repoURIs.get(Uris.RR_TABLENAME_URI), f.createLiteral(worksheet.getTitle())); con.add(logTableBNode, RDF.TYPE, repoURIs.get(Uris.RR_LOGICAL_TABLE_CLASS_URI)); con.add(logTableBNode, repoURIs.get(Uris.KM_IS_PART_OF_MAPPING_URI), mappingRes); con.add(mappingRes, repoURIs.get(Uris.KM_HAS_LOGICAL_TABLE_URI), logTableBNode); con.add(trMapUri, repoURIs.get(Uris.RR_LOGICAL_TABLE_URI), logTableBNode); }
@Test public void testValueRoundTrip2() throws Exception { BNode subj = vf.createBNode(); URI pred = new URIImpl(EXAMPLE_NS + PAINTS); URI obj = new URIImpl(EXAMPLE_NS + GUERNICA); testValueRoundTrip(subj, pred, obj); }
private void addImplementation(Collection<String> members, Model graph, BNode fedRepoNode, RepositoryConnection con, boolean readonly, boolean distinct) throws OpenRDFException, MalformedURLException { BNode implRoot = valueFactory.createBNode(); addToGraph(graph, fedRepoNode, RepositoryConfigSchema.REPOSITORYIMPL, implRoot); addToGraph(graph, implRoot, RepositoryConfigSchema.REPOSITORYTYPE, valueFactory.createLiteral(SailRepositoryFactory.REPOSITORY_TYPE)); addSail(members, graph, implRoot, con, readonly, distinct); }
public V asValue(final LexiconRelation lex) { V bnode = getValueCache(); if (bnode == null) { final ValueFactory f = lex.getValueFactory(); bnode = (V) f.createBNode(stringValue()); bnode.setIV(this); setValue(bnode); } return bnode; }
@Override public void meet(ProjectionElemList node) throws RDFHandlerException { Resource elemListBNode = valueFactory.createBNode(); handler.handleStatement( valueFactory.createStatement(subject, SP.RESULT_VARIABLES_PROPERTY, elemListBNode)); ListContext ctx = newList(elemListBNode); super.meet(node); endList(ctx); }
public V asValue(final LexiconRelation lex) { V bnode = getValueCache(); if (bnode == null) { final ValueFactory f = lex.getValueFactory(); bnode = (V) f.createBNode(stringValue()); bnode.setIV(this); setValue(bnode); } return bnode; }
@Override public void meet(InsertData node) throws RDFHandlerException { Resource dataList = valueFactory.createBNode(); handler.handleStatement(valueFactory.createStatement(subject, SP.DATA_PROPERTY, dataList)); ListContext dataCtx = newList(dataList); renderDataBlock(node.getDataBlock()); endList(dataCtx); }
public RdbmsResource getRdbmsResource(Number num, String stringValue) { assert stringValue != null : "Null stringValue for ID: " + num; Number id = ids.idOf(num); if (ids.isURI(id)) return new RdbmsURI(id, uris.getIdVersion(), vf.createURI(stringValue)); return new RdbmsBNode(id, bnodes.getIdVersion(), vf.createBNode(stringValue)); }
@Test public void testValueRoundTrip2() throws Exception { BNode subj = vf.createBNode(); URI pred = new URIImpl(EXAMPLE_NS + PAINTS); URI obj = new URIImpl(EXAMPLE_NS + GUERNICA); testValueRoundTrip(subj, pred, obj); }