protected Object createInstance(Value value) throws RepositoryException { if (value instanceof Resource) return getObjectConnection().getObject((Resource) value); return getObjectConnection().getObjectFactory().createObject( ((Literal) value)); }
/** * Loads a single Object that is assumed to be of the given concept. */ public <T> T getObject(Class<T> concept, String uri) throws RepositoryException, QueryEvaluationException { assert uri != null; return getObject(concept, getValueFactory().createURI(uri)); }
protected Object createInstance(Value value) throws RepositoryException { if (value instanceof Resource) return getObjectConnection().getObject((Resource) value); return getObjectConnection().getObjectFactory().createObject( ((Literal) value)); }
/** * Loads a single Object by URI in String form. */ public Object getObject(String uri) throws RepositoryException { assert uri != null; return getObject(getValueFactory().createURI(uri)); }
private Object createInstance(Value first) { try { if (first instanceof Resource) return getObjectConnection() .getObject((Resource) first); return getObjectConnection().getObjectFactory() .createObject(((Literal) first)); } catch (RepositoryException e) { throw new ObjectStoreException(e); } } };
/** * Loads a single Object that is assumed to be of the given concept. */ public <T> T getObject(Class<T> concept, String uri) throws RepositoryException, QueryEvaluationException { assert uri != null; return getObject(concept, getValueFactory().createURI(uri)); }
private Object createInstance(Value first) { try { if (first instanceof Resource) return getObjectConnection() .getObject((Resource) first); return getObjectConnection().getObjectFactory() .createObject(((Literal) first)); } catch (RepositoryException e) { throw new ObjectStoreException(e); } } };
/** * Loads a single Object by URI in String form. */ public Object getObject(String uri) throws RepositoryException { assert uri != null; return getObject(getValueFactory().createURI(uri)); }
private Object createRDFObject(Value value, String binding, List<BindingSet> properties) throws QueryEvaluationException { if (value == null) return null; if (value instanceof Literal) return of.createObject((Literal) value); Object obj; if (properties.get(0).hasBinding(binding + "_class")) { Set<URI> list = new HashSet<URI>(properties.size()); for (BindingSet bindings : properties) { Value t = bindings.getValue(binding + "_class"); if (t instanceof URI) { list.add((URI) t); } } obj = manager.getObject(list, (Resource) value); } else { try { obj = manager.getObject(value); } catch (RepositoryException e) { throw new QueryEvaluationException(e); } } if (obj instanceof PropertyConsumer) { ((PropertyConsumer) obj).usePropertyBindings(binding, properties); } return obj; }
private Object createRDFObject(Value value, List<BindingSet> properties) throws QueryEvaluationException { if (value == null) return null; if (value instanceof Literal) return of.createObject((Literal) value); Object obj; if (properties.get(0).hasBinding(binding + "_class")) { Set<URI> list = new HashSet<URI>(properties.size()); for (BindingSet bindings : properties) { Value t = bindings.getValue(binding + "_class"); if (t instanceof URI) { list.add((URI) t); } } obj = manager.getObject(list, (Resource) value); } else { try { obj = manager.getObject(value); } catch (RepositoryException e) { throw new QueryEvaluationException(e); } } if (obj instanceof PropertyConsumer) { ((PropertyConsumer) obj).usePropertyBindings(binding, properties); } return obj; }
private Object createRDFObject(Value value, String binding, List<BindingSet> properties) throws QueryEvaluationException { if (value == null) return null; if (value instanceof Literal) return of.createObject((Literal) value); Object obj; if (properties.get(0).hasBinding(binding + "_class")) { Set<URI> list = new HashSet<URI>(properties.size()); for (BindingSet bindings : properties) { Value t = bindings.getValue(binding + "_class"); if (t instanceof URI) { list.add((URI) t); } } obj = of.createObject((Resource) value, list); } else { try { obj = manager.getObject(value); } catch (RepositoryException e) { throw new QueryEvaluationException(e); } } if (obj instanceof PropertyConsumer) { ((PropertyConsumer) obj).usePropertyBindings(binding, properties); } return obj; }
private Object createRDFObject(Value value, List<BindingSet> properties) throws QueryEvaluationException { if (value == null) return null; if (value instanceof Literal) return of.createObject((Literal) value); Object obj; if (properties.get(0).hasBinding(binding + "_class")) { Set<URI> list = new HashSet<URI>(properties.size()); for (BindingSet bindings : properties) { Value t = bindings.getValue(binding + "_class"); if (t instanceof URI) { list.add((URI) t); } } obj = of.createObject((Resource) value, list); } else { try { obj = manager.getObject(value); } catch (RepositoryException e) { throw new QueryEvaluationException(e); } } if (obj instanceof PropertyConsumer) { ((PropertyConsumer) obj).usePropertyBindings(binding, properties); } return obj; }
private Object[] loadBlock(int b) throws RepositoryException, QueryEvaluationException { TupleQuery query = createBlockQuery(b); TupleQueryResult result = query.evaluate(); BindingSet bindings = result.next(); ObjectConnection con = getObjectConnection(); Object[] list = new Object[BSIZE]; while (bindings != null) { URI pred = (URI) bindings.getValue("pred"); int idx = getIndex(pred); Value value = bindings.getValue("value"); Set<URI> types = new HashSet<URI>(4); do { Value c = bindings.getValue("value_class"); if (c instanceof URI) { types.add((URI) c); } bindings = result.hasNext() ? result.next() : null; } while (bindings != null && pred.equals(bindings.getValue("pred"))); int i = idx % BSIZE; if (value instanceof Literal) { list[i] = con.getObject((Literal) value); } else { list[i] = con.getObject(types, (Resource) value); } } return list; }