Skip to content

2.3 ExampleGenerator

Axel Ngonga edited this page Jul 8, 2014 · 6 revisions


The aim of the example generators is to select a portion from the subject object pairs of a given knowledge bases that will allow the extraction approaches to converge faster towards an adequate set of XPath expressions without having to learn from too many examples. Overall, the interface includes a series of methods that need to be implement. With the simple and uniform example generators, we provide two implementations of the methods presented below.


The following methods need to be implemented to set the parameters used by the generator.

(1) The SPARQL endpoint (which can actually be derived from a Jena model) needs to be set by implementing the following method:

	void setEndpoint(SparqlEndpoint e);

(2) The following method sets the predicate that is to be used during the example generation process, i.e., the predicate for which subject-object-pairs are to be returned:

	void setPredicate(Property p);

(3) The following method returns selected subject-object pairs according to a user-defined strategy. It is one of the key methods that leads to different behaviors across different example generation approaches :

	Set<Pair<Resource, Resource>> getPositiveExamples();

(4) The following simply returns all examples it could get:

	Set<Pair<Resource, Resource>> getAllPositiveExamples();

(5) Similar to get positive examples and also key to the behavior of the sampling approach is the following method:

	Set<Pair<Resource, Resource>> getNegativeExamples();

(6) Set how many example should be returned by the getPositiveExamples resp getNegativeExamples method:

	void setMaxNrOfPositiveExamples(int maxNrOfPositiveExamples);
	void setMaxNrOfNegativeExamples(int maxNrOfNegativeExamples);
You can’t perform that action at this time.