@Test public void mapsUris() throws Exception { Resource resource = createHttpUri("sx"); ResourceDescriptionConflictResolver resolver = createResolver(); Collection<Statement> testInput = ImmutableList.of( createHttpStatement("sa", "pa", "oa", "g1"), createHttpStatement("sb", "pb", "ob", "g2"), createHttpStatement("sa", "p1", "oa", "ga") ); Collection<ResolvedStatement> result = resolver.resolveConflicts(new ResourceDescriptionImpl(resource, testInput)); List<ResolvedStatement> expectedStatements = ImmutableList.of( (ResolvedStatement) new ResolvedStatementImpl(createHttpStatement("sx", "px", "ox"), 0, ImmutableSet.of((Resource) createHttpUri("g1"))), new ResolvedStatementImpl(createHttpStatement("sx", "px", "ox"), 0, ImmutableSet.of((Resource) createHttpUri("g2"))), new ResolvedStatementImpl(createHttpStatement("sx", "p1", "ox"), 0, ImmutableSet.of((Resource) createHttpUri("ga")))); assertThat(result, hasSize(expectedStatements.size())); for (ResolvedStatement expectedStatement : expectedStatements) { assertThat(result, hasItem(allOf( resolvedStatementMatchesStatement(expectedStatement.getStatement()), resolvedStatementMatchesSources((Set<Resource>) expectedStatement.getSourceGraphNames())))); } }
@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(); }
ResourceDescriptionConflictResolverImpl implements ResourceDescriptionConflictResolver { @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(); } }
ResourceDescriptionConflictResolverImpl implements ResourceDescriptionConflictResolver { @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(); } ResourceDescriptionConflictResolverImpl(
            ResolutionFunctionRegistry resolutionFunctionRegistry,
            ConflictResolutionPolicy conflictResolutionPolicy,
            UriMapping uriMapping,
            Model metadata,
            String resolvedGraphsURIPrefix, // TODO: replace with UriGenerator class generating uris both for contexts and generated dependent resources
            NestedResourceDescriptionQualityCalculator nestedResourceDescriptionQualityCalculator); }
ResourceDescriptionConflictResolverImpl implements ResourceDescriptionConflictResolver { @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(); } ResourceDescriptionConflictResolverImpl(
            ResolutionFunctionRegistry resolutionFunctionRegistry,
            ConflictResolutionPolicy conflictResolutionPolicy,
            UriMapping uriMapping,
            Model metadata,
            String resolvedGraphsURIPrefix, // TODO: replace with UriGenerator class generating uris both for contexts and generated dependent resources
            NestedResourceDescriptionQualityCalculator nestedResourceDescriptionQualityCalculator); @Override Collection<ResolvedStatement> resolveConflicts(ResourceDescription resourceDescription); }
ResourceDescriptionConflictResolverImpl implements ResourceDescriptionConflictResolver { @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(); } ResourceDescriptionConflictResolverImpl(
            ResolutionFunctionRegistry resolutionFunctionRegistry,
            ConflictResolutionPolicy conflictResolutionPolicy,
            UriMapping uriMapping,
            Model metadata,
            String resolvedGraphsURIPrefix, // TODO: replace with UriGenerator class generating uris both for contexts and generated dependent resources
            NestedResourceDescriptionQualityCalculator nestedResourceDescriptionQualityCalculator); @Override Collection<ResolvedStatement> resolveConflicts(ResourceDescription resourceDescription); static final ResolutionStrategy DEFAULT_RESOLUTION_STRATEGY; static final String DEFAULT_RESOLVED_GRAPHS_URI_PREFIX; }