edu.stanford.nlp.ie
Class ExtractorUtilities

java.lang.Object
  |
  +--edu.stanford.nlp.ie.ExtractorUtilities

public class ExtractorUtilities
extends Object

Utility class for deserializing FieldExtractors from files.


Method Summary
static edu.unika.aifb.kaon.Concept getConcept(edu.unika.aifb.kaon.Ontology o, String name)
          Returns the Concept with the given name from the given Ontology, or null if none is found.
static edu.unika.aifb.kaon.Relation getRelation(edu.unika.aifb.kaon.Ontology o, String name)
          Returns the Relation with the given name from the given Ontology, or null if none is found.
static FieldExtractor[] loadAllExtractors(File dir)
          Looks for all .obj files in the given directory and tries to load them as FieldExtractors.
static FieldExtractor loadExtractor(File in)
          Reads in a previously serialized FieldExtractor from the given input file and returns it.
static InstanceMerger loadMerger(File in)
          Reads in a previously serialized InstanceMerger from the given input file and returns it.
static edu.unika.aifb.kaon.Ontology loadOntology(String fileNameOrURL)
          Creates a new Ontology by reading in the given file or URL, which should be a .kaon file.
static void storeRDF(edu.unika.aifb.kaon.Ontology o, File f)
          Serializes the given Ontology as RDF (XML) text to the given File.
static void storeRDF(edu.unika.aifb.kaon.Ontology o, PrintStream out)
          Writes out RDF text (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadExtractor

public static FieldExtractor loadExtractor(File in)
Reads in a previously serialized FieldExtractor from the given input file and returns it. Returns null if reading the file fails.


loadAllExtractors

public static FieldExtractor[] loadAllExtractors(File dir)
Looks for all .obj files in the given directory and tries to load them as FieldExtractors. Returns all the successfully loaded FieldExtractors in the given array. The array may have 0 elements if no FieldExtractors are successfully loaded, but will not be null. This method does not currently load .obj files recursively from sub directories, so everything has to be just sitting in the given dir (this could be changed if we want to start maintaining a large collection of serialized FieldExtractors.


loadMerger

public static InstanceMerger loadMerger(File in)
Reads in a previously serialized InstanceMerger from the given input file and returns it. Returns null if reading the file fails.


storeRDF

public static void storeRDF(edu.unika.aifb.kaon.Ontology o,
                            PrintStream out)
                     throws IOException,
                            org.w3c.rdf.model.ModelException,
                            org.w3c.rdf.syntax.SerializationException
Writes out RDF text (i.e. XML) representing the given Ontology to the given PrintStream.

IOException
org.w3c.rdf.model.ModelException
org.w3c.rdf.syntax.SerializationException

storeRDF

public static void storeRDF(edu.unika.aifb.kaon.Ontology o,
                            File f)
                     throws IOException,
                            org.w3c.rdf.model.ModelException,
                            org.w3c.rdf.syntax.SerializationException
Serializes the given Ontology as RDF (XML) text to the given File.

IOException
org.w3c.rdf.model.ModelException
org.w3c.rdf.syntax.SerializationException

getConcept

public static edu.unika.aifb.kaon.Concept getConcept(edu.unika.aifb.kaon.Ontology o,
                                                     String name)
Returns the Concept with the given name from the given Ontology, or null if none is found. The name should be as defined in the ontology file, as it must be fetched via its URI. Note that the URI of the ontology is recoverable from the given Ontology, so just pass the name of the Concept itself.


getRelation

public static edu.unika.aifb.kaon.Relation getRelation(edu.unika.aifb.kaon.Ontology o,
                                                       String name)
Returns the Relation with the given name from the given Ontology, or null if none is found. The name should be as defined in the ontology file, as it must be fetched via its URI. Note that the URI of the ontology is recoverable from the given Ontology, so just pass the name of the Relation itself.


loadOntology

public static edu.unika.aifb.kaon.Ontology loadOntology(String fileNameOrURL)
Creates a new Ontology by reading in the given file or URL, which should be a .kaon file. Returns null if there is an error parsing or loading the model.



Stanford NLP Group