/** * {@inheritDoc} */ @Override public RDFReader getReader(String lang) { return super.object.getReader(lang); }
/** * {@inheritDoc} */ @Override public RDFReader getReader() { return super.object.getReader(); }
public RDFReader getReader() { return model.getReader(); }
public RDFReader getReader(String lang) { return model.getReader(lang); }
/** * Loads all of the resource maps and returns a unified Model of their contents. This method starts by loading the * resource map located at {@code resourceMapUri} (resolved against {@code baseDir}). Then, every resource * referenced by the {@code <ore:isDescribedBy rdf:resource="file:///...."/>} predicate is resolved and loaded * recursively. * <p/> * If a package named {@code my-bag.tar.gz} is unpacked to {@code /storage/bags/my-bag}, then the base directory * parameter should be {@code /storage/bags}. If the resource map is located at * {@code /storage/bags/my-bag/ORE-REM/rem.xml}, then the {@code resourceMapUri} should be * {@code file:///my-bag/ORE-REM/rem.xml}. * * @param resourceMapUri the resource map URI of the package (from {@link #getPackageResourceMapURI(org.dataconservancy.packaging.ingest.api.AttributeSetManager)}) * @param baseDir the base directory of the package in the file system * @return a unified Model, composed of all of the ORE resource maps in the package * @throws StatefulIngestServiceException */ public static Model loadRems(URI resourceMapUri, File baseDir) throws PackageException { List<String> loadedRems = new ArrayList<String>(); loadedRems.add(resourceMapUri.toString()); Model m = ModelFactory.createDefaultModel(); ResourceMapUtil.loadRDF(m.getReader(), m, baseDir, resourceMapUri.toString()); LOG.debug("Loaded ReM file {}", resourceMapUri); m = load(m, baseDir, loadedRems); return m; }
/** * Loads all of the resource maps and returns a unified Model of their contents. This method starts by loading the * resource map located at {@code resourceMapUri} (resolved against {@code baseDir}). Then, every resource * referenced by the {@code <ore:isDescribedBy rdf:resource="file:///...."/>} predicate is resolved and loaded * recursively. * <p/> * If a package named {@code my-bag.tar.gz} is unpacked to {@code /storage/bags/my-bag}, then the base directory * parameter should be {@code /storage/bags}. If the resource map is located at * {@code /storage/bags/my-bag/ORE-REM/rem.xml}, then the {@code resourceMapUri} should be * {@code file:///my-bag/ORE-REM/rem.xml}. * * @param resourceMapUri the resource map URI of the package (from {@link #getPackageResourceMapURI(org.dataconservancy.packaging.ingest.api.AttributeSetManager)}) * @param baseDir the base directory of the package in the file system * @return a unified Model, composed of all of the ORE resource maps in the package * @throws StatefulIngestServiceException */ public static Model loadRems(URI resourceMapUri, File baseDir) throws PackageException { List<String> loadedRems = new ArrayList<String>(); loadedRems.add(resourceMapUri.toString()); Model m = ModelFactory.createDefaultModel(); ResourceMapUtil.loadRDF(m.getReader(), m, baseDir, resourceMapUri.toString()); LOG.debug("Loaded ReM file {}", resourceMapUri); m = load(m, baseDir, loadedRems); return m; }
Model m = ModelFactory.createDefaultModel(); String base = in ; RDFReader rdr = m.getReader(inlang); for (j = 1; j < lastInProp; j++) { int eq = args[j].indexOf("=");
RDFReader reader = loaded.getReader(); reader.setProperty(ResourceMapConstants.JENA_ERROR_MODE_URI, ResourceMapConstants.JENA_ERROR_MODE_STRICT); ResourceMapUtil.loadRDF(reader, loaded, baseDir, rdfUri);
RDFReader reader = loaded.getReader(); reader.setProperty(ResourceMapConstants.JENA_ERROR_MODE_URI, ResourceMapConstants.JENA_ERROR_MODE_STRICT); ResourceMapUtil.loadRDF(reader, loaded, baseDir, rdfUri);
/** * Create a new session using properties specified in the context. * * @param ctx * The context creating this session object. * The context contains all the configuration settings for this object. * @param args * Runtime session arguments. */ protected RdfParserSession(RdfParser ctx, ParserSessionArgs args) { super(ctx, args); this.ctx = ctx; model = ModelFactory.createDefaultModel(); addModelPrefix(ctx.getJuneauNs()); addModelPrefix(ctx.getJuneauBpNs()); pRoot = model.createProperty(ctx.getJuneauNs().getUri(), RDF_juneauNs_ROOT); pValue = model.createProperty(ctx.getJuneauNs().getUri(), RDF_juneauNs_VALUE); pType = model.createProperty(ctx.getJuneauBpNs().getUri(), RDF_juneauNs_TYPE); pRdfType = model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); rdfReader = model.getReader(ctx.getRdfLanguage()); // Note: NTripleReader throws an exception if you try to set any properties on it. if (! ctx.getRdfLanguage().equals(LANG_NTRIPLE)) { for (Map.Entry<String,Object> e : ctx.jenaSettings.entrySet()) rdfReader.setProperty(e.getKey(), e.getValue()); } }
private void checkAndLoad(Resource resmap, File base_dir, Model model) throws PackageValidationException { RDFReader reader = model.getReader(); reader.setProperty(JENA_ERROR_MODE_URI, JENA_ERROR_MODE_STRICT); SimpleRDFErrorHandler handler = new SimpleRDFErrorHandler(); reader.setErrorHandler(handler); try { ResourceMapUtil.loadRDF(reader, model, base_dir, resmap.getURI()); } catch (PackageException e) { throw new PackageValidationException(e); } if (!handler.isErrorFree()) { throw new PackageValidationException("Error loading resource map " + resmap + ": " + handler.getErrorDetails()); } }
RDFReader reader = state.model.getReader(); reader.setProperty(JENA_ERROR_MODE_URI, JENA_ERROR_MODE_STRICT);
private static Model readModel(String uri) { Graph g = Factory.createGraphMem(); // Use the mapped uri as the syntax hint. String syntax = null; { String altURI = FileManager.get().mapURI(uri); if (altURI != null) syntax = FileUtils.guessLang(uri); } // Temporary model wrapper Model m = ModelFactory.createModelForGraph(g); RDFReader r = m.getReader(syntax); InputStream in = FileManager.get().open(uri); if (in == null) // Not found. throw new NotFoundException("Not found: " + uri); r.read(m, in, uri); return m; }