org.semanticweb.elk.reasoner.taxonomy
Class TaxonomyPrinter

java.lang.Object
  extended by org.semanticweb.elk.reasoner.taxonomy.TaxonomyPrinter

public class TaxonomyPrinter
extends Object

Class of static helper functions for printing and hashing a taxonomy. It is primarily intended to be used for controlling the output of classification.

Author:
Markus Kroetzsch

Field Summary
protected static Comparator<ElkClass> CLASS_COMPARATOR
           
protected static Comparator<ElkNamedIndividual> INDIVIDUAL_COMPARATOR
           
 
Constructor Summary
TaxonomyPrinter()
           
 
Method Summary
static void dumpClassTaxomomy(Taxonomy<ElkClass> taxonomy, Writer writer, boolean addHash)
          Print the contents of the given Taxonomy to the specified Writer.
static void dumpClassTaxomomyToFile(Taxonomy<ElkClass> taxonomy, String fileName, boolean addHash)
          Convenience method for printing a Taxonomy to a file at the given location.
static void dumpInstanceTaxomomy(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy, Writer writer, boolean addHash)
          Print the contents of the given InstanceTaxonomy to the specified Writer.
static void dumpInstanceTaxomomyToFile(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy, String fileName, boolean addHash)
          Convenience method for printing an InstanceTaxonomy to a file at the given location.
static String getHashString(Taxonomy<ElkClass> taxonomy)
          Get a has string for the given Taxonomy.
static String getInstanceHashString(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy)
           
protected static void printClassAxioms(ElkClass elkClass, ArrayList<ElkClass> orderedEquivalentClasses, TreeSet<ElkClass> orderedSubClasses, Appendable writer)
          Process axioms related to one ElkClass, where the relevant related classes are given in two ordered collections of equivalent classes and subclasses, respectively.
protected static void printDeclarations(Taxonomy<ElkClass> classTaxonomy, ElkObjectFactory objectFactory, Appendable writer)
          Prints class declarations
protected static void printIndividualAxioms(ElkNamedIndividual individual, ArrayList<ElkNamedIndividual> orderedSameIndividuals, TreeSet<ElkClass> orderedDirectClasses, ElkObjectFactory objectFactory, Writer writer)
           
protected static void printIndividualDeclarations(Set<? extends InstanceNode<ElkClass,ElkNamedIndividual>> individualNodes, ElkObjectFactory objectFactory, Writer writer)
           
protected static void processInstanceTaxomomy(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy, Writer writer)
           
protected static void processTaxomomy(Taxonomy<ElkClass> classTaxonomy, Appendable writer)
          Process a taxonomy and write a normalized serialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_COMPARATOR

protected static Comparator<ElkClass> CLASS_COMPARATOR

INDIVIDUAL_COMPARATOR

protected static Comparator<ElkNamedIndividual> INDIVIDUAL_COMPARATOR
Constructor Detail

TaxonomyPrinter

public TaxonomyPrinter()
Method Detail

dumpClassTaxomomyToFile

public static void dumpClassTaxomomyToFile(Taxonomy<ElkClass> taxonomy,
                                           String fileName,
                                           boolean addHash)
                                    throws IOException
Convenience method for printing a Taxonomy to a file at the given location.

Parameters:
taxonomy -
fileName -
addHash - if true, a hash string will be added at the end of the output using comment syntax of OWL 2 Functional Style
Throws:
IOException - If an I/O error occurs
See Also:
dumpClassTaxomomy(org.semanticweb.elk.reasoner.taxonomy.model.Taxonomy, java.io.Writer, boolean)

dumpClassTaxomomy

public static void dumpClassTaxomomy(Taxonomy<ElkClass> taxonomy,
                                     Writer writer,
                                     boolean addHash)
                              throws IOException
Print the contents of the given Taxonomy to the specified Writer. Expressions are ordered for generating the output, ensuring that the output is deterministic.

Parameters:
taxonomy -
writer -
addHash - if true, a hash string will be added at the end of the output using comment syntax of OWL 2 Functional Style
Throws:
IOException - If an I/O error occurs

dumpInstanceTaxomomyToFile

public static void dumpInstanceTaxomomyToFile(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy,
                                              String fileName,
                                              boolean addHash)
                                       throws IOException
Convenience method for printing an InstanceTaxonomy to a file at the given location.

Parameters:
taxonomy -
fileName -
addHash - if true, a hash string will be added at the end of the output using comment syntax of OWL 2 Functional Style
Throws:
IOException - If an I/O error occurs
See Also:
dumpInstanceTaxomomy(org.semanticweb.elk.reasoner.taxonomy.model.InstanceTaxonomy, java.io.Writer, boolean)

dumpInstanceTaxomomy

public static void dumpInstanceTaxomomy(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy,
                                        Writer writer,
                                        boolean addHash)
                                 throws IOException
Print the contents of the given InstanceTaxonomy to the specified Writer. Expressions are ordered for generating the output, ensuring that the output is deterministic.

Parameters:
taxonomy -
writer -
addHash - if true, a hash string will be added at the end of the output using comment syntax of OWL 2 Functional Style
Throws:
IOException - If an I/O error occurs

getHashString

public static String getHashString(Taxonomy<ElkClass> taxonomy)
Get a has string for the given Taxonomy. Besides possible hash collisions (which have very low probability) the hash string is the same for two inputs if and only if the inputs describe the same taxonomy. So it can be used to compare classification results.

Parameters:
taxonomy -
Returns:
hash string

getInstanceHashString

public static String getInstanceHashString(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy)

processTaxomomy

protected static void processTaxomomy(Taxonomy<ElkClass> classTaxonomy,
                                      Appendable writer)
                               throws IOException
Process a taxonomy and write a normalized serialization.

Parameters:
classTaxonomy -
writer -
Throws:
IOException

printDeclarations

protected static void printDeclarations(Taxonomy<ElkClass> classTaxonomy,
                                        ElkObjectFactory objectFactory,
                                        Appendable writer)
                                 throws IOException
Prints class declarations

Parameters:
classTaxonomy -
objectFactory -
writer -
Throws:
IOException

printIndividualDeclarations

protected static void printIndividualDeclarations(Set<? extends InstanceNode<ElkClass,ElkNamedIndividual>> individualNodes,
                                                  ElkObjectFactory objectFactory,
                                                  Writer writer)
                                           throws IOException
Throws:
IOException

printClassAxioms

protected static void printClassAxioms(ElkClass elkClass,
                                       ArrayList<ElkClass> orderedEquivalentClasses,
                                       TreeSet<ElkClass> orderedSubClasses,
                                       Appendable writer)
                                throws IOException
Process axioms related to one ElkClass, where the relevant related classes are given in two ordered collections of equivalent classes and subclasses, respectively. The method serializes the axioms to the Writer.

Parameters:
elkClass -
orderedEquivalentClasses -
orderedSubClasses -
writer -
Throws:
IOException

printIndividualAxioms

protected static void printIndividualAxioms(ElkNamedIndividual individual,
                                            ArrayList<ElkNamedIndividual> orderedSameIndividuals,
                                            TreeSet<ElkClass> orderedDirectClasses,
                                            ElkObjectFactory objectFactory,
                                            Writer writer)
                                     throws IOException
Throws:
IOException

processInstanceTaxomomy

protected static void processInstanceTaxomomy(InstanceTaxonomy<ElkClass,ElkNamedIndividual> taxonomy,
                                              Writer writer)
                                       throws IOException
Throws:
IOException


Copyright © 2011-2013 Department of Computer Science, University of Oxford. All Rights Reserved.