/** * Gets a Triple appropriate for writing to the store. */ private Triple getLocalizedTriple(Triple triple) { try { return _connector.getElementFactory().createTriple( getLocalizedResource(triple.getSubject()), getLocalizedResource(triple.getPredicate()), getLocalizedObject(triple.getObject())); } catch (GraphElementFactoryException e) { throw new RuntimeException("Error localizing triple", e); } }
/** * Gets a Triple appropriate for writing to the store. */ private Triple getLocalizedTriple(Triple triple) { try { return _connector.getElementFactory().createTriple( getLocalizedResource(triple.getSubject()), getLocalizedResource(triple.getPredicate()), getLocalizedObject(triple.getObject())); } catch (GraphElementFactoryException e) { throw new RuntimeException("Error localizing triple", e); } }
/** * Gets a localized URIReference or Literal based on the given Node. */ private ObjectNode getLocalizedObject(Node n) throws GraphElementFactoryException { if (n instanceof URIReference) { return getLocalizedResource(n); } else if (n instanceof Literal) { Literal l = (Literal) n; GraphElementFactory elementFactory = _connector.getElementFactory(); if (l.getDatatypeURI() != null) { return elementFactory.createLiteral(l.getLexicalForm(), l.getDatatypeURI()); } else if (l.getLanguage() != null) { return elementFactory.createLiteral(l.getLexicalForm(), l.getLanguage()); } else { return elementFactory.createLiteral(l.getLexicalForm()); } } else { throw new RuntimeException("Error localizing triple; " + n.getClass().getName() + " is not a URIReference " + "or a Literal"); } }
/** * Gets a localized URIReference or Literal based on the given Node. */ private ObjectNode getLocalizedObject(Node n) throws GraphElementFactoryException { if (n instanceof URIReference) { return getLocalizedResource(n); } else if (n instanceof Literal) { Literal l = (Literal) n; GraphElementFactory elementFactory = _connector.getElementFactory(); if (l.getDatatypeURI() != null) { return elementFactory.createLiteral(l.getLexicalForm(), l.getDatatypeURI()); } else if (l.getLanguage() != null) { return elementFactory.createLiteral(l.getLexicalForm(), l.getLanguage()); } else { return elementFactory.createLiteral(l.getLexicalForm()); } } else { throw new RuntimeException("Error localizing triple; " + n.getClass().getName() + " is not a URIReference " + "or a Literal"); } }