org.eaglei.search.datagen
Class AbstractGenerator

java.lang.Object
  extended by org.eaglei.search.datagen.AbstractGenerator

public abstract class AbstractGenerator
extends java.lang.Object

Abstract base class for logic that auto-generating fake data based on the eagle-i ontology.


Field Summary
protected  org.eaglei.model.EIOntModel eagleiOntModel
           
 
Constructor Summary
AbstractGenerator(org.eaglei.model.EIOntModel eagleiOntModel)
           
 
Method Summary
abstract  void closeStorage()
          Closes the generator-specific storage.
static java.io.File ensureOutputDirectory(java.lang.String outputPath)
          Creates the output directory if it does not exist.
 void generate(DataGenParams params)
          Generates for each institution specified in the params.
 int generateForInstitution(java.lang.String uri, java.lang.String label, DataGenParams genParams)
          Populates the Lucene index for a single university.
 int generateLab(java.lang.String institutionURI, java.lang.String institutionLabel, java.lang.String labLabel, java.lang.String labURI, java.lang.String labURL, java.lang.String labTypeURI, DataGenParams genParams)
          Generates the test RDF for a single research facility
abstract  void generateResource(java.lang.String institutionURI, java.lang.String institutionLabel, java.lang.String resourceLabel, java.lang.String resourceURI, com.hp.hpl.jena.ontology.OntClass resourceClass, java.lang.String resourceURL, java.lang.String labName, java.lang.String labURI, DataGenParams genParams)
          Generates the data for a specific resource.
static java.lang.String getCoreFacilityName(java.lang.String institutionName, int coreNumber, DataGenParams genParams)
          Retrieves the name for a core instance given generation index.
static java.lang.String getCoreFacilityURI(java.lang.String institutionURI, int coreNumber, DataGenParams genParams)
          Retrieves the URI for a core instance given generation index.
static java.lang.String getResearchFacilityName(java.lang.String institutionName, int number, DataGenParams genParams)
          Retrieves the name for a research facility instance given generation index.
static java.lang.String getResearchFacilityURI(java.lang.String institutionURI, int number, DataGenParams genParams)
          Retrieves the URI for a research facility instance given generation index.
static java.lang.String getResourceName(int typeCount, com.hp.hpl.jena.ontology.OntClass resourceClass)
          Retrieves the name for a resource instance given generation index and class
static java.lang.String getResourceURI(int resourceCount, java.lang.String labURI)
          Retrieves the URI for a resource given the generation index and lab resource.
 java.util.List<com.hp.hpl.jena.ontology.OntClass> getSubClasses(java.lang.String uri)
          Cached retrieval of subclasses for a given class.
static java.util.List<org.eaglei.model.EIClass> getTypes(org.eaglei.model.EIOntModel eagleiOntModel, com.hp.hpl.jena.ontology.OntClass ontClass, boolean materializeHierarchy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eagleiOntModel

protected final org.eaglei.model.EIOntModel eagleiOntModel
Constructor Detail

AbstractGenerator

public AbstractGenerator(org.eaglei.model.EIOntModel eagleiOntModel)
                  throws java.io.IOException
Throws:
java.io.IOException
Method Detail

generate

public void generate(DataGenParams params)
              throws java.io.IOException
Generates for each institution specified in the params.

Parameters:
params -
Throws:
java.io.IOException

closeStorage

public abstract void closeStorage()
                           throws java.io.IOException
Closes the generator-specific storage.

Throws:
java.io.IOException

generateForInstitution

public int generateForInstitution(java.lang.String uri,
                                  java.lang.String label,
                                  DataGenParams genParams)
                           throws java.io.IOException
Populates the Lucene index for a single university.

Parameters:
uri - The institution URI
label - The institution label
genParams - Parameters that controls how the data for the institution is generated.
writer - The index writer for the directory.
Returns:
Total numb
Throws:
java.io.IOException - Thrown if an error is encountered during data gen.

generateLab

public int generateLab(java.lang.String institutionURI,
                       java.lang.String institutionLabel,
                       java.lang.String labLabel,
                       java.lang.String labURI,
                       java.lang.String labURL,
                       java.lang.String labTypeURI,
                       DataGenParams genParams)
                throws java.io.IOException
Generates the test RDF for a single research facility

Parameters:
label - Label for the lab resource
labURI - URI for the lab
labTypeURI - URI for the lab subclass
labNumber - Number of the lab.
university - RDF resource that represents the university.
genParams - Parameters that controls how the data for the lab is generated.
Returns:
Total number of resources generated.
Throws:
java.io.IOException - Thrown if an error is encountered.

generateResource

public abstract void generateResource(java.lang.String institutionURI,
                                      java.lang.String institutionLabel,
                                      java.lang.String resourceLabel,
                                      java.lang.String resourceURI,
                                      com.hp.hpl.jena.ontology.OntClass resourceClass,
                                      java.lang.String resourceURL,
                                      java.lang.String labName,
                                      java.lang.String labURI,
                                      DataGenParams genParams)
                               throws java.io.IOException
Generates the data for a specific resource.

Parameters:
institutionURI -
institutionLabel -
resourceLabel -
resourceURI -
resourceClass -
labName -
labURI -
genParams -
Throws:
java.io.IOException

ensureOutputDirectory

public static java.io.File ensureOutputDirectory(java.lang.String outputPath)
                                          throws java.io.IOException
Creates the output directory if it does not exist.

Parameters:
outputPath -
Returns:
The created directory or null if there was an error.
Throws:
java.io.IOException

getCoreFacilityName

public static java.lang.String getCoreFacilityName(java.lang.String institutionName,
                                                   int coreNumber,
                                                   DataGenParams genParams)
Retrieves the name for a core instance given generation index.

Parameters:
coreNumber - Number generated.
genParams - Generation parameters.
Returns:
Name to use.

getCoreFacilityURI

public static java.lang.String getCoreFacilityURI(java.lang.String institutionURI,
                                                  int coreNumber,
                                                  DataGenParams genParams)
Retrieves the URI for a core instance given generation index.

Parameters:
coreNumber - Number generated.
genParams - Generation parameters.
Returns:
URI to use.

getResearchFacilityName

public static java.lang.String getResearchFacilityName(java.lang.String institutionName,
                                                       int number,
                                                       DataGenParams genParams)
Retrieves the name for a research facility instance given generation index.

Parameters:
number - Number generated.
genParams - Generation parameters.
Returns:
Name to use.

getResearchFacilityURI

public static java.lang.String getResearchFacilityURI(java.lang.String institutionURI,
                                                      int number,
                                                      DataGenParams genParams)
Retrieves the URI for a research facility instance given generation index.

Parameters:
number - Number generated.
genParams - Generation parameters.
Returns:
URI to use.

getResourceURI

public static java.lang.String getResourceURI(int resourceCount,
                                              java.lang.String labURI)
Retrieves the URI for a resource given the generation index and lab resource.

Parameters:
resourceCount - Total number of resources generated for this lab.
labURI - URI of the lab
Returns:
URI to use.

getResourceName

public static java.lang.String getResourceName(int typeCount,
                                               com.hp.hpl.jena.ontology.OntClass resourceClass)
Retrieves the name for a resource instance given generation index and class

Parameters:
typeCount - Number generated of resources of this type generated for this lab.
resourceClass - Class of the res0ource.
Returns:
Name to use.

getSubClasses

public java.util.List<com.hp.hpl.jena.ontology.OntClass> getSubClasses(java.lang.String uri)
Cached retrieval of subclasses for a given class.

Parameters:
uri -
Returns:

getTypes

public static java.util.List<org.eaglei.model.EIClass> getTypes(org.eaglei.model.EIOntModel eagleiOntModel,
                                                                com.hp.hpl.jena.ontology.OntClass ontClass,
                                                                boolean materializeHierarchy)


Copyright © 2009-2010 Eagle-I. All Rights Reserved.