use of org.apache.stanbol.enhancer.ldpath.backend.ContentItemBackend in project stanbol by apache.
the class ContentItemBackendTest method testContentWithAdditionalMetadata.
@Test
public void testContentWithAdditionalMetadata() throws IOException, LDPathParseException {
byte[] content = "text content".getBytes();
IRI uri = ContentItemHelper.makeDefaultUrn(content);
ContentItem contentItem = ciFactory.createContentItem(uri, new ByteArraySource(content, "text/plain; charset=UTF-8"));
Graph tc = new SimpleGraph();
Literal literal = LiteralFactory.getInstance().createTypedLiteral("Michael Jackson");
IRI subject = new IRI("dummyUri");
tc.add(new TripleImpl(subject, new IRI("http://xmlns.com/foaf/0.1/givenName"), literal));
contentItem.addPart(new IRI(uri.getUnicodeString() + "_additionalMetadata"), tc);
ContentItemBackend ciBackend = new ContentItemBackend(contentItem, true);
LDPath<RDFTerm> ldPath = new LDPath<RDFTerm>(ciBackend, EnhancerLDPath.getConfig());
Collection<RDFTerm> result = ldPath.pathQuery(subject, "foaf:givenName", null);
assertTrue("Additional metadata cannot be found", result.contains(literal));
}
Aggregations