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


Java ResolvedStatement类代码示例

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


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

示例1: getsTripleRDFWriterWhenWritingMetadataIsDisabled

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Test
public void getsTripleRDFWriterWhenWritingMetadataIsDisabled() throws Exception {
    ConfigContainer config = mock(ConfigContainer.class);
    when(config.getWriteMetadata()).thenReturn(false);
    when(config.getDataGraphSymbolicName()).thenReturn(FTConfigConstants.DEFAULT_DATA_GRAPH_NAME);
    when(config.getMetadataGraphSymbolicName()).thenReturn(FTConfigConstants.DEFAULT_METADATA_GRAPH_NAME);

    // Act
    FusionToolDpuComponentFactory componentFactory = getComponentFactory(config);
    try (CloseableRDFWriter writer = componentFactory.getRDFWriter()) {

        // Assert
        Statement statement = createStatement();
        ResolvedStatement resolvedStatement = new ResolvedStatementImpl(statement, 0.5, ImmutableList.of((Resource) getUniqueURI()));
        writer.write(resolvedStatement);

        Statement actualStatement = Iterables.getOnlyElement(outputDataUnit.getAllStatements());
        Resource dataGraph = outputDataUnit.addNewDataGraph(FTConfigConstants.DEFAULT_DATA_GRAPH_NAME);
        MatcherAssert.assertThat(actualStatement, is(statement));
        MatcherAssert.assertThat(actualStatement.getContext(), is(dataGraph));
        outputDataUnit.getAllStatements();
    }
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:24,代码来源:FusionToolDpuComponentFactoryTest.java

示例2: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public Collection<ResolvedStatement> resolve(Model statements, CRContext crContext) throws ConflictResolutionException {
    int conflictClusterNumber = conflictClusterCounter.getAndIncrement();

    Collection<ResolvedStatement> result = new ArrayList<>();
    for (Statement statement : statements) {
        Collection<Resource> source = Collections.singleton(statement.getContext());
        double fQuality = getQuality(statement);
        ResolvedStatement resolvedStatement = new MockResolvedStatement(
                crContext.getResolvedStatementFactory().create(statement, fQuality, source).getStatement(),
                fQuality,
                source,
                conflictClusterNumber,
                crContext.getResolutionStrategy(),
                crContext.getConflictingStatements());
        result.add(resolvedStatement);
    }
    return result;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:20,代码来源:MockNoneResolutionFunctionWithQuality.java

示例3: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public Collection<ResolvedStatement> resolve(Model statements, CRContext crContext) throws ConflictResolutionException {
    int conflictClusterNumber = conflictClusterCounter.getAndIncrement();

    ResolvedStatement bestResolvedStatement = null;
    double bestQuality = -1;
    for (Statement statement : statements) {
        Collection<Resource> source = Collections.singleton(statement.getContext());
        double fQuality = getQuality(statement);
        if (fQuality > bestQuality) {
             bestResolvedStatement = new MockResolvedStatement(
                    crContext.getResolvedStatementFactory().create(statement, fQuality, source).getStatement(),
                    fQuality,
                    source,
                    conflictClusterNumber,
                    crContext.getResolutionStrategy(),
                    crContext.getConflictingStatements());
        }
    }
    if (bestResolvedStatement == null) {
        return Collections.emptySet();
    } else {
        return Collections.singleton(bestResolvedStatement);
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:26,代码来源:MockBestResolutionFunctionWithQuality.java

示例4: matches

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public boolean matches(Object actualValue) {
    if (actualValue == null) {
        return expectedSources == null;
    } else if (!(actualValue instanceof ResolvedStatement)) {
        return false;
    }

    ResolvedStatement actualResolvedStatement = (ResolvedStatement) actualValue;
    Collection<Resource> actualSources = actualResolvedStatement.getSourceGraphNames();
    HashSet<Resource> actualSourcesSet = new HashSet<>(actualSources);
    if (actualSources.size() != actualSourcesSet.size()) {
        return false; // sources are not unique
    }
    return actualSourcesSet.equals(expectedSources);
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:17,代码来源:ResolvedStatementMatchesSources.java

示例5: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public Collection<ResolvedStatement> resolve(Model statements, CRContext crContext) throws ConflictResolutionException {
    int conflictClusterNumber = conflictClusterCounter.getAndIncrement();

    Collection<ResolvedStatement> result = new ArrayList<>();
    for (Statement statement : statements) {
        Collection<Resource> source = Collections.singleton(statement.getContext());
        double fQuality = 1.0 / crContext.getConflictingStatements().size();
        ResolvedStatement resolvedStatement = new MockResolvedStatement(
                crContext.getResolvedStatementFactory().create(statement, fQuality, source).getStatement(),
                fQuality,
                source,
                conflictClusterNumber,
                crContext.getResolutionStrategy(),
                crContext.getConflictingStatements());
        result.add(resolvedStatement);
    }
    return result;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:20,代码来源:MockNoneResolutionFunction.java

示例6: updateWithResolvedStatements

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public void updateWithResolvedStatements(Collection<ResolvedStatement> resolvedStatements) {
    super.updateWithResolvedStatements(resolvedStatements);

    // Add discovered objects to the queue
    UriMapping uriMapping = getUriMapping();
    for (ResolvedStatement resolvedStatement : resolvedStatements) {
        String uri = ODCSUtils.getNodeUri(resolvedStatement.getStatement().getObject());
        if (uri == null) {
            // not a referenceable node
            continue;
        }
        // only add canonical URIs in order to save space
        String canonicalURI = uriMapping.getCanonicalURI(uri);
        if (!isResolvedCanonicalUri(canonicalURI)) {
            // only add new URIs
            subjectsQueue.add(canonicalURI);
        }
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:21,代码来源:TransitiveSubjectsSetInputLoader.java

示例7: processesAllInputStatements

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Test
public void processesAllInputStatements() throws Exception {
    // Arrange
    FusionExecutor executor = getLDFusionToolExecutor(Long.MAX_VALUE, false);
    TestInputLoader inputLoader = new TestInputLoader(ImmutableList.of(
            //(Collection<Statement>) ImmutableList.<Statement>of(),
            (Collection<Statement>) ImmutableList.of(
                    createHttpStatement("s1", "p1", "o1", "g1"),
                    createHttpStatement("s1", "p1", "o1", "g2")),

            ImmutableList.of(
                    createHttpStatement("s2", "p2", "o1", "g3"),
                    createHttpStatement("s2", "p2", "o2", "g3"))
    ));
    TestRDFWriter rdfWriter = new TestRDFWriter();

    // Act
    executor.fuse(new TestConflictResolver(), inputLoader, rdfWriter);

    // Assert
    List<ResolvedStatement> resolvedStatements = rdfWriter.getCollectedResolvedStatements();
    assertThat(resolvedStatements.get(0).getStatement(), contextAwareStatementIsEqual(createHttpStatement("s1", "p1", "o1", "g1")));
    assertThat(resolvedStatements.get(1).getStatement(), contextAwareStatementIsEqual(createHttpStatement("s1", "p1", "o1", "g2")));
    assertThat(resolvedStatements.get(2).getStatement(), contextAwareStatementIsEqual(createHttpStatement("s2", "p2", "o1", "g3")));
    assertThat(resolvedStatements.get(3).getStatement(), contextAwareStatementIsEqual(createHttpStatement("s2", "p2", "o2", "g3")));
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:27,代码来源:LDFusionToolExecutorTest.java

示例8: updateWithResolvedStatementsDoesNotThrowException

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Test
public void updateWithResolvedStatementsDoesNotThrowException() throws Exception {
    // Act
    ExternalSortingInputLoader inputLoader = createExternalSortingInputLoader(testInput1, false);
    try {
        inputLoader.initialize(uriMapping);
        while (inputLoader.hasNext()) {
            Collection<Statement> statements = inputLoader.next().getDescribingStatements();
            Statement firstStatement = statements.iterator().next();
            ResolvedStatement resolvedStatement = new ResolvedStatementImpl(firstStatement, 0.5, Collections.singleton(firstStatement.getContext()));
            inputLoader.updateWithResolvedStatements(Collections.singleton(resolvedStatement));
        }
    } finally {
        inputLoader.close();
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:17,代码来源:ExternalSortingInputLoaderTest.java

示例9: write

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public void write(ResolvedStatement resolvedStatement) throws IOException {
    try {
        IRI statementContext = dataUnit.addNewDataGraph(dataGraphSymbolicName + DATA_GRAPH_NAME_INFIX + Long.toString(counter.incrementAndGet()));
        connection.add(resolvedStatement.getStatement(), statementContext);
        connection.add(statementContext, ODCS.QUALITY, valueFactory.createLiteral(resolvedStatement.getQuality()), metadataContext);
        for (Resource sourceGraph : resolvedStatement.getSourceGraphNames()) {
            connection.add(statementContext, ODCS.SOURCE_GRAPH, sourceGraph, metadataContext);
        }
    } catch (DataUnitException | RepositoryException e) {
        throw new IOException("Error writing to data unit", e);
    }
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:14,代码来源:DataUnitRDFWriterWithMetadata.java

示例10: getsQuadRDFWriterWhenWritingMetadataIsEnabled

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Test
public void getsQuadRDFWriterWhenWritingMetadataIsEnabled() throws Exception {
    ConfigContainer config = mock(ConfigContainer.class);
    when(config.getWriteMetadata()).thenReturn(true);
    when(config.getDataGraphSymbolicName()).thenReturn(FTConfigConstants.DEFAULT_DATA_GRAPH_NAME);
    when(config.getMetadataGraphSymbolicName()).thenReturn(FTConfigConstants.DEFAULT_METADATA_GRAPH_NAME);

    // Act
    FusionToolDpuComponentFactory componentFactory = getComponentFactory(config);
    try (CloseableRDFWriter writer = componentFactory.getRDFWriter()) {

        // Assert
        Statement statement = createStatement();
        ResolvedStatement resolvedStatement = new ResolvedStatementImpl(statement, 0.5, ImmutableList.of((Resource) createHttpUri("source1")));
        writer.write(resolvedStatement);

        IRI metadataGraph = outputDataUnit.addNewDataGraph(FTConfigConstants.DEFAULT_METADATA_GRAPH_NAME);
        IRI statementGraph = outputDataUnit.addNewDataGraph(FTConfigConstants.DEFAULT_DATA_GRAPH_NAME + "-1");

        List<Statement> expectedStatements = ImmutableList.of(
                VF.createStatement(statement.getSubject(), statement.getPredicate(), statement.getObject(), statementGraph),
                VF.createStatement(statementGraph, ODCS.QUALITY, VF.createLiteral(0.5), metadataGraph),
                VF.createStatement(statementGraph, ODCS.SOURCE_GRAPH, createHttpUri("source1"), metadataGraph)
        );
        List<Statement> actualStatements = outputDataUnit.getAllStatements();
        MatcherAssert.assertThat(actualStatements, containsInAnyOrder(Lists.transform(expectedStatements, STATEMENT_TO_MATCHER)));
    }
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:29,代码来源:FusionToolDpuComponentFactoryTest.java

示例11: writesResolvedStatementToDefaultGraph

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Test
public void writesResolvedStatementToDefaultGraph() throws Exception {
    Statement statement = FTDPUTestUtils.createStatement();
    ResolvedStatement resolvedStatement = new ResolvedStatementImpl(statement, 0.5, ImmutableList.of((Resource) FTDPUTestUtils.getUniqueURI()));

    writer.write(resolvedStatement);

    Statement actualStatement = Iterables.getOnlyElement(FTDPUTestUtils.getAllStatements(repository));
    assertThat(actualStatement, is(statement));
    assertThat(actualStatement.getContext(), is((Resource) DEFAULT_CONTEXT));
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:12,代码来源:DataUnitRDFWriterTest.java

示例12: writesResolvedStatementToDefaultGraph

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Test
public void writesResolvedStatementToDefaultGraph() throws Exception {
    Statement statement = FTDPUTestUtils.createStatement();
    ResolvedStatement resolvedStatement = new ResolvedStatementImpl(
            statement,
            0.5,
            ImmutableList.<Resource>of(FTDPUTestUtils.createHttpUri("source1"), FTDPUTestUtils.createHttpUri("source2")));

    // Act
    writer.write(resolvedStatement);

    // Assert
    Collection<IRI> addedGraphs = dataUnit.getAddedGraphs().values(); // must be first before calling dataUnit.addNewDataGraph()

    IRI metadataGraph = dataUnit.addNewDataGraph(FTConfigConstants.DEFAULT_METADATA_GRAPH_NAME);
    IRI statementGraph = dataUnit.addNewDataGraph(FTConfigConstants.DEFAULT_DATA_GRAPH_NAME + "-1");
    assertThat(addedGraphs, containsInAnyOrder(
            dataUnit.addNewDataGraph(FTConfigConstants.DEFAULT_DATA_GRAPH_NAME),
            metadataGraph,
            statementGraph));

    List<Statement> expectedStatements = ImmutableList.of(
            VF.createStatement(statement.getSubject(), statement.getPredicate(), statement.getObject(), statementGraph),
            VF.createStatement(statementGraph, ODCS.QUALITY, VF.createLiteral(0.5), metadataGraph),
            VF.createStatement(statementGraph, ODCS.SOURCE_GRAPH, FTDPUTestUtils.createHttpUri("source1"), metadataGraph),
            VF.createStatement(statementGraph, ODCS.SOURCE_GRAPH, FTDPUTestUtils.createHttpUri("source2"), metadataGraph)
    );
    List<Statement> actualStatements = dataUnit.getAllStatements();
    assertThat(actualStatements, containsInAnyOrder(Lists.transform(expectedStatements, ContextAwareStatementIsEqual.STATEMENT_TO_MATCHER)));
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:31,代码来源:DataUnitRDFWriterWithMetadataTest.java

示例13: aggregateConflictClusterQuality

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public double aggregateConflictClusterQuality(Collection<ResolvedStatement> conflictCluster) {
    if (conflictCluster == null || conflictCluster.isEmpty()) {
        return 0d;
    }
    double sum = 0d;
    for (ResolvedStatement resolvedStatement : conflictCluster) {
        sum += resolvedStatement.getQuality();
    }
    return sum / conflictCluster.size();
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:12,代码来源:NestedResourceDescriptionQualityCalculatorImpl.java

示例14: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
@Override
public Collection<ResolvedStatement> resolve(Model statements, CRContext context) throws ConflictResolutionException {
    if (statements.isEmpty()) {
        return Collections.emptyList();
    }

    Set<Resource> nestedResourceSubjects = new HashSet<>(statements.size());
    boolean hasNonAggregableStatements = false;
    for (Statement statement : statements) {
        if (statement.getObject() instanceof Resource) {
            nestedResourceSubjects.add((Resource) statement.getObject());
        } else {
            hasNonAggregableStatements = true;
        }
    }

    URI canonicalProperty = context.getCanonicalProperty();
    URI newObject = resolverContext.generateUniqueUri();
    if (LOG.isTraceEnabled()) {
        LOG.trace("... resolving values of description property {} of {} (new dependent resource is {})",
                new Object[]{canonicalProperty, context.getCanonicalSubject(), newObject});
    }
    Collection<ResolvedStatement> resolvedStatements = resolverContext.resolveNestedResource(nestedResourceSubjects, newObject);

    double aggregateQuality = nestedResourceDescriptionQualityCalculator.aggregateConflictClusterQuality(resolvedStatements);
    Collection<Resource> sources = ResourceDescriptionConflictResolverUtils.collectContexts(resolvedStatements);
    ResolvedStatement resultStatement = context.getResolvedStatementFactory().create(
            context.getCanonicalSubject(), canonicalProperty, newObject, aggregateQuality, sources);

    if (hasNonAggregableStatements) {
        return handleNonAggregableStatements(statements, context, resultStatement);
    } else {
        return Collections.singleton(resultStatement);
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:36,代码来源:NestedResourceDescriptionResolution.java

示例15: handleNonAggregableStatements

import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; //导入依赖的package包/类
private Collection<ResolvedStatement> handleNonAggregableStatements(Model statements, CRContext context, ResolvedStatement resultStatement) {
    ArrayList<ResolvedStatement> result = new ArrayList<>();
    result.add(resultStatement);
    for (Statement statement : statements) {
        if (!(statement.getObject() instanceof Resource)) {
            handleNonAggregableStatement(statement, statements, context, result);
        }
    }
    return result;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:11,代码来源:NestedResourceDescriptionResolution.java


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