本文整理汇总了Java中cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl类的典型用法代码示例。如果您正苦于以下问题:Java ResourceDescriptionImpl类的具体用法?Java ResourceDescriptionImpl怎么用?Java ResourceDescriptionImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceDescriptionImpl类属于cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl包,在下文中一共展示了ResourceDescriptionImpl类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getsExecutorWithEmptyInputFilter
import cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl; //导入依赖的package包/类
@Test
public void getsExecutorWithEmptyInputFilter() throws Exception {
ConfigContainer config = mock(ConfigContainer.class);
when(config.getMaxOutputTriples()).thenReturn(101L);
// Act
FusionToolDpuComponentFactory componentFactory = getComponentFactory(config);
FusionExecutor executor = componentFactory.getExecutor(uriMapping);
// Assert
assertThat(executor, instanceOf(LDFusionToolExecutor.class));
LDFusionToolExecutor typedExecutor = (LDFusionToolExecutor) executor;
assertThat(typedExecutor.getMaxOutputTriples(), is(101L));
ResourceDescriptionFilter filter = typedExecutor.getResourceDescriptionFilter();
assertTrue(filter.accept(new ResourceDescriptionImpl(createHttpUri("r1"), ImmutableList.of(createHttpStatement("r1", "p", "o")))));
assertTrue(filter.accept(new ResourceDescriptionImpl(createHttpUri("r2"),
ImmutableList.of(VF.createStatement(createHttpUri("r2"), RDF.TYPE, createHttpUri("o"))))));
assertTrue(filter.accept(new ResourceDescriptionImpl(createHttpUri("a2"), ImmutableList.of(createHttpStatement("a2", "p", "o")))));
}
示例2: getsExecutorWithClassAndMappingInputFilters
import cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl; //导入依赖的package包/类
@Test
public void getsExecutorWithClassAndMappingInputFilters() throws Exception {
ConfigContainer config = mock(ConfigContainer.class);
when(config.getMaxOutputTriples()).thenReturn(101L);
when(config.getRequiredClassOfProcessedResources()).thenReturn(createHttpUri("c"));
when(config.getOutputMappedSubjectsOnly()).thenReturn(true);
// Act
FusionToolDpuComponentFactory componentFactory = getComponentFactory(config);
FusionExecutor executor = componentFactory.getExecutor(uriMapping);
// Assert
assertThat(executor, instanceOf(LDFusionToolExecutor.class));
LDFusionToolExecutor typedExecutor = (LDFusionToolExecutor) executor;
assertThat(typedExecutor.getMaxOutputTriples(), is(101L));
ResourceDescriptionFilter filter = typedExecutor.getResourceDescriptionFilter();
assertFalse(filter.accept(new ResourceDescriptionImpl(createHttpUri("r1"), ImmutableList.of(createHttpStatement("r1", "p", "o")))));
assertFalse(filter.accept(new ResourceDescriptionImpl(createHttpUri("r2"),
ImmutableList.of(VF.createStatement(createHttpUri("r2"), RDF.TYPE, createHttpUri("c"))))));
assertFalse(filter.accept(new ResourceDescriptionImpl(createHttpUri("a2"), ImmutableList.of(createHttpStatement("a2", "p", "o")))));
assertTrue(filter.accept(new ResourceDescriptionImpl(createHttpUri("b2"),
ImmutableList.of(VF.createStatement(createHttpUri("b2"), RDF.TYPE, createHttpUri("c"))))));
}
示例3: next
import cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl; //导入依赖的package包/类
@Override
public ResourceDescription next() throws LDFusionToolException {
if (subjectsQueue == null) {
throw new IllegalStateException("Must be initialized with initialize() first");
}
String canonicalURI = canonicalSubjectsIterator.next();
if (canonicalURI == null) {
throw new NoSuchElementException();
}
addResolvedCanonicalUri(canonicalURI);
ArrayList<Statement> quads = new ArrayList<Statement>();
resourceQuadLoader.loadQuadsForURI(canonicalURI, quads);
LOG.info("Loaded {} quads for URI <{}>", quads.size(), canonicalURI);
Resource resource = quads.isEmpty() ? VF.createURI(canonicalURI) : quads.get(0).getSubject();
return new ResourceDescriptionImpl(resource, quads);
}
示例4: cancelsExecution
import cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl; //导入依赖的package包/类
@Test
public void cancelsExecution() throws Exception {
// Arrange
final TestIsCanceledCallback callback = new TestIsCanceledCallback();
LDFusionToolExecutor executor = getLDFusionToolExecutor(Long.MAX_VALUE, false);
executor.setIsCanceledCallback(callback);
final InputLoader inputLoader = Mockito.mock(InputLoader.class);
Mockito.when(inputLoader.hasNext()).thenReturn(true);
Mockito.when(inputLoader.next()).thenAnswer(new Answer<ResourceDescription>() {
@Override
public ResourceDescription answer(InvocationOnMock invocation) throws Throwable {
callback.cancel();
return new ResourceDescriptionImpl(createHttpUri("a"), ImmutableList.of(createHttpStatement("a", "b", "c")));
}
});
// Act
executor.fuse(new TestConflictResolver(), inputLoader, new TestRDFWriter());
// Assert
Mockito.verify(inputLoader, Mockito.times(1)).next();
}
示例5: next
import cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl; //导入依赖的package包/类
@Override
public ResourceDescription next() throws LDFusionToolException {
Collection<Statement> statements = iterator.next();
if (statements.isEmpty()) {
return new ResourceDescriptionImpl(null, statements);
} else {
return new ResourceDescriptionImpl(statements.iterator().next().getSubject(), statements);
}
}
示例6: next
import cz.cuni.mff.odcleanstore.fusiontool.conflictresolution.impl.ResourceDescriptionImpl; //导入依赖的package包/类
@Override
public ResourceDescription next() throws LDFusionToolException {
checkState(dataFileIterator != null);
checkState(mergedAttributeFileIterator != null);
try {
if (!dataFileIterator.hasNext()) {
throw new NoSuchElementException();
}
ArrayList<Statement> describingStatements = new ArrayList<Statement>();
// Read next record from dataFileIterator which represents the primary file
// - the subject will determine the next cluster
List<Value> nextTuple = dataFileIterator.next();
Statement firstStatement = createStatement(nextTuple);
Resource firstCanonicalSubject = (Resource) nextTuple.get(0);
// Add quads for the cluster from primary data file
describingStatements.add(firstStatement);
while (NTuplesParserUtils.hasMatchingRecord(dataFileIterator, firstCanonicalSubject)) {
describingStatements.add(createStatement(dataFileIterator.next()));
}
// Add additional quads from other files
int extendedDescriptionCount = 0;
boolean foundMatch = NTuplesParserUtils.skipLessThan(mergedAttributeFileIterator, firstCanonicalSubject, NTuplesParserUtils.VALUE_COMPARATOR);
if (foundMatch) {
while (NTuplesParserUtils.hasMatchingRecord(mergedAttributeFileIterator, firstCanonicalSubject)) {
describingStatements.add(createStatement(mergedAttributeFileIterator.next()));
extendedDescriptionCount++;
}
}
LOG.debug("Loaded {} quads for resource <{}> (including {} triples in extended description)",
new Object[]{describingStatements.size(), firstCanonicalSubject, extendedDescriptionCount});
return new ResourceDescriptionImpl(firstCanonicalSubject, describingStatements);
} catch (Exception e) {
closeOnException();
throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.INPUT_LOADER_HAS_NEXT,
"Error when reading temporary file in input loader", e);
}
}