當前位置: 首頁>>代碼示例>>Java>>正文


Java RdfLexicon類代碼示例

本文整理匯總了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!");
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:17,代碼來源:FedoraRepositoryImplIT.java

示例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!");
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:19,代碼來源:FedoraRepositoryImplIT.java

示例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 );
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:19,代碼來源:FedoraResourceImplTest.java

示例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;
}
 
開發者ID:fcrepo4,項目名稱:fcrepo4,代碼行數:25,代碼來源:StreamingBaseHtmlProvider.java

示例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");
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-swordserver,代碼行數:15,代碼來源:SWORDServiceProvider.java

示例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;
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:10,代碼來源:FedoraResourceImpl.java

示例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());
    }
}
 
開發者ID:fcrepo4,項目名稱:fcrepo4,代碼行數:13,代碼來源:ChildrenRdfContextTest.java

示例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());
    }
}
 
開發者ID:fcrepo4,項目名稱:fcrepo4,代碼行數:32,代碼來源:ChildrenRdfContextTest.java

示例9: getCreatedDate

import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public Date getCreatedDate() {
    return getDate(RdfLexicon.CREATED_DATE);
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:5,代碼來源:FedoraResourceImpl.java

示例10: getLastModifiedDate

import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public Date getLastModifiedDate() {
    return getDate(RdfLexicon.LAST_MODIFIED_DATE);
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:5,代碼來源:FedoraResourceImpl.java

示例11: getMixins

import org.fcrepo.kernel.api.RdfLexicon; //導入依賴的package包/類
@Override
public Collection<String> getMixins() {
    return getPropertyValues(RdfLexicon.HAS_MIXIN_TYPE);
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:5,代碼來源:FedoraResourceImpl.java

示例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));
}
 
開發者ID:fcrepo4-labs,項目名稱:fcrepo4-client,代碼行數:7,代碼來源:RDFSinkFilterTest.java


注:本文中的org.fcrepo.kernel.api.RdfLexicon類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。