/** * Binds the specified variable to the supplied object. Any value that was * previously bound to the specified value will be overwritten. * * @param name * variable name * @param value * datatype or concept implementation */ public void setObject(String name, Object value) { if (value == null) { setBinding(name, null); } else { setBinding(name, manager.getObjectFactory().createValue(value)); } }
/** * Binds the specified variable to the supplied object. Any value that was * previously bound to the specified value will be overwritten. * * @param name * variable name * @param value * datatype or concept implementation */ public void setObject(String name, Object value) { if (value == null) { setBinding(name, null); } else { setBinding(name, manager.getObjectFactory().createValue(value)); } }
/** * Binds the specified variable to the supplied concept. Any value that was * previously bound to the specified value will be overwritten. * * @param name * variable name * @param concept * a registered concept class or interface */ public void setType(String name, Class<?> concept) { URI type = manager.getObjectFactory().getNameOf(concept); if (concept != null && type == null) throw new IllegalArgumentException("Not a registered concept: " + concept); setBinding(name, type); }
/** * Binds the specified variable to the supplied concept. Any value that was * previously bound to the specified value will be overwritten. * * @param name * variable name * @param concept * a registered concept class or interface */ public void setType(String name, Class<?> concept) { URI type = manager.getObjectFactory().getNameOf(concept); if (concept != null && type == null) throw new IllegalArgumentException("Not a registered concept: " + concept); setBinding(name, type); }
/** * Finds a single object of given concept and uri. */ public synchronized <T> T findObject(Class<T> concept, Resource resource) throws RepositoryException, QueryEvaluationException { try { ObjectQuery query = getObjectQuery(concept, 0); query.setBinding("subj", resource); return query.evaluate(concept).next(); } catch (MalformedQueryException e) { throw new AssertionError(e); } }
ObjectQuery query = getObjectQuery(concept, size); if (size == 1) { query.setBinding(ObjectFactory.VAR_PREFIX, resources[0]); } else if (size > 1) { for (int i = 0; i < size; i++) { query.setBinding(ObjectFactory.VAR_PREFIX + i, resources[i]);
ObjectQuery query = getObjectQuery(concept, size); if (size == 1) { query.setBinding(ObjectFactory.VAR_PREFIX, resources[0]); } else if (size > 1) { for (int i = 0; i < size; i++) { query.setBinding(ObjectFactory.VAR_PREFIX + i, resources[i]);
@Override protected synchronized CloseableIteration<?, ?> getObjects() throws RepositoryException, QueryEvaluationException { if (creator == null || factory == null) { return super.getObjects(); } else if (binding == null) { ObjectQuery query = factory.createQuery(creator); if (query == null) return super.getObjects(); try { query.setBinding("self", getResource()); return query.evaluate(creator.getPropertyType()); } finally { factory.returnQuery(creator, query); } } else { CloseableIteratorIteration<BindingSet, QueryEvaluationException> result; result = new CloseableIteratorIteration<BindingSet, QueryEvaluationException>( bindings.iterator()); return new ObjectCursor(getObjectConnection(), result, binding); } }
@Override protected CloseableIteration<?, ?> getObjects() throws RepositoryException, QueryEvaluationException { if (creator == null || factory == null) { return super.getObjects(); } else if (binding == null) { ObjectQuery query = factory.createQuery(creator); if (query == null) return super.getObjects(); try { query.setBinding("self", getResource()); return query.evaluate(creator.getPropertyType()); } finally { factory.returnQuery(creator, query); } } else { CloseableIteratorIteration<BindingSet, QueryEvaluationException> result; result = new CloseableIteratorIteration<BindingSet, QueryEvaluationException>( bindings.iterator()); return new ObjectCursor(getObjectConnection(), result, binding); } }