当前位置: 首页>>代码示例>>Java>>正文


Java SKOS类代码示例

本文整理汇总了Java中org.trellisldp.vocabulary.SKOS的典型用法代码示例。如果您正苦于以下问题:Java SKOS类的具体用法?Java SKOS怎么用?Java SKOS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SKOS类属于org.trellisldp.vocabulary包,在下文中一共展示了SKOS类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExtraLinks

import org.trellisldp.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void testExtraLinks() {
    final String inbox = "http://ldn.example.com/inbox";
    final String annService = "http://annotation.example.com/resource";

    when(mockResource.getExtraLinkRelations()).thenAnswer(inv -> Stream.of(
            new SimpleEntry<>(annService, OA.annotationService.getIRIString()),
            new SimpleEntry<>(SKOS.Concept.getIRIString(), "type"),
            new SimpleEntry<>(inbox, "inbox")));
    when(mockHeaders.getAcceptableMediaTypes()).thenReturn(singletonList(TEXT_TURTLE_TYPE));

    final GetHandler getHandler = new GetHandler(mockLdpRequest, mockResourceService,
            mockIoService, mockBinaryService, baseUrl);

    final Response res = getHandler.getRepresentation(mockResource).build();
    assertEquals(OK, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(SKOS.Concept)));
    assertTrue(res.getLinks().stream().anyMatch(hasLink(rdf.createIRI(inbox), "inbox")));
    assertTrue(res.getLinks().stream().anyMatch(hasLink(rdf.createIRI(annService),
                    OA.annotationService.getIRIString())));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:22,代码来源:GetHandlerTest.java

示例2: testNotification

import org.trellisldp.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void testNotification() {
    final IRI resource = rdf.createIRI(identifier);
    final Dataset dataset = rdf.createDataset();
    dataset.add(rdf.createQuad(Trellis.PreferUserManaged, resource, LDP.inbox, inbox));
    dataset.add(rdf.createQuad(Trellis.PreferAudit, rdf.createBlankNode(), PROV.wasAssociatedWith, agent));
    dataset.add(rdf.createQuad(Trellis.PreferServerManaged, resource, type, LDP.RDFSource));
    dataset.add(rdf.createQuad(Trellis.PreferUserManaged, resource, type, SKOS.Concept));
    dataset.add(rdf.createQuad(Trellis.PreferAudit, rdf.createBlankNode(), type, PROV.Activity));
    dataset.add(rdf.createQuad(Trellis.PreferAudit, rdf.createBlankNode(), type, AS.Create));

    final Instant time = now();

    final Notification event = new Notification(identifier, dataset);
    assertFalse(time.isAfter(event.getCreated()));
    assertTrue(event.getIdentifier().getIRIString().startsWith("urn:uuid:"));
    assertEquals(of(resource), event.getTarget());
    assertEquals(of(inbox), event.getInbox());
    assertEquals(1L, event.getAgents().size());
    assertTrue(event.getAgents().contains(agent));
    final Collection<IRI> targetTypes = event.getTargetTypes();
    assertEquals(2L, targetTypes.size());
    assertTrue(targetTypes.contains(LDP.RDFSource));
    assertTrue(targetTypes.contains(SKOS.Concept));
    final Collection<IRI> eventTypes = event.getTypes();
    assertEquals(2L, eventTypes.size());
    assertTrue(eventTypes.contains(AS.Create));
    assertTrue(eventTypes.contains(PROV.Activity));
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:30,代码来源:NotificationTest.java


注:本文中的org.trellisldp.vocabulary.SKOS类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。