Package org.obolibrary.robot
Class TemplateOperation
- java.lang.Object
-
- org.obolibrary.robot.TemplateOperation
-
public class TemplateOperation extends Object
Generate OWL from tables. Based on "Overcoming the ontology enrichment bottleneck with Quick Term Templates" (link). See template.md for details.- Author:
- James A. Overton
-
-
Constructor Summary
Constructors Constructor Description TemplateOperation()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.semanticweb.owlapi.model.OWLAnnotationProperty
getAnnotationProperty(QuotedEntityChecker checker, String name)
Deprecated.static org.semanticweb.owlapi.model.OWLDatatype
getDatatype(QuotedEntityChecker checker, String name)
Deprecated.static Map<String,String>
getDefaultOptions()
Get the default template options.static org.semanticweb.owlapi.model.OWLEntity
getEntity(QuotedEntityChecker checker, org.semanticweb.owlapi.model.IRI type, String id, String label)
Deprecated.static org.semanticweb.owlapi.model.OWLAnnotation
getIRIAnnotation(QuotedEntityChecker checker, String template, org.semanticweb.owlapi.model.IRI value)
Deprecated.static List<org.semanticweb.owlapi.model.IRI>
getIRIs(String tableName, List<List<String>> rows, IOHelper ioHelper)
Deprecated.static List<org.semanticweb.owlapi.model.IRI>
getIRIs(Map<String,List<List<String>>> tables, IOHelper ioHelper)
Deprecated.static org.semanticweb.owlapi.model.OWLAnnotation
getLanguageAnnotation(QuotedEntityChecker checker, String template, String value)
Deprecated.static org.semanticweb.owlapi.model.OWLAnnotation
getStringAnnotation(QuotedEntityChecker checker, String template, String value)
Deprecated.static org.semanticweb.owlapi.model.OWLAnnotation
getTypedAnnotation(QuotedEntityChecker checker, String template, String value)
Deprecated.static org.semanticweb.owlapi.model.OWLOntology
template(Map<String,List<List<String>>> tables)
Deprecated.static org.semanticweb.owlapi.model.OWLOntology
template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology)
Deprecated.static org.semanticweb.owlapi.model.OWLOntology
template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper)
Deprecated.static org.semanticweb.owlapi.model.OWLOntology
template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology, QuotedEntityChecker checker)
Deprecated.static org.semanticweb.owlapi.model.OWLOntology
template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology, QuotedEntityChecker checker, IOHelper ioHelper)
Deprecated.static org.semanticweb.owlapi.model.OWLOntology
template(org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper, String tableName, List<List<String>> table)
Given an OWLOntology, an IOHelper, a table name, and the table contents, use the table as the template to generate an output OWLOntology.static org.semanticweb.owlapi.model.OWLOntology
template(org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper, String tableName, List<List<String>> table, Map<String,String> options)
Given an OWLOntology, an IOHelper, a table name, the table contents, and a map of template options, use the table as the template to generate an output OWLOntology.static org.semanticweb.owlapi.model.OWLOntology
template(org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper, Map<String,List<List<String>>> tables, Map<String,String> options)
Given an OWLOntology, an IOHelper, a map of table names to table contents, and a map of template options, use the tables as templates to generate a merged output ontology.static boolean
validateTemplateString(String template)
Deprecated.
-
-
-
Method Detail
-
getDefaultOptions
public static Map<String,String> getDefaultOptions()
Get the default template options.- Returns:
- map of template options
-
template
public static org.semanticweb.owlapi.model.OWLOntology template(org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper, String tableName, List<List<String>> table) throws Exception
Given an OWLOntology, an IOHelper, a table name, and the table contents, use the table as the template to generate an output OWLOntology.- Parameters:
inputOntology
- OWLOntology to use to get existing entitiesioHelper
- IOHelper to resolve prefixestableName
- name of the table for error reportingtable
- List of rows (lists of cells) in the template- Returns:
- new OWLOntology created from the template
- Throws:
Exception
- on any issue
-
template
public static org.semanticweb.owlapi.model.OWLOntology template(org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper, String tableName, List<List<String>> table, Map<String,String> options) throws Exception
Given an OWLOntology, an IOHelper, a table name, the table contents, and a map of template options, use the table as the template to generate an output OWLOntology.- Parameters:
inputOntology
- OWLOntology to use to get existing entitiesioHelper
- IOHelper to resolve prefixestableName
- name of the table for error reportingtable
- List of rows (lists of cells) in the templateoptions
- map of template options- Returns:
- new OWLOntology created from the template
- Throws:
Exception
- on any issue
-
template
public static org.semanticweb.owlapi.model.OWLOntology template(org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper, Map<String,List<List<String>>> tables, Map<String,String> options) throws Exception
Given an OWLOntology, an IOHelper, a map of table names to table contents, and a map of template options, use the tables as templates to generate a merged output ontology.- Parameters:
inputOntology
- OWLOntology to use to get existing entitiesioHelper
- IOHelper to resolve prefixestables
- table names to table contentsoptions
- map of template options- Returns:
- new OWLOntology created from merged template ontologies
- Throws:
Exception
- on any issue
-
getAnnotationProperty
@Deprecated public static org.semanticweb.owlapi.model.OWLAnnotationProperty getAnnotationProperty(QuotedEntityChecker checker, String name) throws Exception
Deprecated.Find an annotation property with the given name or create one.- Parameters:
checker
- used to search by rdfs:label (for example)name
- the name to search for- Returns:
- an annotation property
- Throws:
Exception
- if the name cannot be resolved
-
getDatatype
@Deprecated public static org.semanticweb.owlapi.model.OWLDatatype getDatatype(QuotedEntityChecker checker, String name) throws Exception
Deprecated.Find a datatype with the given name or create one.- Parameters:
checker
- used to search by rdfs:label (for example)name
- the name to search for- Returns:
- a datatype
- Throws:
Exception
- if the name cannot be resolved
-
getStringAnnotation
@Deprecated public static org.semanticweb.owlapi.model.OWLAnnotation getStringAnnotation(QuotedEntityChecker checker, String template, String value) throws Exception
Deprecated.Return a string annotation for the given template string and value.- Parameters:
checker
- used to resolve the annotation propertytemplate
- the template stringvalue
- the value for the annotation- Returns:
- a new annotation with property and string literal value
- Throws:
Exception
- if the annotation property cannot be found
-
getTypedAnnotation
@Deprecated public static org.semanticweb.owlapi.model.OWLAnnotation getTypedAnnotation(QuotedEntityChecker checker, String template, String value) throws Exception
Deprecated.Return a typed annotation for the given template string and value. The template string format is "AT [name]^^[datatype]" and the value is any string.- Parameters:
checker
- used to resolve the annotation property and datatypetemplate
- the template stringvalue
- the value for the annotation- Returns:
- a new annotation axiom with property and typed literal value
- Throws:
Exception
- if the annotation property cannot be found
-
getLanguageAnnotation
@Deprecated public static org.semanticweb.owlapi.model.OWLAnnotation getLanguageAnnotation(QuotedEntityChecker checker, String template, String value) throws Exception
Deprecated.Return a language tagged annotation for the given template and value. The template string format is "AL [name]@[lang]" and the value is any string.- Parameters:
checker
- used to resolve the annotation propertytemplate
- the template stringvalue
- the value for the annotation- Returns:
- a new annotation axiom with property and language tagged literal
- Throws:
Exception
- if the annotation property cannot be found
-
getIRIAnnotation
@Deprecated public static org.semanticweb.owlapi.model.OWLAnnotation getIRIAnnotation(QuotedEntityChecker checker, String template, org.semanticweb.owlapi.model.IRI value) throws Exception
Deprecated.Return an IRI annotation for the given template string and value. The template string format is "AI [name]" and the value is a string that can be interpreted as an IRI.- Parameters:
checker
- used to resolve the annotation propertytemplate
- the template stringvalue
- the IRI value for the annotation- Returns:
- a new annotation axiom with property and an IRI value
- Throws:
Exception
- if the annotation property cannot be found
-
getEntity
@Deprecated public static org.semanticweb.owlapi.model.OWLEntity getEntity(QuotedEntityChecker checker, org.semanticweb.owlapi.model.IRI type, String id, String label)
Deprecated.Use type, id, and label information to get an entity from the data in a row. Requires either: an id (default type is owl:Class); an id and type; or a label.- Parameters:
checker
- for looking up labelstype
- the IRI of the type for this entity, or nullid
- the ID for this entity, or nulllabel
- the label for this entity, or null- Returns:
- the entity or null
-
getIRIs
@Deprecated public static List<org.semanticweb.owlapi.model.IRI> getIRIs(Map<String,List<List<String>>> tables, IOHelper ioHelper) throws Exception
Deprecated.Get a list of the IRIs defined in a set of template tables.- Parameters:
tables
- a map from table names to tablesioHelper
- used to find entities by name- Returns:
- a list of IRIs
- Throws:
Exception
- when names or templates cannot be handled
-
getIRIs
@Deprecated public static List<org.semanticweb.owlapi.model.IRI> getIRIs(String tableName, List<List<String>> rows, IOHelper ioHelper) throws Exception
Deprecated.Get a list of the IRIs defined in a template table.- Parameters:
tableName
- the name of the tablerows
- the table of dataioHelper
- used to find entities by name- Returns:
- a list of IRIs
- Throws:
Exception
- when names or templates cannot be handled
-
template
@Deprecated public static org.semanticweb.owlapi.model.OWLOntology template(Map<String,List<List<String>>> tables) throws Exception
Deprecated.Use a table to generate an ontology. With this signature we use all defaults.- Parameters:
tables
- a map from names to tables of data- Returns:
- a new ontology generated from the table
- Throws:
Exception
- when names or templates cannot be handled
-
template
@Deprecated public static org.semanticweb.owlapi.model.OWLOntology template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology) throws Exception
Deprecated.Use tables to generate an ontology.- Parameters:
tables
- a map from names to tables of datainputOntology
- the ontology to use to resolve names- Returns:
- a new ontology generated from the table
- Throws:
Exception
- when names or templates cannot be handled
-
template
@Deprecated public static org.semanticweb.owlapi.model.OWLOntology template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology, QuotedEntityChecker checker) throws Exception
Deprecated.Use tables to generate an ontology.- Parameters:
tables
- a map from names to tables of datainputOntology
- the ontology to use to resolve nameschecker
- used to find entities by name- Returns:
- a new ontology generated from the table
- Throws:
Exception
- when names or templates cannot be handled
-
template
@Deprecated public static org.semanticweb.owlapi.model.OWLOntology template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology, IOHelper ioHelper) throws Exception
Deprecated.Use tables to generate an ontology.- Parameters:
tables
- a map from names to tables of datainputOntology
- the ontology to use to resolve namesioHelper
- used to find entities by name- Returns:
- a new ontology generated from the table
- Throws:
Exception
- when names or templates cannot be handled
-
template
@Deprecated public static org.semanticweb.owlapi.model.OWLOntology template(Map<String,List<List<String>>> tables, org.semanticweb.owlapi.model.OWLOntology inputOntology, QuotedEntityChecker checker, IOHelper ioHelper) throws Exception
Deprecated.Use tables to generate an ontology. Input is a map from table names to tables. The first row of each table must be header names. The second row of each table must be template strings, including ID and CLASS_TYPE columns. The new ontology is created in two passes: first terms are declared and annotations added, then logical axioms are added. This allows annotations from the first pass to be used as names in the logical axioms.- Parameters:
tables
- a map from names to tables of datainputOntology
- the ontology to use to resolve nameschecker
- used to find entities by nameioHelper
- used to find entities by name- Returns:
- a new ontology generated from the table
- Throws:
Exception
- when names or templates cannot be handled
-
validateTemplateString
@Deprecated public static boolean validateTemplateString(String template)
Deprecated.Return true if the template string is valid, false otherwise.- Parameters:
template
- the template string to check- Returns:
- true if valid, false otherwise
-
-