Models { public static Optional<Literal> getPropertyLiteral(Model m, Resource subject, IRI property, Resource... contexts) { Objects.requireNonNull(m, "model may not be null"); Objects.requireNonNull(subject, "subject may not be null"); Objects.requireNonNull(property, "property may not be null"); return objectLiteral(m.getStatements(subject, property, null, contexts)); } protected  Models(); static Optional<Value> object(Iterable<Statement> statements); static Optional<Value> object(Model m); static Optional<Literal> objectLiteral(Iterable<Statement> statements); static Optional<Literal> objectLiteral(Model m); static Set<Literal> objectLiterals(Iterable<Statement> statements); static Set<Literal> objectLiterals(Model m); static Optional<Resource> objectResource(Iterable<Statement> statements); static Optional<Resource> objectResource(Model m); static Set<Resource> objectResources(Iterable<Statement> statements); static Set<Resource> objectResources(Model m); static Optional<IRI> objectIRI(Iterable<Statement> statements); static Optional<IRI> objectIRI(Model m); static Set<IRI> objectIRIs(Iterable<Statement> statements); static Set<IRI> objectIRIs(Model m); static Optional<String> objectString(Iterable<Statement> statements); static Optional<String> objectString(Model m); static Set<String> objectStrings(Iterable<Statement> statements); static Set<String> objectStrings(Model m); static Optional<Resource> subject(Iterable<Statement> statements); static Optional<Resource> subject(Model m); static Optional<IRI> subjectIRI(Iterable<Statement> statements); static Optional<IRI> subjectIRI(Model m); static Set<IRI> subjectIRIs(Iterable<Statement> statements); static Set<IRI> subjectIRIs(Model m); static Optional<BNode> subjectBNode(Iterable<Statement> statements); static Optional<BNode> subjectBNode(Model m); static Set<BNode> subjectBNodes(Iterable<Statement> statements); static Set<BNode> subjectBNodes(Model m); static Optional<IRI> predicate(Iterable<Statement> statements); static Optional<IRI> predicate(Model m); static Model setProperty(Model m, Resource subject, IRI property, Value value, Resource... contexts); static Optional<Value> getProperty(Model m, Resource subject, IRI property, Resource... contexts); static Set<Value> getProperties(Model m, Resource subject, IRI property, Resource... contexts); static Optional<Resource> getPropertyResource(Model m, Resource subject, IRI property,
			Resource... contexts); static Set<Resource> getPropertyResources(Model m, Resource subject, IRI property, Resource... contexts); static Optional<IRI> getPropertyIRI(Model m, Resource subject, IRI property, Resource... contexts); static Set<IRI> getPropertyIRIs(Model m, Resource subject, IRI property, Resource... contexts); static Optional<Literal> getPropertyLiteral(Model m, Resource subject, IRI property, Resource... contexts); static Set<Literal> getPropertyLiterals(Model m, Resource subject, IRI property, Resource... contexts); static Optional<String> getPropertyString(Model m, Resource subject, IRI property, Resource... contexts); static Set<String> getPropertyStrings(Model m, Resource subject, IRI property, Resource... contexts); static boolean isomorphic(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2); static boolean isSubset(Iterable<? extends Statement> model1, Iterable<? extends Statement> model2); static boolean isSubset(Set<? extends Statement> model1, Set<? extends Statement> model2); static Model stripContexts(Model model, Resource... contexts); static Supplier<ModelException> modelException(String message); static Model synchronizedModel(Model toSynchronize); @Experimental static void convertRDFStarToReification(ValueFactory vf, Model model, Consumer<Statement> consumer); @Experimental static void convertRDFStarToReification(Model model, Consumer<Statement> consumer); @Experimental static Model convertRDFStarToReification(ValueFactory vf, Model model); @Experimental static Model convertRDFStarToReification(ValueFactory vf, Model model, ModelFactory modelFactory); @Experimental static Model convertRDFStarToReification(Model model); @Experimental static void convertReificationToRDFStar(ValueFactory vf, Model model, Consumer<Statement> consumer); @Experimental static void convertReificationToRDFStar(Model model, Consumer<Statement> consumer); @Experimental static Model convertReificationToRDFStar(ValueFactory vf, Model model, ModelFactory modelFactory); @Experimental static Model convertReificationToRDFStar(ValueFactory vf, Model model); @Experimental static Model convertReificationToRDFStar(Model model);  }
@Test public void testGetPropertyLiteral() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); Literal l = Models.getPropertyLiteral(model1, foo, bar).orElse(null); assertNotNull(l); assertEquals(lit1, l); }
@Test public void testGetPropertyLiteral2() { model1.add(foo, bar, foo); Optional<Literal> l = Models.getPropertyLiteral(model1, foo, bar); assertEquals(Optional.empty(), l); }