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


Java ResolutionStrategyImpl类代码示例

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


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

示例1: extractResolutionStrategy

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
private ResolutionStrategy extractResolutionStrategy(ResolutionStrategyXml strategyXml, NamespacePrefixExpander prefixExpander) throws InvalidInputException {
    ResolutionStrategyImpl strategy = new ResolutionStrategyImpl();
    strategy.setResolutionFunctionName(strategyXml.getResolutionFunctionName());
    strategy.setCardinality(strategyXml.getCardinality());
    strategy.setAggregationErrorStrategy(strategyXml.getAggregationErrorStrategy());
    if (strategyXml.getDependsOn() != null) {
        strategy.setDependsOn(convertToUriWithExpansion(prefixExpander, strategyXml.getDependsOn()));
    }
    if (strategyXml.getParams() != null) {
        strategy.setParams(extractAllParams(strategyXml.getParams()));
    }
    return strategy;
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:14,代码来源:ConfigReader.java

示例2: getsUriMapping

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的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: usesCorrectResolutionStrategy

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
@Test
public void usesCorrectResolutionStrategy() throws Exception {
    // Arrange
    Resource resource = createHttpUri("s1");
    ConflictResolutionPolicyImpl conflictResolutionPolicy = new ConflictResolutionPolicyImpl();
    ResolutionStrategy defaultResolutionStrategy = new ResolutionStrategyImpl("DEFAULT", EnumCardinality.SINGLEVALUED, EnumAggregationErrorStrategy.IGNORE);
    ResolutionStrategy pbResolutionStrategy = new ResolutionStrategyImpl("PB");
    ResolutionStrategyImpl p1ResolutionStrategy = new ResolutionStrategyImpl("P1");

    conflictResolutionPolicy.setDefaultResolutionStrategy(defaultResolutionStrategy);
    conflictResolutionPolicy.setPropertyResolutionStrategy(new HashMap<>(ImmutableMap.of(
            createHttpUri("pb"), pbResolutionStrategy,
            createHttpUri("p1"), p1ResolutionStrategy)));
    ResourceDescriptionConflictResolver resolver = createResolver(conflictResolutionPolicy, new MockNoneResolutionFunction());
    Collection<Statement> testInput = ImmutableList.of(
            createHttpStatement("s1", "pa", "o1", "g1"),
            createHttpStatement("s1", "p1", "o1", "g2"),
            createHttpStatement("s1", "p2", "o1", "g3")
    );

    // Act
    Collection<ResolvedStatement> result = resolver.resolveConflicts(new ResourceDescriptionImpl(resource, testInput));

    // Assert
    Map<URI, ResolutionStrategy> expectedResolutionStrategies = new HashMap<>();
    expectedResolutionStrategies.put(createHttpUri("px"),
            new ResolutionStrategyImpl("PB", EnumCardinality.SINGLEVALUED, EnumAggregationErrorStrategy.IGNORE));
    expectedResolutionStrategies.put(createHttpUri("p1"),
            new ResolutionStrategyImpl("P1", EnumCardinality.SINGLEVALUED, EnumAggregationErrorStrategy.IGNORE));
    expectedResolutionStrategies.put(createHttpUri("p2"),
            new ResolutionStrategyImpl("DEFAULT", EnumCardinality.SINGLEVALUED, EnumAggregationErrorStrategy.IGNORE));

    Map<URI, ResolutionStrategy> actualResolutionStrategies = new HashMap<>();
    for (ResolvedStatement resolvedStatement : result) {
        MockResolvedStatement mockResolvedStatement = (MockResolvedStatement) resolvedStatement;
        actualResolutionStrategies.put(resolvedStatement.getStatement().getPredicate(), mockResolvedStatement.getResolutionStrategy());
    }
    assertThat(actualResolutionStrategies, is(expectedResolutionStrategies));
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:40,代码来源:ResourceDescriptionConflictResolverImplTest.java

示例4: createResolver

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
private ResourceDescriptionConflictResolver createResolver(ConflictResolutionPolicy conflictResolutionPolicy, ResolutionFunction resolutionFunction)
        throws ResolutionFunctionNotRegisteredException {
    ResolutionFunctionRegistry resolutionFunctionRegistry = mock(ResolutionFunctionRegistry.class);
    when(resolutionFunctionRegistry.get(anyString())).thenReturn(resolutionFunction);
    conflictResolutionPolicy.getPropertyResolutionStrategies()
            .put(RESOURCE_DESCRIPTION_URI, new ResolutionStrategyImpl(NestedResourceDescriptionResolution.getName()));
    return new ResourceDescriptionConflictResolverImpl(
            resolutionFunctionRegistry,
            conflictResolutionPolicy,
            uriMapping,
            new EmptyMetadataModel(),
            "http://cr/",
            new NestedResourceDescriptionQualityCalculatorImpl(new DummyFQualityCalculator())
    );
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:16,代码来源:ResourceDescriptionConflictResolverImplTest.java

示例5: extractResolutionStrategy

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
private ResolutionStrategy extractResolutionStrategy(ResolutionStrategyXml strategyXml, NamespacePrefixExpander prefixExpander) throws InvalidInputException {
    ResolutionStrategyImpl strategy = new ResolutionStrategyImpl();
    strategy.setResolutionFunctionName(strategyXml.getResolutionFunctionName());
    strategy.setCardinality(strategyXml.getCardinality());
    strategy.setAggregationErrorStrategy(strategyXml.getAggregationErrorStrategy());
    if (strategyXml.getDependsOn() != null) {
        strategy.setDependsOn(prefixExpander.convertToUriWithExpansion(strategyXml.getDependsOn()));
    }
    if (strategyXml.getParams() != null) {
        strategy.setParams(extractAllParams(strategyXml.getParams()));
    }
    return strategy;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:14,代码来源:ConfigReader.java

示例6: getsUriMapping

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的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.<URI, 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:mifeet,项目名称:FusionTool-DPU,代码行数:39,代码来源:FusionToolDpuComponentFactoryTest.java

示例7: getsExternalSortingInputLoader

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void getsExternalSortingInputLoader() throws Exception {
    // Arrange
    File workingDir = testDir.newFolder("wd");
    when(dpuContext.getWorkingDir()).thenReturn(workingDir);
    ConfigContainer config = mock(ConfigContainer.class);
    when(config.isLocalCopyProcessing()).thenReturn(true);
    when(config.getParserConfig()).thenReturn(FTConfigConstants.DEFAULT_FILE_PARSER_CONFIG);
    when(config.getPropertyResolutionStrategies()).thenReturn(ImmutableMap.<IRI, ResolutionStrategy>of(
            createHttpUri("resourceDescriptionProperty"), new ResolutionStrategyImpl(NestedResourceDescriptionResolution.getName())
    ));
    ImmutableList<Statement> inputTriples1 = ImmutableList.of(
            createHttpStatement("a1", "pa1", "oa1", "dataGraph1"),
            createHttpStatement("b1", "resourceDescriptionProperty", "dependent", "dataGraph1"),
            createHttpStatement("c1", "pc1", "oc1", "otherGraphShouldBeIgnored")
    );
    ImmutableList<Statement> inputTriples2 = ImmutableList.of(
            createHttpStatement("a2", "pa2", "oa2", "dataGraph2"),
            createHttpStatement("dependent", "pd", "od", "dataGraph2")
    );

    // Act
    Map<IRI, Collection<Statement>> resourceDescriptions;
    try (MockRDFDataUnit source1 = dataUnitWithGraph(inputTriples1, createHttpUri("dataGraph1"));
         MockRDFDataUnit source2 = dataUnitWithGraph(inputTriples2, createHttpUri("dataGraph2"));
         InputLoader inputLoader = getComponentFactory(config, ImmutableList.of(source1, source2)).getInputLoader()
    ) {
        inputLoader.initialize(uriMapping);
        resourceDescriptions = collectResourcesDescriptions(inputLoader);
    }

    // Assert
    assertThat(resourceDescriptions.keySet(), containsInAnyOrder(createHttpUri("a1"), createHttpUri("b1"), createHttpUri("dependent")));
    assertThat(resourceDescriptions.get(createHttpUri("a1")), containsInAnyOrder(
            contextAwareStatementIsEqual(createHttpStatement("a1", "pa1", "oa1", "dataGraph1")),
            contextAwareStatementIsEqual(createHttpStatement("a2", "pa2", "oa2", "dataGraph2"))));
    assertThat(resourceDescriptions.get(createHttpUri("b1")), containsInAnyOrder(
            contextAwareStatementIsEqual(createHttpStatement("b1", "resourceDescriptionProperty", "dependent", "dataGraph1")),
            contextAwareStatementIsEqual(createHttpStatement("dependent", "pd", "od", "dataGraph2"))));
    assertThat(resourceDescriptions.get(createHttpUri("dependent")), contains(
            contextAwareStatementIsEqual(createHttpStatement("dependent", "pd", "od", "dataGraph2"))));
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:44,代码来源:FusionToolDpuComponentFactoryTest.java

示例8: resolutionStrategyWithDependsOn

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
private ResolutionStrategyImpl resolutionStrategyWithDependsOn(URI dependsOn) {
    return new ResolutionStrategyImpl("XXX123", EnumCardinality.MANYVALUED, EnumAggregationErrorStrategy.IGNORE,
            Collections.<String, String>emptyMap(), dependsOn);
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:5,代码来源:ResourceDescriptionConflictResolverImplTest.java

示例9: getsExternalSortingInputLoader

import cz.cuni.mff.odcleanstore.conflictresolution.impl.ResolutionStrategyImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void getsExternalSortingInputLoader() throws Exception {
    // Arrange
    File workingDir = testDir.newFolder("wd");
    when(dpuContext.getWorkingDir()).thenReturn(workingDir);
    ConfigContainer config = mock(ConfigContainer.class);
    when(config.isLocalCopyProcessing()).thenReturn(true);
    when(config.getParserConfig()).thenReturn(FTConfigConstants.DEFAULT_FILE_PARSER_CONFIG);
    when(config.getPropertyResolutionStrategies()).thenReturn(ImmutableMap.<URI, ResolutionStrategy>of(
            createHttpUri("resourceDescriptionProperty"), new ResolutionStrategyImpl(NestedResourceDescriptionResolution.getName())
    ));
    ImmutableList<Statement> inputTriples1 = ImmutableList.of(
            createHttpStatement("a1", "pa1", "oa1", "dataGraph1"),
            createHttpStatement("b1", "resourceDescriptionProperty", "dependent", "dataGraph1"),
            createHttpStatement("c1", "pc1", "oc1", "otherGraphShouldBeIgnored")
    );
    ImmutableList<Statement> inputTriples2 = ImmutableList.of(
            createHttpStatement("a2", "pa2", "oa2", "dataGraph2"),
            createHttpStatement("dependent", "pd", "od", "dataGraph2")
    );

    // Act
    Map<URI, Collection<Statement>> resourceDescriptions;
    try (MockRDFDataUnit source1 = dataUnitWithGraph(inputTriples1, createHttpUri("dataGraph1"));
         MockRDFDataUnit source2 = dataUnitWithGraph(inputTriples2, createHttpUri("dataGraph2"));
         InputLoader inputLoader = getComponentFactory(config, ImmutableList.of(source1, source2)).getInputLoader()
    ) {
        inputLoader.initialize(uriMapping);
        resourceDescriptions = collectResourcesDescriptions(inputLoader);
    }

    // Assert
    assertThat(resourceDescriptions.keySet(), containsInAnyOrder(createHttpUri("a1"), createHttpUri("b1"), createHttpUri("dependent")));
    assertThat(resourceDescriptions.get(createHttpUri("a1")), containsInAnyOrder(
            contextAwareStatementIsEqual(createHttpStatement("a1", "pa1", "oa1", "dataGraph1")),
            contextAwareStatementIsEqual(createHttpStatement("a2", "pa2", "oa2", "dataGraph2"))));
    assertThat(resourceDescriptions.get(createHttpUri("b1")), containsInAnyOrder(
            contextAwareStatementIsEqual(createHttpStatement("b1", "resourceDescriptionProperty", "dependent", "dataGraph1")),
            contextAwareStatementIsEqual(createHttpStatement("dependent", "pd", "od", "dataGraph2"))));
    assertThat(resourceDescriptions.get(createHttpUri("dependent")), contains(
            contextAwareStatementIsEqual(createHttpStatement("dependent", "pd", "od", "dataGraph2"))));
}
 
开发者ID:mifeet,项目名称:FusionTool-DPU,代码行数:44,代码来源:FusionToolDpuComponentFactoryTest.java


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