|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.any23.extractor.html.AbstractExtractorTestCase
public abstract class AbstractExtractorTestCase
Abstract class used to write Extractor
specific test cases.
| Field Summary | |
|---|---|
protected static org.openrdf.model.URI |
baseURI
Base test document. |
| Constructor Summary | |
|---|---|
AbstractExtractorTestCase()
Constructor. |
|
| Method Summary | |
|---|---|
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 |
assertError(org.apache.any23.extractor.ErrorReporter.ErrorLevel level,
String errorRegex)
Asserts that an error has been produced by the processed Extractor. |
protected void |
assertExtracts(String resource)
Performs data extraction over the content of a resource and assert that the extraction was correct. |
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 |
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 Collection<org.apache.any23.extractor.ErrorReporter.Error> |
getErrors(String extractorName)
Returns the list of errors raised by a given extractor. |
protected abstract org.apache.any23.extractor.ExtractorFactory<?> |
getExtractorFactory()
|
protected org.apache.any23.extractor.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.openrdf.model.URI baseURI
| Constructor Detail |
|---|
public AbstractExtractorTestCase()
| Method Detail |
|---|
protected abstract org.apache.any23.extractor.ExtractorFactory<?> getExtractorFactory()
public void setUp()
throws Exception
Exception
public void tearDown()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryExceptionprotected org.openrdf.repository.RepositoryConnection getConnection()
protected org.apache.any23.extractor.SingleDocumentExtractionReport getReport()
protected Collection<org.apache.any23.extractor.ErrorReporter.Error> getErrors(String extractorName)
extractorName - name of the extractor.
protected void extract(String resource)
throws org.apache.any23.extractor.ExtractionException,
IOException
getExtractorFactory() to the specified resource.
resource - resource name.
org.apache.any23.extractor.ExtractionException
IOExceptionprotected void assertExtracts(String resource)
resource - resource name.
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.RepositoryException
protected void assertContains(org.openrdf.model.URI p,
String o)
throws org.openrdf.repository.RepositoryException
(_ p o).
p - predicateo - object.
org.openrdf.repository.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected void assertModelNotEmpty()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected 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.RepositoryException
protected void assertModelEmpty()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected void assertError(org.apache.any23.extractor.ErrorReporter.ErrorLevel level,
String errorRegex)
Extractor.
level - expected error levelerrorRegex - regex matching the expected human readable error message.
public void assertContainsModel(org.openrdf.model.Statement[] statements)
throws org.openrdf.repository.RepositoryException
statements - list of statements to be verified.
org.openrdf.repository.RepositoryException
public 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.RDFHandlerException
IOException
org.openrdf.rio.RDFParseException
org.openrdf.repository.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected 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 - predicate
org.openrdf.repository.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
protected String dumpModelToTurtle()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected String dumpModelToNQuads()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected String dumpModelToRDFXML()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected List<org.openrdf.model.Statement> dumpAsListOfStatements()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected String dumpHumanReadableTriples()
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
protected void assertContains(org.openrdf.model.Statement statement)
throws org.openrdf.repository.RepositoryException
_ patterns.
statement -
org.openrdf.repository.RepositoryException
protected 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.RepositoryException
protected 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.RepositoryException
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)
throws org.openrdf.repository.RepositoryException
(s p o).
s - subject.p - predicate.o - object.
org.openrdf.repository.RepositoryException
protected 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.RepositoryException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||