public abstract class AbstractExtractorTestCase extends AbstractAny23TestBase
Extractor
specific test cases.| Modifier and Type | Field and Description |
|---|---|
protected static org.openrdf.model.URI |
baseURI
Base test document.
|
tempDirectory, testFolder| Constructor and Description |
|---|
AbstractExtractorTestCase()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
String l)
Assert that the model contains the statement
(s p l) where l is a literal. |
protected void |
assertContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
String l,
String lang)
Assert that the model contains the statement
(s p l) where l
is a language literal. |
protected void |
assertContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
Asserts that the extracted triples contain the pattern
(s p o). |
protected void |
assertContains(org.openrdf.model.Statement statement)
Checks that a statement is contained in the extracted model.
|
protected void |
assertContains(org.openrdf.model.URI p,
org.openrdf.model.Resource o)
Asserts that the extracted triples contain the pattern
(_ p o). |
protected void |
assertContains(org.openrdf.model.URI p,
String o)
Asserts that the extracted triples contain the pattern
(_ p o). |
void |
assertContainsModel(org.openrdf.model.Statement[] statements)
Verifies that the current model contains all the given statements.
|
void |
assertContainsModel(String modelResource)
Verifies that the current model contains all the statements declared in the
specified
modelFile. |
protected void |
assertExtract(String resource)
Performs data extraction over the content of a resource
and assert that the extraction was fine and raised no issues.
|
protected void |
assertExtract(String resource,
boolean assertNoIssues)
Performs data extraction over the content of a resource
and assert that the extraction was fine.
|
protected void |
assertIssue(IssueReport.IssueLevel level,
String issueRegex)
Asserts that an issue has been produced by the processed
Extractor. |
protected void |
assertModelEmpty()
Asserts that the model is expected to contains no statements.
|
protected void |
assertModelNotEmpty()
Asserts that the model contains at least a statement.
|
protected void |
assertNoIssues()
Asserts that the extraction generated no issues.
|
protected void |
assertNotContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Literal o)
Asserts that the model doesn't contain the pattern
(s p o) |
protected void |
assertNotContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Resource o)
Asserts that the extracted triples contain the pattern
(s p o). |
protected void |
assertNotContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
String o)
Asserts that the extracted triples contain the pattern
(s p o). |
protected void |
assertNotContains(org.openrdf.model.URI p,
org.openrdf.model.Resource o)
Asserts that the extracted triples contain the pattern
(_ p o). |
protected void |
assertNotFound(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
Asserts that the given pattern
(s p _) is not present. |
protected void |
assertStatementsSize(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
int expected)
Asserts that the given pattern
(s p o) satisfies the expected number of statements. |
protected void |
assertStatementsSize(org.openrdf.model.URI p,
String o,
int expected)
Asserts that the given pattern
(_ p o) satisfies the expected number of statements. |
protected void |
assertStatementsSize(org.openrdf.model.URI p,
org.openrdf.model.Value o,
int expected)
Asserts that the given pattern
(_ p o) satisfies the expected number of statements. |
protected List<org.openrdf.model.Statement> |
dumpAsListOfStatements()
Dumps the list of statements contained in the extracted model.
|
protected String |
dumpHumanReadableTriples() |
protected String |
dumpModelToNQuads()
Dumps the extracted model in NQuads format.
|
protected String |
dumpModelToRDFXML()
Dumps the extracted model in RDFXML format.
|
protected String |
dumpModelToTurtle()
Dumps the extracted model in Turtle format.
|
protected void |
extract(String resource)
Applies the extractor provided by the
getExtractorFactory() to the specified resource. |
protected org.openrdf.model.Resource |
findExactlyOneBlankSubject(org.openrdf.model.URI p,
org.openrdf.model.Value o)
Returns the blank subject matching the pattern
(_:b p o),
it is expected to exists and be just one. |
protected org.openrdf.model.Value |
findExactlyOneObject(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
Returns the object matching the pattern
(s p o),
it is expected to exists and be just one. |
protected org.openrdf.model.Value |
findObject(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
Finds the object matching the pattern
(s p _), asserts to find
exactly one result. |
protected String |
findObjectAsLiteral(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
Finds the literal object matching the pattern
(s p _), asserts to find
exactly one result. |
protected org.openrdf.model.Resource |
findObjectAsResource(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
Finds the resource object matching the pattern
(s p _), asserts to find
exactly one result. |
protected List<org.openrdf.model.Value> |
findObjects(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
Returns all the objects matching the pattern
(s p _). |
protected List<org.openrdf.model.Resource> |
findSubjects(org.openrdf.model.URI p,
org.openrdf.model.Value o)
Returns all the subjects matching the pattern
(s? p o). |
protected org.openrdf.repository.RepositoryConnection |
getConnection() |
protected abstract ExtractorFactory<?> |
getExtractorFactory() |
protected Collection<IssueReport.Issue> |
getIssues()
Returns the list of issues raised by the extractor under testing.
|
protected Collection<IssueReport.Issue> |
getIssues(String extractorName)
Returns the list of issues raised by a given extractor.
|
protected SingleDocumentExtractionReport |
getReport() |
protected org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> |
getStatements(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
Returns all statements matching the pattern
(s p o). |
protected int |
getStatementsSize(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
Counts all statements matching the pattern
(s p o). |
void |
setUp()
Test case initialization.
|
void |
tearDown()
Test case resources release.
|
copyResourceToTempFile, getDocumentSourceFromResource, getDocumentSourceFromResourceprotected abstract ExtractorFactory<?> getExtractorFactory()
public void setUp()
throws Exception
setUp in class AbstractAny23TestBaseExceptionpublic void tearDown()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected org.openrdf.repository.RepositoryConnection getConnection()
protected SingleDocumentExtractionReport getReport()
protected Collection<IssueReport.Issue> getIssues(String extractorName)
extractorName - name of the extractor.protected Collection<IssueReport.Issue> getIssues()
protected void extract(String resource) throws ExtractionException, IOException
getExtractorFactory() to the specified resource.resource - resource name.ExtractionExceptionIOExceptionprotected void assertExtract(String resource, boolean assertNoIssues)
resource - resource name.assertNoIssues - if trueinvokes assertNoIssues() after the extraction.protected void assertExtract(String resource)
resource - protected void assertContains(org.openrdf.model.URI p,
org.openrdf.model.Resource o)
throws org.openrdf.repository.RepositoryException
(_ p o).p - predicateo - object.org.openrdf.repository.RepositoryExceptionprotected void assertContains(org.openrdf.model.URI p,
String o)
throws org.openrdf.repository.RepositoryException
(_ p o).p - predicateo - object.org.openrdf.repository.RepositoryExceptionprotected void assertNotContains(org.openrdf.model.URI p,
org.openrdf.model.Resource o)
throws org.openrdf.repository.RepositoryException
(_ p o).p - predicateo - object.org.openrdf.repository.RepositoryExceptionprotected void assertContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
throws org.openrdf.repository.RepositoryException
(s p o).s - subject.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected void assertNotContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
String o)
throws org.openrdf.repository.RepositoryException
(s p o).s - subject.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected void assertNotContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Resource o)
throws org.openrdf.repository.RepositoryException
(s p o).s - subject.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected void assertModelNotEmpty()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected void assertNotContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Literal o)
throws org.openrdf.repository.RepositoryException
(s p o)s - subject.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected void assertModelEmpty()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected void assertNoIssues()
protected void assertIssue(IssueReport.IssueLevel level, String issueRegex)
Extractor.level - expected issue levelissueRegex - regex matching the expected human readable issue message.public void assertContainsModel(org.openrdf.model.Statement[] statements)
throws org.openrdf.repository.RepositoryException
statements - list of statements to be verified.org.openrdf.repository.RepositoryExceptionpublic void assertContainsModel(String modelResource) throws org.openrdf.rio.RDFHandlerException, IOException, org.openrdf.rio.RDFParseException, org.openrdf.repository.RepositoryException
modelFile.modelResource - the resource containing the model.org.openrdf.rio.RDFHandlerExceptionIOExceptionorg.openrdf.rio.RDFParseExceptionorg.openrdf.repository.RepositoryExceptionprotected void assertStatementsSize(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
int expected)
throws org.openrdf.repository.RepositoryException
(s p o) satisfies the expected number of statements.s - subject.p - predicate.o - object.expected - expected matches.org.openrdf.repository.RepositoryExceptionprotected void assertStatementsSize(org.openrdf.model.URI p,
org.openrdf.model.Value o,
int expected)
throws org.openrdf.repository.RepositoryException
(_ p o) satisfies the expected number of statements.p - predicate.o - object.expected - expected matches.org.openrdf.repository.RepositoryExceptionprotected void assertStatementsSize(org.openrdf.model.URI p,
String o,
int expected)
throws org.openrdf.repository.RepositoryException
(_ p o) satisfies the expected number of statements.p - predicate.o - object.expected - expected matches.org.openrdf.repository.RepositoryExceptionprotected void assertNotFound(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
throws org.openrdf.repository.RepositoryException
(s p _) is not present.s - subject.p - predicate.org.openrdf.repository.RepositoryExceptionprotected org.openrdf.model.Resource findExactlyOneBlankSubject(org.openrdf.model.URI p,
org.openrdf.model.Value o)
throws org.openrdf.repository.RepositoryException
(_:b p o),
it is expected to exists and be just one.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected org.openrdf.model.Value findExactlyOneObject(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
throws org.openrdf.repository.RepositoryException
(s p o),
it is expected to exists and be just one.s - subject.p - predicate.org.openrdf.repository.RepositoryExceptionprotected List<org.openrdf.model.Resource> findSubjects(org.openrdf.model.URI p, org.openrdf.model.Value o) throws org.openrdf.repository.RepositoryException
(s? p o).p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected List<org.openrdf.model.Value> findObjects(org.openrdf.model.Resource s, org.openrdf.model.URI p) throws org.openrdf.repository.RepositoryException
(s p _).s - predicate.p - predicate.org.openrdf.repository.RepositoryExceptionprotected org.openrdf.model.Value findObject(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
throws org.openrdf.repository.RepositoryException
(s p _), asserts to find
exactly one result.s - subject.p - predicateorg.openrdf.repository.RepositoryExceptionprotected org.openrdf.model.Resource findObjectAsResource(org.openrdf.model.Resource s,
org.openrdf.model.URI p)
throws org.openrdf.repository.RepositoryException
(s p _), asserts to find
exactly one result.s - subject.p - predicate.org.openrdf.repository.RepositoryExceptionprotected String findObjectAsLiteral(org.openrdf.model.Resource s, org.openrdf.model.URI p) throws org.openrdf.repository.RepositoryException
(s p _), asserts to find
exactly one result.s - subject.p - predicate.org.openrdf.repository.RepositoryExceptionprotected String dumpModelToTurtle() throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected String dumpModelToNQuads() throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected String dumpModelToRDFXML() throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected List<org.openrdf.model.Statement> dumpAsListOfStatements() throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected String dumpHumanReadableTriples() throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected void assertContains(org.openrdf.model.Statement statement)
throws org.openrdf.repository.RepositoryException
_ patterns.statement - org.openrdf.repository.RepositoryExceptionprotected void assertContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
String l)
throws org.openrdf.repository.RepositoryException
(s p l) where l is a literal.s - subject.p - predicate.l - literal content.org.openrdf.repository.RepositoryExceptionprotected void assertContains(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
String l,
String lang)
throws org.openrdf.repository.RepositoryException
(s p l) where l
is a language literal.s - subject.p - predicate.l - literal content.lang - literal language.org.openrdf.repository.RepositoryExceptionprotected org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatements(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
throws org.openrdf.repository.RepositoryException
(s p o).s - subject.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionprotected int getStatementsSize(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
throws org.openrdf.repository.RepositoryException
(s p o).s - subject.p - predicate.o - object.org.openrdf.repository.RepositoryExceptionCopyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.