@Test public void resolvesStatementWithEmptyGraph() throws Exception { Resource resource = createHttpUri("s"); ResourceDescriptionConflictResolver resolver = createResolver(); Statement inputStatement = createHttpStatement("s", "p", "o", null); Collection<Statement> testInput = ImmutableList.of(inputStatement); Collection<ResolvedStatement> result = resolver.resolveConflicts(new ResourceDescriptionImpl(resource, testInput)); ResolvedStatement resultStatement = Iterables.getOnlyElement(result); assertThat(resultStatement, resolvedStatementMatchesStatement(inputStatement)); }
@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; }