private Binding getBinding(Resource bindingNode) throws GraphUtilException { Literal name = GraphUtil.getUniqueObjectLiteral(graph, bindingNode, VARIABLE); Value value = GraphUtil.getUniqueObject(graph, bindingNode, VALUE); return new SimpleBinding(name.getLabel(), value); } }
/** * Utility method that casts the return value of * {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} to a Literal, or throws a GraphUtilException * if that value is not a Literal. * * @return The object of the matched statement(s). * @throws GraphUtilException * If such an exception is thrown by {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} or * if its return value is not a Literal. * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...) } and * {@link Model#objectLiteral() } instead. */ @Deprecated public static Literal getUniqueObjectLiteral(Graph graph, Resource subj, IRI pred) throws GraphUtilException { Value obj = getUniqueObject(graph, subj, pred); if (obj instanceof Literal) { return (Literal)obj; } else { throw new GraphUtilException("Expected literal for property " + pred); } }
private Binding getBinding(Resource bindingNode) throws GraphUtilException { Literal name = GraphUtil.getUniqueObjectLiteral(graph, bindingNode, VARIABLE); Value value = GraphUtil.getUniqueObject(graph, bindingNode, VALUE); return new SimpleBinding(name.getLabel(), value); } }
/** * Utility method that casts the return value of * {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} to a Resource, or throws a * GraphUtilException if that value is not a Resource. * * @return The object of the matched statement(s). * @throws GraphUtilException * If such an exception is thrown by {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} or * if its return value is not a Resource. * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...) } and * {@link Model#objectResource() } instead. */ @Deprecated public static Resource getUniqueObjectResource(Graph graph, Resource subj, IRI pred) throws GraphUtilException { Value obj = getUniqueObject(graph, subj, pred); if (obj instanceof Resource) { return (Resource)obj; } else { throw new GraphUtilException("Expected URI or blank node for property " + pred); } }
private Binding getBinding(Resource bindingNode) throws GraphUtilException { Literal name = GraphUtil.getUniqueObjectLiteral(graph, bindingNode, VARIABLE); Value value = GraphUtil.getUniqueObject(graph, bindingNode, VALUE); return new SimpleBinding(name.getLabel(), value); } }
/** * Utility method that casts the return value of * {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} to a URI, or throws a GraphUtilException if * that value is not a URI. * * @return The object of the matched statement(s). * @throws GraphUtilException * If such an exception is thrown by {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} or * if its return value is not a URI. * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...) } and * {@link Model#objectIRI() } instead. */ @Deprecated public static IRI getUniqueObjectURI(Graph graph, Resource subj, IRI pred) throws GraphUtilException { Value obj = getUniqueObject(graph, subj, pred); if (obj instanceof IRI) { return (IRI)obj; } else { throw new GraphUtilException("Expected URI for property " + pred); } }
/** * Utility method that casts the return value of * {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} to a Literal, or throws a GraphUtilException * if that value is not a Literal. * * @return The object of the matched statement(s). * @throws GraphUtilException * If such an exception is thrown by {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} or * if its return value is not a Literal. * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...) } and * {@link Model#objectLiteral() } instead. */ @Deprecated public static Literal getUniqueObjectLiteral(Graph graph, Resource subj, IRI pred) throws GraphUtilException { Value obj = getUniqueObject(graph, subj, pred); if (obj instanceof Literal) { return (Literal)obj; } else { throw new GraphUtilException("Expected literal for property " + pred); } }
/** * Utility method that casts the return value of * {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} to a Resource, or throws a * GraphUtilException if that value is not a Resource. * * @return The object of the matched statement(s). * @throws GraphUtilException * If such an exception is thrown by {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} or * if its return value is not a Resource. * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...) } and * {@link Model#objectResource() } instead. */ @Deprecated public static Resource getUniqueObjectResource(Graph graph, Resource subj, IRI pred) throws GraphUtilException { Value obj = getUniqueObject(graph, subj, pred); if (obj instanceof Resource) { return (Resource)obj; } else { throw new GraphUtilException("Expected URI or blank node for property " + pred); } }
/** * Utility method that casts the return value of * {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} to a URI, or throws a GraphUtilException if * that value is not a URI. * * @return The object of the matched statement(s). * @throws GraphUtilException * If such an exception is thrown by {@link #getUniqueObject(Graph, Resource, IRI, Resource[])} or * if its return value is not a URI. * @deprecated since 2.8.0. Use {@link Model#filter(Resource, IRI, Value, Resource...) } and * {@link Model#objectIRI() } instead. */ @Deprecated public static IRI getUniqueObjectURI(Graph graph, Resource subj, IRI pred) throws GraphUtilException { Value obj = getUniqueObject(graph, subj, pred); if (obj instanceof IRI) { return (IRI)obj; } else { throw new GraphUtilException("Expected URI for property " + pred); } }