/** * Get the label for the predicate. * * @return the predicate label */ public String getPredicateLabel() { if (nonNull(predLabel)) { return predLabel; } return getPredicate(); }
@Test public void testOrdinaryLabelledTriple() { final Triple triple = rdf.createTriple( rdf.createIRI("test:value"), DC.title, rdf.createLiteral("A title")); final LabelledTriple t = new LabelledTriple(triple, "title", null); assertEquals("title", t.getPredicateLabel(), "Predicate label doesn't match!"); assertEquals(DC.title.getIRIString(), t.getPredicate(), "Predicate value doesn't match!"); assertEquals("A title", t.getObjectLabel(), "Object label doesn't match!"); assertEquals("A title", t.getObject(), "Object value doesn't match!"); }
@Test public void testOrdinaryLabelledTriple2() { final Triple triple = rdf.createTriple( rdf.createIRI("test:value"), DC.title, rdf.createLiteral("A title")); final LabelledTriple t = new LabelledTriple(triple, null, null); assertEquals(DC.title.getIRIString(), t.getPredicateLabel(), "Predicate label doesn't match!"); assertEquals(DC.title.getIRIString(), t.getPredicate(), "Predicate value doesn't match!"); assertEquals("A title", t.getObjectLabel(), "Object label doesn't match!"); assertEquals("A title", t.getObject(), "Object value doesn't match!"); }
/** * Get the label for the predicate. * * @return the predicate label */ public String getPredicateLabel() { if (nonNull(predLabel)) { return predLabel; } return getPredicate(); }
@Test public void testOrdinaryLabelledTriple3() { final Triple triple = rdf.createTriple( rdf.createIRI("test:value"), DC.title, rdf.createLiteral("A title")); final LabelledTriple t = new LabelledTriple(triple, null, null); assertEquals("test:value", t.getSubject(), "Subject value doesn't match!"); assertEquals(DC.title.getIRIString(), t.getPredicateLabel(), "Predicate label doesn't match!"); assertEquals(DC.title.getIRIString(), t.getPredicate(), "Predicate value doesn't match!"); assertEquals("A title", t.getObjectLabel(), "Object label doesn't match!"); assertEquals("A title", t.getObject(), "Object value doesn't match!"); }