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


Java ConflictResolutionException类代码示例

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


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

示例1: resolveConflicts

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
/**
 * Apply conflict resolution process to the given resource description and return result.
 * @param resourceDescription container of quads that make up the description of the respective statement
 * (i.e. quads that are relevant for the conflict resolution process)
 * @return collection of quads derived from the input with resolved
 * conflicts, (F-)quality estimate and provenance information.
 * @throws ConflictResolutionException error during the conflict resolution process
 * @see ResolvedStatement
 */
@Override
public Collection<ResolvedStatement> resolveConflicts(ResourceDescription resourceDescription) throws ConflictResolutionException {
    int inputStatementCount = resourceDescription.getDescribingStatements().size();
    long startTime = logStarted(inputStatementCount);

    ConflictClustersMap conflictClustersMap = ConflictClustersMap.fromCollection(resourceDescription.getDescribingStatements(), uriMapping);
    ResolvedResult totalResult = new ResolvedResult();

    Resource canonicalResource = uriMapping.mapResource(resourceDescription.getResource());
    Collection<ResolvedStatement> resourceResolvedStatements = resolveResource(
            conflictClustersMap.getResourceStatementsMap(canonicalResource),
            canonicalResource,
            totalResult,
            conflictClustersMap,
            new HashSet<Resource>(1));
    totalResult.addToResult(resourceResolvedStatements);

    logFinished(startTime, inputStatementCount, totalResult);
    return totalResult.getResult();
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:30,代码来源:ResourceDescriptionConflictResolverImpl.java

示例2: resolveConflictCluster

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
/**
 * Resolve conflicts in {@code conflictClusterToResolve}. This methods expects that <b>all statements in
 * {@code conflictClusterToResolve} share the same subject and property</b> (no further mapping is performed).
 * @param conflictClusterToResolve statements to be resolved;
 * <b>statements in the model must be canonical-mapped</b> so that subjects and predicates are all the same
 * @param canonicalSubject canonical subject for the conflict cluster
 * @param canonicalProperty canonical property for the conflict cluster
 * @param conflictingMappedStatements conflicting statements to be considered during quality calculation.
 * @param totalResult @return resolved statements produced by conflict resolution function
 * @param resolvedResources @throws ConflictResolutionException CR error
 */
private Collection<ResolvedStatement> resolveConflictCluster(
        Model conflictClusterToResolve,
        Resource canonicalSubject,
        URI canonicalProperty,
        Collection<Statement> conflictingMappedStatements,
        ConflictClustersMap conflictClustersMap,
        ResolvedResult totalResult,
        Set<Resource> resolvedResources) throws ConflictResolutionException {

    if (conflictClusterToResolve.isEmpty()) {
        return Collections.emptyList();
    }

    ResolutionStrategy resolutionStrategy = getResolutionStrategy(canonicalProperty);
    ResolutionFunction resolutionFunction = getResolutionFunction(resolutionStrategy, conflictClustersMap, totalResult, resolvedResources);
    CRContext context = new CRContextImpl(
            conflictingMappedStatements, metadataModel, resolutionStrategy, resolvedStatementFactory, canonicalSubject, canonicalProperty);

    // TODO: resolution functions generally assume that the model is spog-sorted; while this works now, it can be easily broken in future
    return resolutionFunction.resolve(conflictClusterToResolve, context);
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:33,代码来源:ResourceDescriptionConflictResolverImpl.java

示例3: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的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

示例4: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的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

示例5: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的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: resolveNestedResource

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
public Collection<ResolvedStatement> resolveNestedResource(Set<Resource> nestedResourceSubjects, URI canonicalResource)
        throws ConflictResolutionException {

    Map<URI, List<Statement>> statementsToResolveByProperty = conflictClustersMap.getUnionStatementsMap(nestedResourceSubjects);
    Collection<ResolvedStatement> resolvedNestedResource = ResourceDescriptionConflictResolverImpl.this.resolveResource(
            statementsToResolveByProperty, canonicalResource, totalResult, conflictClustersMap, resolvedResources);
    totalResult.addToResult(new SubjectMappingIterator(resolvedNestedResource.iterator(), canonicalResource, resolvedStatementFactory));
    return resolvedNestedResource;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:10,代码来源:ResourceDescriptionConflictResolverImpl.java

示例7: resolve

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的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

示例8: resolveConflicts

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
@Override
public Collection<ResolvedStatement> resolveConflicts(ResourceDescription resourceDescription) throws ConflictResolutionException {
    Resource nextContext = getNextContext();

    ArrayList<Statement> inputStatements = new ArrayList<Statement>();
    ArrayList<ResolvedStatement> result = new ArrayList<ResolvedStatement>();
    for (Statement statement : resourceDescription.getDescribingStatements()) {
        inputStatements.add(statement);
        result.add(new ResolvedStatementImpl(statement, 1d, Collections.singleton(nextContext)));
    }
    collectedStatements.add(inputStatements);
    return result;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:14,代码来源:TestConflictResolver.java

示例9: runFusionTool

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
/**
 * Performs the actual LD-FusionTool task according to the given configuration.
 * @throws cz.cuni.mff.odcleanstore.fusiontool.exceptions.LDFusionToolException general fusion error
 * @throws java.io.IOException I/O error when writing results
 * @throws cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException conflict resolution error
 */
public void runFusionTool() throws LDFusionToolException, IOException, ConflictResolutionException {
    InputLoader inputLoader = null;
    CloseableRDFWriter rdfWriter = null;
    timeProfiler = ProfilingTimeCounter.createInstance(EnumFusionCounters.class, isProfilingOn);
    try {
        // Load source named graphs metadata
        timeProfiler.startCounter(EnumFusionCounters.META_INITIALIZATION);
        Model metadata = componentFactory.getMetadata();

        // Load & resolve owl:sameAs links
        UriMappingIterable uriMapping = componentFactory.getUriMapping();
        timeProfiler.stopAddCounter(EnumFusionCounters.META_INITIALIZATION);

        // Create & initialize quad loader
        timeProfiler.startCounter(EnumFusionCounters.DATA_INITIALIZATION);
        inputLoader = componentFactory.getInputLoader();
        inputLoader.initialize(uriMapping);
        timeProfiler.stopAddCounter(EnumFusionCounters.DATA_INITIALIZATION);

        // Initialize executor
        timeProfiler.startCounter(EnumFusionCounters.INITIALIZATION);
        ResourceDescriptionConflictResolver conflictResolver = componentFactory.getConflictResolver(metadata, uriMapping);
        rdfWriter = componentFactory.getRDFWriter();
        FusionExecutor executor = componentFactory.getExecutor(uriMapping);
        timeProfiler.stopAddCounter(EnumFusionCounters.INITIALIZATION);

        // Do the actual work
        executor.fuse(conflictResolver, inputLoader, rdfWriter);

        // Write metadata
        timeProfiler.startCounter(EnumFusionCounters.META_OUTPUT_WRITING);
        componentFactory.getCanonicalUriWriter(uriMapping).write(uriMapping);
        componentFactory.getSameAsLinksWriter().write(uriMapping);
        timeProfiler.stopAddCounter(EnumFusionCounters.META_OUTPUT_WRITING);
    } finally {
        if (rdfWriter != null) {
            rdfWriter.close();
        }
        if (inputLoader != null) {
            inputLoader.close();
        }
    }
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:50,代码来源:FusionRunner.java

示例10: fuse

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
void fuse(ResourceDescriptionConflictResolver conflictResolver, InputLoader inputLoader, CloseableRDFWriter rdfWriter)
throws LDFusionToolException, ConflictResolutionException, IOException;
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:3,代码来源:FusionExecutor.java

示例11: fuse

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
@Override
public void fuse(ResourceDescriptionConflictResolver conflictResolver, InputLoader inputLoader, CloseableRDFWriter rdfWriter)
        throws LDFusionToolException, ConflictResolutionException, IOException {

    // Initialize triple counters
    long outputTriples = 0;
    long inputTriples = 0;
    boolean checkMaxOutputTriples = maxOutputTriples != null && maxOutputTriples >= 0;

    // Load & process input quads
    LOG.info("Starting conflict resolution");
    timeProfiler.startCounter(EnumFusionCounters.BUFFERING);
    while (!isCanceled() && inputLoader.hasNext()) {
        timeProfiler.stopAddCounter(EnumFusionCounters.BUFFERING);

        // Load quads for the given subject
        timeProfiler.startCounter(EnumFusionCounters.QUAD_LOADING);
        ResourceDescription resourceDescription = inputLoader.next();
        inputTriples += resourceDescription.getDescribingStatements().size();
        timeProfiler.stopAddCounter(EnumFusionCounters.QUAD_LOADING);

        // Apply input filters
        timeProfiler.startCounter(EnumFusionCounters.INPUT_FILTERING);
        boolean accept = this.resourceDescriptionFilter.accept(resourceDescription);
        timeProfiler.stopAddCounter(EnumFusionCounters.INPUT_FILTERING);
        if (!accept) {
            LOG.debug("Resource {} doesn't match filter, skipping", resourceDescription.getResource());
            timeProfiler.startCounter(EnumFusionCounters.BUFFERING);
            continue;
        }

        // Resolve conflicts
        timeProfiler.startCounter(EnumFusionCounters.CONFLICT_RESOLUTION);
        Collection<ResolvedStatement> resolvedQuads = conflictResolver.resolveConflicts(resourceDescription);
        timeProfiler.stopAddCounter(EnumFusionCounters.CONFLICT_RESOLUTION);
        LOG.debug("Resolved {} quads resulting in {} quads (processed totally {} quads)",
                new Object[] {resourceDescription.getDescribingStatements().size(), resolvedQuads.size(), inputTriples});

        // Check if we have reached the limit on output triples
        if (checkMaxOutputTriples && outputTriples + resolvedQuads.size() > maxOutputTriples) {
            break;
        }
        outputTriples += resolvedQuads.size();

        // Add objects filtered by CR for traversal
        timeProfiler.startCounter(EnumFusionCounters.BUFFERING);
        inputLoader.updateWithResolvedStatements(resolvedQuads);
        timeProfiler.stopAddCounter(EnumFusionCounters.BUFFERING);

        // Write result to output
        timeProfiler.startCounter(EnumFusionCounters.OUTPUT_WRITING);
        rdfWriter.writeResolvedStatements(resolvedQuads);
        timeProfiler.stopAddCounter(EnumFusionCounters.OUTPUT_WRITING);

        memoryProfiler.capture();
        fixVirtuosoOpenedStatements();
        timeProfiler.startCounter(EnumFusionCounters.BUFFERING);
    }
    timeProfiler.stopAddCounter(EnumFusionCounters.BUFFERING);
    if (isCanceled()) {
        LOG.warn("The execution was canceled!");
    }
    LOG.info(String.format("Processed %,d quads which were resolved to %,d output quads.", inputTriples, outputTriples));
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:65,代码来源:LDFusionToolExecutor.java

示例12: runTestWithConfig

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
private void runTestWithConfig(ConfigImpl config, File expectedCanonicalUriFile, File expectedSameAsFile, File expectedOutputFile)
        throws LDFusionToolException, IOException, ConflictResolutionException, RDFParseException {
    File tempDirectory = new File(testDir.getRoot(), "temp");
    tempDirectory.getAbsoluteFile().mkdirs();
    config.setTempDirectory(tempDirectory);

    Map<String, String> dataSourceParams = config.getDataSources().get(0).getParams();
    dataSourceParams.put(ConfigParameters.DATA_SOURCE_FILE_PATH,
            convertToResourceFile(dataSourceParams.get(ConfigParameters.DATA_SOURCE_FILE_PATH)).getAbsolutePath());
    Map<String, String> sameAsSourceParams = config.getSameAsSources().get(0).getParams();
    sameAsSourceParams.put(ConfigParameters.DATA_SOURCE_FILE_PATH,
            convertToResourceFile(sameAsSourceParams.get(ConfigParameters.DATA_SOURCE_FILE_PATH)).getAbsolutePath());
    config.setCanonicalURIsInputFile(convertToResourceFile(config.getCanonicalURIsInputFile().getPath()));

    File canonicalUrisOutputFile = convertToTempFile(config.getCanonicalURIsOutputFile().getPath());
    config.setCanonicalURIsOutputFile(canonicalUrisOutputFile);
    Map<String, String> outputParams = config.getOutputs().get(0).getParams();
    File outputFile = convertToTempFile(outputParams.get(ConfigParameters.OUTPUT_PATH));
    outputParams.put(ConfigParameters.OUTPUT_PATH, outputFile.getAbsolutePath());
    File sameAsFile = convertToTempFile(outputParams.get(ConfigParameters.OUTPUT_SAME_AS_FILE));
    outputParams.put(ConfigParameters.OUTPUT_SAME_AS_FILE, sameAsFile.getAbsolutePath());

    // Act

    LDFusionToolComponentFactory componentFactory = new LDFusionToolComponentFactory(config);
    FusionRunner fusionRunner = new FusionRunner(componentFactory);
    fusionRunner.runFusionTool();

    // Assert - canonical URIs
    Set<String> canonicalUris = parseCanonicalUris(canonicalUrisOutputFile);
    Set<String> expectedCanonicalUris = parseCanonicalUris(expectedCanonicalUriFile);
    assertThat(canonicalUris, equalTo(expectedCanonicalUris));

    // Assert - sameAs
    Set<Statement> sameAs = parseStatements(sameAsFile);
    UriMappingIterable uriMapping = createUriMapping(sameAs, canonicalUris);
    Set<Statement> expectedSameAs = parseStatements(expectedSameAsFile);
    UriMappingIterable expectedUriMapping = createUriMapping(expectedSameAs, canonicalUris);
    for (String uri : expectedUriMapping) {
        URI canonicalUri = uriMapping.mapURI(VALUE_FACTORY.createURI(uri));
        URI expectedCanonicalUri = expectedUriMapping.mapURI(VALUE_FACTORY.createURI(uri));
        assertThat(canonicalUri, equalTo(expectedCanonicalUri));
    }

    // Assert - output
    Model actualModel = parseStatements(outputFile);
    Statement[] actualOutput = normalizeActualOutput(actualModel);
    Statement[] expectedOutput = normalizeExpectedOutput(parseStatements(expectedOutputFile), actualOutput);
    //assertThat(dataOutput, equalTo(expectedOutput));
    int minCommonLength = Math.min(actualOutput.length, expectedOutput.length);
    for (int i = 0; i < minCommonLength; i++) {
        Statement actualStatement = actualOutput[i];
        Statement expectedStatement = expectedOutput[i];

        assertThat(actualStatement, equalTo(expectedStatement));
        assertThat(actualStatement.getContext(), equalTo(expectedStatement.getContext()));
    }
    assertThat(actualOutput.length, equalTo(expectedOutput.length));
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:60,代码来源:LDFusionToolDirectorIntegrationTest.java

示例13: resolveConflicts

import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; //导入依赖的package包/类
/**
 * Apply conflict resolution process to the given resource description and return result
 * @param resourceDescription container of quads that make up the description of the respective statement
 *      (i.e. quads that are relevant for the conflict resolution process)
 * @return collection of quads derived from the input with resolved
 *         conflicts, (F-)quality estimate and provenance information.
 * @throws ConflictResolutionException error during the conflict resolution process 
 * @see ResolvedStatement
 */
Collection<ResolvedStatement> resolveConflicts(ResourceDescription resourceDescription) throws ConflictResolutionException;
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:11,代码来源:ResourceDescriptionConflictResolver.java


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