/** @see org.mulgara.resolver.spi.Statements#getObject() */ @Override public long getObject() throws TuplesException { ObjectNode o = currentRow.getObject(); try { return session.localize(o); } catch (LocalizeException e) { throw new TuplesException("Unable to localize object: " + o); } }
/** * Populates the namespaces map with default namespaces and namespaces used by the graph. * * @param graph Graph * @throws GraphException */ protected void populateNamespaces(Graph graph) throws GraphException { // default namespaces namespaces = new HashMap<String, String>(); namespaces.put(RDF_PREFIX, RDF.BASE_URI.toString()); namespaces.put(RDFS_PREFIX, RDFS.BASE_URI.toString()); namespaces.put("owl", "http://www.w3.org/2002/07/owl#"); namespaces.put("dc", "http://purl.org/dc/elements/1.1/"); // validate graph before reading if (graph == null) { throw new IllegalArgumentException("Graph argument is null."); } // get all statements ClosableIterator<Triple> tripleIter = graph.find(null, null, null); if (tripleIter != null) { while (tripleIter.hasNext()) { // get the next triple Triple triple = tripleIter.next(); if (triple != null) { // evaluate subject SubjectNode subject = triple.getSubject(); if (subject instanceof URIReference) { addNamespaceURI(((URIReference) subject).getURI()); } // evaluate predicate (must be URIReference) PredicateNode predicate = triple.getPredicate(); addNamespaceURI(((URIReference) predicate).getURI()); // evaluate object ObjectNode object = triple.getObject(); if (object instanceof URIReference) { addNamespaceURI(((URIReference) object).getURI()); } } } // close the Iterator tripleIter.close(); } }