public org.openrdf.model.Value getRDFNode() { return new URIReferenceImpl(uri); }
public void execute(OperationContext operationContext, SystemResolver systemResolver, DatabaseMetadata metadata) throws Exception { try { long model = systemResolver.lookupPersistent(new URIReferenceImpl(modelURI)); result = systemResolver.modelExists(model); } catch (LocalizeException le) { result = false; } }
public URI mapToModelTypeURI(URI modelURI) throws QueryException { try { if (logger.isDebugEnabled()) logger.debug("Finding modelTypeURI for " + modelURI); long rawModel = systemResolver.localize(new URIReferenceImpl(modelURI)); long canModel = getCanonicalModel(rawModel); URI modelTypeURI = findModelTypeURI(canModel); if (logger.isDebugEnabled()) { logger.debug("Mapped " + modelURI + " via " + rawModel + ":" + canModel + " to ModelTypeURI: " + modelTypeURI); } return modelTypeURI; } catch (GlobalizeException eg) { throw new QueryException("Failed to map model to modelType", eg); } catch (LocalizeException el) { throw new QueryException("Failed to map model to modelType", el); } }
/** * Change a model's presence in the system model (<code>#</code>). * * @param model the model to add or remove * @param present whether to add or remove the model from the system model * @throws ResolverException if the system model wasn't updated */ private void setModelPresenceInSystemModel(long model, URI modelTypeURI, boolean present) throws ResolverException, LocalizeException { // Check whether we're capable of system model operations if (systemResolver == null) { throw new ResolverException("Resolver created without a system model"); } setModelPresenceInSystemModel(model, resolverSession.localizePersistent(new URIReferenceImpl(modelTypeURI)), present); }
assert isAbsolute(uri) : uri + " is not absolute"; return new URIReferenceImpl(uri);
) throws Exception { URI modelValue = new URIReferenceImpl(modelURI); LocalNode modelNode = new LocalNode( session.lookupPersistent(modelValue)
long sourceModel = systemResolver.localize(new URIReferenceImpl(srcModelURI)); long destinationModel = systemResolver.localize(new URIReferenceImpl(destModelURI));
protected void doModify(URI modelURI, Statements statements, boolean insert) throws Throwable { long model = systemResolver.localize(new URIReferenceImpl(modelURI)); model = getCanonicalModel(model); // Make sure security adapters are satisfied for (SecurityAdapter securityAdapter: securityAdapterList) { // Lie to the user if (!securityAdapter.canSeeModel(model, systemResolver)) { throw new QueryException("No such model " + modelURI); } // Tell the truth to the user if (!securityAdapter.canModifyModel(model, systemResolver)) { throw new QueryException("You aren't allowed to modify " + modelURI); } } // Obtain a resolver for the destination model type Resolver resolver = obtainResolver(findModelResolverFactory(model)); assert resolver != null; if (logger.isDebugEnabled()) { logger.debug("Modifying " + modelURI + " using " + resolver); } resolver.modifyModel(model, statements, insert); if (logger.isDebugEnabled()) { logger.debug("Modified " + modelURI); } }
boolean insert) throws Exception long model = systemResolver.localize(new URIReferenceImpl(modelURI)); model = operationContext.getCanonicalModel(model);
/** * Convert a URI to a URIReference which refers to the canonical local machine name. * * @param uri The URI to update. * @return The URIReference representing the same URI as the parameter, with the host name updated. * @throws QueryException When the uri cannot be manipulated. */ private Value getLocalURI(URI uri) throws QueryException { // use the system model to find the local host name String newHost = getHost(metadata.getSystemModelURI()); // update the URI try { URI newModelURI = createURI(getScheme(uri), newHost, getPath(uri), getFragment(uri)); logger.debug("Changing model URI from " + uri + " to " + newModelURI); return new URIReferenceImpl(newModelURI); } catch (Exception e) { throw new QueryException("Internal error. Model URI cannot be manipulated."); } }
new URIReferenceImpl(databaseMetadata.getSystemModelURI())); long rdfType = systemResolver.localizePersistent( new URIReferenceImpl(databaseMetadata.getRdfTypeURI())); long modelType = systemResolver.localizePersistent( new URIReferenceImpl(databaseMetadata.getSystemModelTypeURI())); new URIReferenceImpl(databaseMetadata.getPreallocationSubjectURI())); long prePredicate = systemResolver.localizePersistent( new URIReferenceImpl(databaseMetadata.getPreallocationPredicateURI())); long preModel = systemResolver.localizePersistent( new URIReferenceImpl(databaseMetadata.getPreallocationModelURI()));
DatabaseMetadata metadata) throws Exception long model = systemResolver.localize(new URIReferenceImpl(modelURI)); model = operationContext.getCanonicalModel(model);
localize(new URIReferenceImpl(modelResource.getURI())), localized);
long graph = systemResolver.localizePersistent(new URIReferenceImpl(graphURI)); assert graph != NodePool.NONE; try { URIReferenceImpl existing = (URIReferenceImpl)eNode; if (!new URIReferenceImpl(graphTypeURI).equals(existing)) { throw new QueryException(graphURI + " already exists with model type " + existing + " in attempt to create it with type " + graphTypeURI);