本文整理匯總了Java中org.fcrepo.kernel.api.RdfLexicon類的典型用法代碼示例。如果您正苦於以下問題:Java RdfLexicon類的具體用法?Java RdfLexicon怎麽用?Java RdfLexicon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RdfLexicon類屬於org.fcrepo.kernel.api包,在下文中一共展示了RdfLexicon類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testBasicPropertiesCreation
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Test
public void testBasicPropertiesCreation() throws IOException, FedoraException {
final String objectPath = getRandomUniqueId();
final FedoraObject object = repo.createObject(objectPath);
final String sparqlUpdate = "INSERT DATA { <> <" + RdfLexicon.DC_NAMESPACE + "identifier> 'test' . } ";
object.updateProperties(sparqlUpdate);
final Iterator<Triple> tripleIt = object.getProperties();
while (tripleIt.hasNext()) {
final Triple t = tripleIt.next();
if (t.objectMatches(NodeFactory.createLiteral("test"))
&& t.predicateMatches(NodeFactory.createURI(RdfLexicon.DC_NAMESPACE + "identifier"))) {
return;
}
}
Assert.fail("Unable to verify added object property!");
}
示例2: testBasicDatastreamPropertiesCreation
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Test
public void testBasicDatastreamPropertiesCreation() throws IOException, FedoraException {
final String objectPath = getRandomUniqueId();
final FedoraObject object = repo.createObject(objectPath);
final String datastreamPath = objectPath + "/" + getRandomUniqueId();
final FedoraDatastream datastream = repo.createDatastream(datastreamPath, getStringTextContent("test"));
final String sparqlUpdate = "INSERT DATA { <> <" + RdfLexicon.DC_NAMESPACE + "identifier> 'test' . } ";
datastream.updateProperties(sparqlUpdate);
final Iterator<Triple> tripleIt = datastream.getProperties();
while (tripleIt.hasNext()) {
final Triple t = tripleIt.next();
if (t.objectMatches(NodeFactory.createLiteral("test"))
&& t.predicateMatches(NodeFactory.createURI(RdfLexicon.DC_NAMESPACE + "identifier"))) {
return;
}
}
Assert.fail("Unable to verify added datastream property!");
}
示例3: setUp
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Before
public void setUp() throws IOException {
initMocks(this);
when(mockRepository.getRepositoryUrl()).thenReturn(repositoryURL);
resource = new FedoraResourceImpl(mockRepository, mockHelper, path);
assertTrue(resource != null);
final Graph graph = createDefaultGraph();
graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.CREATED_DATE.asNode(),
ResourceFactory.createPlainLiteral(testDateValue).asNode()) );
graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.LAST_MODIFIED_DATE.asNode(),
ResourceFactory.createPlainLiteral(testDateValue).asNode()) );
graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.HAS_MIXIN_TYPE.asNode(),
createURI(testMixinType)) );
graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.WRITABLE.asNode(),
ResourceFactory.createTypedLiteral(new Boolean(isWritable)).asNode()) );
resource.setGraph( graph );
}
示例4: getContext
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
protected Context getContext(final Model model, final Node subject) {
final FieldTool fieldTool = new FieldTool();
final Context context = new VelocityContext();
final String[] baseUrl = uriInfo.getBaseUri().getPath().split("/");
if (baseUrl.length > 0) {
final String staticBaseUrl =
Arrays.asList(Arrays.copyOf(baseUrl, baseUrl.length - 1)).stream().collect(Collectors.joining("/"));
context.put("staticBaseUrl", staticBaseUrl);
} else {
context.put("staticBaseUrl", "/");
}
context.put("rdfLexicon", fieldTool.in(RdfLexicon.class));
context.put("helpers", VIEW_HELPERS);
context.put("esc", escapeTool);
context.put("rdf", model.getGraph());
context.put("model", model);
context.put("subjects", model.listSubjects());
context.put("nodeany", ANY);
context.put("topic", subject);
context.put("uriInfo", uriInfo);
return context;
}
示例5: init
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@PostConstruct
private void init() {
final Session session = sessionFactory.getInternalSession();
final NamespaceRegistry namespaceRegistry = NamespaceTools.getNamespaceRegistry(session);
ensureSwordNamespaceRegistration(namespaceRegistry);
final Container root = getContainer(session, SWORD_ROOT_PATH, SWORD_ROOT_LABEL);
ensureProperty(namespaceRegistry, root,
RdfLexicon.FEDORA_CONFIG_NAMESPACE + "maxUploadSizeInKb", SWORD_MAX_UPLOAD_SIZE_KB);
workspaces = getContainer(session, SWORD_WORKSPACES_PATH, "SWORD workspaces");
getContainer(session, SWORD_COLLECTIONS_PATH, "SWORD collections");
}
示例6: isWritable
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public boolean isWritable() {
final Collection<String> values = getPropertyValues(RdfLexicon.WRITABLE);
if (values != null && values.size() > 0) {
final Iterator<String> it = values.iterator();
return Boolean.parseBoolean(it.next());
}
return false;
}
示例7: testNoChildren
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Test
public void testNoChildren() throws RepositoryException {
when(mockResourceNode.hasNodes()).thenReturn(false);
try (final ChildrenRdfContext childrenRdfContext = new ChildrenRdfContext(mockResource, idTranslator)) {
final Model results = childrenRdfContext.collect(toModel());
final Resource subject = idTranslator.reverse().convert(mockResource);
final StmtIterator stmts = results.listStatements(subject, RdfLexicon.CONTAINS, (RDFNode) null);
assertFalse("There should NOT have been a statement!", stmts.hasNext());
}
}
示例8: testChildren
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Test
public void testChildren() throws RepositoryException {
when(mockRes1.getPath()).thenReturn(RDF_PATH + "/res1");
when(mockRes2.getPath()).thenReturn(RDF_PATH + "/res2");
when(mockRes3.getPath()).thenReturn(RDF_PATH + "/res3");
when(mockRes1.getDescribedResource()).thenReturn(mockRes1);
when(mockRes2.getDescribedResource()).thenReturn(mockRes2);
when(mockRes3.getDescribedResource()).thenReturn(mockRes3);
when(mockResourceNode.hasNodes()).thenReturn(true);
final Stream<FedoraResource> first = of(mockRes1, mockRes2, mockRes3);
final Stream<FedoraResource> second = of(mockRes1, mockRes2, mockRes3);
when(mockResource.getChildren()).thenReturn(first).thenReturn(second);
try (final ChildrenRdfContext context = new ChildrenRdfContext(mockResource, idTranslator)) {
final Model results = context.collect(toModel());
final Resource subject = idTranslator.reverse().convert(mockResource);
final StmtIterator stmts = results.listStatements(subject, RdfLexicon.CONTAINS, (RDFNode) null);
final AtomicInteger count = new AtomicInteger(0);
assertTrue("There should have been a statement!", stmts.hasNext());
stmts.forEachRemaining(stmt -> {
assertTrue("Object should be a URI! " + stmt.getObject(), stmt.getObject().isURIResource());
count.incrementAndGet();
}
);
assertEquals(3, count.get());
assertFalse("There should not have been a second statement!", stmts.hasNext());
}
}
示例9: getCreatedDate
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public Date getCreatedDate() {
return getDate(RdfLexicon.CREATED_DATE);
}
示例10: getLastModifiedDate
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public Date getLastModifiedDate() {
return getDate(RdfLexicon.LAST_MODIFIED_DATE);
}
示例11: getMixins
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public Collection<String> getMixins() {
return getPropertyValues(RdfLexicon.HAS_MIXIN_TYPE);
}
示例12: testFilterTriples
import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Test
public void testFilterTriples() throws FedoraException {
final Graph graph = RDFSinkFilter.filterTriples(mockTriples, RdfLexicon.CREATED_DATE.asNode());
assertEquals("The number of triples doesn't matched.", graph.size(), 1);
assertTrue(graph.contains(testCreatedDateTriple));
}