• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OWL类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: propagateToHandler

import org.eclipse.rdf4j.model.vocabulary.OWL; //导入依赖的package包/类
private static void propagateToHandler(List<Statement> statements,
        RDFHandler handler)
        throws RDFHandlerException, RepositoryException {
    handler.startRDF();
    handler.handleNamespace(RDF.PREFIX, RDF.NAMESPACE);
    handler.handleNamespace(RDFS.PREFIX, RDFS.NAMESPACE);
    handler.handleNamespace(DCAT.PREFIX, DCAT.NAMESPACE);
    handler.handleNamespace(XMLSchema.PREFIX, XMLSchema.NAMESPACE);
    handler.handleNamespace(OWL.PREFIX, OWL.NAMESPACE);
    handler.handleNamespace(DCTERMS.PREFIX, DCTERMS.NAMESPACE);
    handler.handleNamespace(FDP.PREFIX, FDP.NAMESPACE);
    handler.handleNamespace(R3D.PREFIX, R3D.NAMESPACE);
    handler.handleNamespace("lang",
            "http://id.loc.gov/vocabulary/iso639-1/");
    for (Statement st : statements) {
        handler.handleStatement(st);
    }
    handler.endRDF();
}
 
开发者ID:DTL-FAIRData,项目名称:fairmetadata4j,代码行数:20,代码来源:MetadataUtils.java


示例2: getsUriMapping

import org.eclipse.rdf4j.model.vocabulary.OWL; //导入依赖的package包/类
@Test
public void getsUriMapping() throws Exception {
    // Arrange
    sameAsDataUnit = new MockRDFDataUnit(ImmutableList.of(
            VF.createStatement(createHttpUri("a1"), OWL.SAMEAS, createHttpUri("a2")),
            VF.createStatement(createHttpUri("a2"), OWL.SAMEAS, createHttpUri("a3")),
            VF.createStatement(createHttpUri("b1"), OWL.SAMEAS, createHttpUri("b2")),
            VF.createStatement(createHttpUri("b2"), OWL.SAMEAS, createHttpUri("b3")),
            VF.createStatement(createHttpUri("p1"), OWL.SAMEAS, createHttpUri("p2")),
            VF.createStatement(createHttpUri("p2"), OWL.SAMEAS, createHttpUri("p3"))
    ));

    File resultDir = testDir.newFolder("dpuInstanceDir");
    when(dpuContext.getDpuInstanceDirectory()).thenReturn(resultDir.toURI().toString());

    ConfigContainer config = mock(ConfigContainer.class);
    when(config.getSameAsLinkTypes()).thenReturn(ImmutableSet.of(OWL.SAMEAS));
    when(config.getPropertyResolutionStrategies()).thenReturn(ImmutableMap.<IRI, ResolutionStrategy>of(createHttpUri("p2"), new ResolutionStrategyImpl()));
    when(config.getPreferredCanonicalURIs()).thenReturn(ImmutableSet.of(createHttpUri("a2").stringValue()));
    Files.write(new File(resultDir, "canonicalUris.txt").toPath(), ImmutableList.of(createHttpUri("b2").stringValue()), Charset.defaultCharset());
    when(config.getCanonicalURIsFileName()).thenReturn("canonicalUris.txt");

    // Act
    FusionToolDpuComponentFactory componentFactory = getComponentFactory(config);
    UriMappingIterable uriMappingIterable = componentFactory.getUriMapping();

    // Assert
    assertThat(uriMappingIterable.mapResource(createHttpUri("a1")), is((Resource) createHttpUri("a2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("a2")), is((Resource) createHttpUri("a2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("a3")), is((Resource) createHttpUri("a2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("b1")), is((Resource) createHttpUri("b2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("b2")), is((Resource) createHttpUri("b2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("b3")), is((Resource) createHttpUri("b2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("p1")), is((Resource) createHttpUri("p2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("p2")), is((Resource) createHttpUri("p2")));
    assertThat(uriMappingIterable.mapResource(createHttpUri("p3")), is((Resource) createHttpUri("p2")));
    assertThat(Iterables.size(uriMappingIterable), is(6));
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:39,代码来源:FusionToolDpuComponentFactoryTest.java


示例3: export

import org.eclipse.rdf4j.model.vocabulary.OWL; //导入依赖的package包/类
public static void export(final Connection connection, final Path path)
        throws SQLException, IOException, RDFHandlerException {

    final Map<Long, String> screenNames = loadScreenNames(connection, path);

    connection.setAutoCommit(false);

    final ValueFactory vf = SimpleValueFactory.getInstance();

    try (Writer writer = new OutputStreamWriter(
            new GZIPOutputStream(new FileOutputStream(path.toFile())), Charsets.UTF_8)) {

        final RDFWriter out = Rio.createWriter(RDFFormat.NTRIPLES, writer);
        out.startRDF();

        int counter = 0;
        try (PreparedStatement stmt = connection.prepareStatement("" //
                + "SELECT resource_id, uid, score, is_alignment\n" //
                + "FROM alignments\n" //
                + "WHERE version=2\n" //
                + "ORDER BY resource_id ASC, score DESC")) {
            stmt.setFetchSize(1000);
            try (ResultSet rs = stmt.executeQuery()) {
                IRI lastEntity = null;
                int rank = 1;
                while (rs.next()) {
                    final long uid = rs.getLong("uid");
                    final String screenName = screenNames.get(uid);
                    Preconditions.checkState(screenName != null);
                    final IRI entity = vf.createIRI(rs.getString("resource_id"));
                    final IRI account = vf.createIRI(
                            "http://twitter.com/" + screenName.replaceAll("\\s", "+"));
                    final BNode candidate = vf.createBNode();
                    final float score = rs.getFloat("score");
                    final boolean align = rs.getBoolean("is_alignment");
                    rank = entity.equals(lastEntity) ? rank + 1 : 1;
                    lastEntity = entity;
                    LOGGER.debug("Processing candidate {} {} {} {}", entity, candidate, score,
                            align);
                    if (align) {
                        emit(out, entity, FOAF.ACCOUNT, account);
                    }
                    emit(out, entity, OWL.SAMEAS, entity);
                    emit(out, entity, SL.CANDIDATE_PROPERTY, candidate);
                    emit(out, candidate, SL.RANK, vf.createLiteral(rank));
                    emit(out, candidate, SL.CONFIDENCE, vf.createLiteral(score));
                    emit(out, candidate, SL.ACCOUNT, account);
                    emit(out, account, DCTERMS.IDENTIFIER, vf.createLiteral(uid));
                    emit(out, account, FOAF.ACCOUNT_NAME, vf.createLiteral(screenName));
                    if (++counter % 10000 == 0) {
                        LOGGER.info("{} candidates processed", counter);
                    }
                }
            }
        }

        out.endRDF();
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:60,代码来源:RDFExporter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KeyTransRecipientId类代码示例发布时间:2022-05-23
下一篇:
Java ThreadLocalRequestContext类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap