| |
|
| java.lang.Object jena.schemagen
schemagen | public class schemagen (Code) | |
A vocabulary generator, that will consume an ontology or other vocabulary file,
and generate a Java file with the constants from the vocabulary compiled in.
Designed to be highly flexible and customisable.
author: Ian Dickinson, HP Labs author: (email) version: CVS $Id: schemagen.java,v 1.55 2008/01/02 13:42:25 ian_dickinson Exp $ |
Inner Class :protected class OptionDefinition | |
Inner Class :protected class Replacement | |
Method Summary | |
protected void | abort(String msg, Exception e) | protected void | addReplacementPattern(String key, String replacement) | protected String | asLegalJavaID(String s, boolean cap) | protected void | closeOutput() | protected void | determineConfigRoot() | protected void | determineLanguage() | protected String | determineNamespaceURI() | protected boolean | filter(Resource r) | protected String | formatComment(String comment) | protected List | getAllValues(Object option) | protected String | getClassName() | protected String | getComment(Resource r) | protected String | getDefaultPrefixNamespace() | protected String | getImports() | protected String | getOntologyElementNamespace() | protected OptionDefinition | getOpt(Object option) | protected String | getOptionNamespace() | protected Resource | getResource(Object option) | protected String | getUCValueName(Resource r) | protected String | getValue(Object option) | protected String | getValueName(Resource r, String disambiguator) | protected void | go(String[] args) | protected String | guessNamespace() | protected boolean | hasComment(Resource r) | protected boolean | hasResourceValue(Object option) | protected boolean | hasValue(Object option) | protected boolean | includeSource() | protected int | indentTo(int i, StringBuffer buf) | protected boolean | isIncluded(Resource r) Answer true if the given resource is accepted for presentation in the output, which
is true iff it is a URI node, whose namespace is one of the accepted namespaces in
schemagen.m_includeURI . | protected boolean | isTrue(Object option) | public static void | main(String[] args) | protected boolean | noComments() | protected void | pop(int n) | protected void | processFooter() | protected void | processHeader() | protected void | processInput() | protected ExtendedIterator | selectIndividuals() | protected void | selectInput() | protected void | selectOutput() | protected void | setGlobalReplacements() | protected ExtendedIterator | sorted(ExtendedIterator i) | protected ExtendedIterator | sorted(List members) | protected String | substitute(String sIn) | protected String | urlCheck(String uriOrFile) Return a URI formed from the given string, unchanged if it's already a URI or
converted to a file URI otherwise. | protected void | usage() | protected boolean | useOntology() | protected void | write(int indentLevel, String s) | protected void | writeAnnotationProperties() | protected void | writeClassClose() | protected void | writeClassDeclaration() | protected void | writeClasses() | protected void | writeDatatypeProperties() | protected void | writeIndividuals() | protected void | writeInitialDeclarations() | protected void | writeModelDeclaration() | protected void | writeNamespace() | protected void | writeObjectProperties() | protected void | writeOntClasses() | protected void | writeOntIndividuals() | protected void | writeProperties() | protected void | writeRDFClasses() | protected void | writeRDFIndividuals() | protected void | writeRDFProperties(boolean useOntProperty) | protected void | writeSource() | protected void | writeValue(Resource r, String template, String valueClass, String creator, String disambiguator) | protected void | writeln(int indent) | protected void | writeln(int indent, String s) |
COMMENT_LENGTH_LIMIT | final public static int COMMENT_LENGTH_LIMIT(Code) | | Default line length for comments before wrap
|
DEFAULT_CONFIG_URI | final public static String DEFAULT_CONFIG_URI(Code) | | The default location of the configuration model is
|
DEFAULT_HEADER_TEMPLATE | final public static String DEFAULT_HEADER_TEMPLATE(Code) | | Default template for the file header
|
DEFAULT_INDIVIDUAL_TEMPLATE | final public static String DEFAULT_INDIVIDUAL_TEMPLATE(Code) | | Default template for writing out individual declarations
|
DEFAULT_MARKER | final public static String DEFAULT_MARKER(Code) | | The default marker string for denoting substitutions is
|
DEFAULT_TEMPLATE | final public static String DEFAULT_TEMPLATE(Code) | | Default template for writing out value declarations
|
JAVA_KEYWORDS | final public static String[] JAVA_KEYWORDS(Code) | | List of Java reserved keywords, see this list.
|
NS | final public static String NS(Code) | | The namespace for the configuration model is
|
OPT_CLASSDEC | final protected static Object OPT_CLASSDEC(Code) | | Additional decoration for class header (such as implements); use --classdec <classname> on command line; use sgen:classdec in config file
|
OPT_CLASSNAME | final protected static Object OPT_CLASSNAME(Code) | | The name of the generated class; use -n <classname> on command line; use sgen:classname in config file
|
OPT_CLASSNAME_SUFFIX | final protected static Object OPT_CLASSNAME_SUFFIX(Code) | | Option for adding a suffix to the generated class name; use --classnamesuffix <uri> on command line; use sgen:classnamesuffix in config file
|
OPT_CLASS_SECTION | final protected static Object OPT_CLASS_SECTION(Code) | | Section declaration for class section; use --classSection <...> on command line; use sgen:classSection in config file
|
OPT_CLASS_TEMPLATE | final protected static Object OPT_CLASS_TEMPLATE(Code) | | Template for writing out class declarations; use --classTemplate <...> on command line; use sgen:classTemplate in config file
|
OPT_CONFIG_FILE | final protected static Object OPT_CONFIG_FILE(Code) | | Select an alternative config file; use -c <filename> on command line
|
OPT_DECLARATIONS | final protected static Object OPT_DECLARATIONS(Code) | | Additional declarations to add at the top of the class; use --declarations <...> on command line; use sgen:declarations in config file
|
OPT_DOS | final protected static Object OPT_DOS(Code) | | Option to generate an output file with DOS (\r\n) line endings. Default is Unix line endings.
|
OPT_ENCODING | final protected static Object OPT_ENCODING(Code) | | Option for the presentation syntax (encoding) of the file; use -e encoding on command line; use sgen:encoding in config file
|
OPT_FOOTER | final protected static Object OPT_FOOTER(Code) | | Specify the file footer; use --footer "..." on command line; use sgen:footer in config file
|
OPT_HEADER | final protected static Object OPT_HEADER(Code) | | Specify the file header; use --header "..." on command line; use sgen:header in config file
|
OPT_HELP | final protected static Object OPT_HELP(Code) | | Option to show the usage message; use --help on command line
|
OPT_INCLUDE | final protected static Object OPT_INCLUDE(Code) | | Option for including non-local URI's in vocabulary; use --include <uri> on command line; use sgen:include in config file
|
OPT_INCLUDE_SOURCE | final protected static Object OPT_INCLUDE_SOURCE(Code) | | Option to include the ontology source code in the generated file
|
OPT_INDIVIDUALS_SECTION | final protected static Object OPT_INDIVIDUALS_SECTION(Code) | | Section declaration for individuals section; use --individualsSection <...> on command line; use sgen:individualsSection in config file
|
OPT_INDIVIDUAL_TEMPLATE | final protected static Object OPT_INDIVIDUAL_TEMPLATE(Code) | | Template for writing out individual declarations; use --individualTemplate <...> on command line; use sgen:individualTemplate in config file
|
OPT_INPUT | final protected static Object OPT_INPUT(Code) | | Nominate the URL of the input document; use -i <URL> on command line; use sgen:input in config file
|
OPT_LANG_DAML | final protected static Object OPT_LANG_DAML(Code) | | Specify that the language of the source is DAML+OIL; use --daml on command line; use sgen:daml in config file
|
OPT_LANG_OWL | final protected static Object OPT_LANG_OWL(Code) | | Specify that the language of the source is OWL (the default); use --owl on command line; use sgen:owl in config file
|
OPT_LANG_RDFS | final protected static Object OPT_LANG_RDFS(Code) | | Specify that the language of the source is RDFS; use --rdfs on command line; use sgen:rdfs in config file
|
OPT_MARKER | final protected static Object OPT_MARKER(Code) | | Specify the marker string for substitutions, default is '%'; use -m "..." on command line; use sgen:marker in config file
|
OPT_NAMESPACE | final protected static Object OPT_NAMESPACE(Code) | | The namespace URI for the vocabulary; use -a <uri> on command line; use sgen:namespace in config file
|
OPT_NOCLASSES | final protected static Object OPT_NOCLASSES(Code) | | Option to suppress classes in vocab file; use --noclasses <...> on command line; use sgen:noclasses in config file
|
OPT_NOHEADER | final protected static Object OPT_NOHEADER(Code) | | Option for no file header; use --noheader <...> on command line; use sgen:noheader in config file
|
OPT_NOINDIVIDUALS | final protected static Object OPT_NOINDIVIDUALS(Code) | | Option to suppress individuals in vocab file; use --noindividuals <...> on command line; use sgen:noindividuals in config file
|
OPT_NOPROPERTIES | final protected static Object OPT_NOPROPERTIES(Code) | | Option to suppress properties in vocab file; use --noproperties <...> on command line; use sgen:noproperties in config file
|
OPT_NO_COMMENTS | final protected static Object OPT_NO_COMMENTS(Code) | | Turn off all comment output; use --nocomments on command line; use sgen:noComments in config file
|
OPT_ONTOLOGY | final protected static Object OPT_ONTOLOGY(Code) | | Use ontology terms in preference to vanilla RDF; use --ontology on command line; use sgen:ontology in config file
|
OPT_OUTPUT | final protected static Object OPT_OUTPUT(Code) | | Specify that destination file; use -o <fileName> on command line; use sgen:output in config file
|
OPT_PACKAGENAME | final protected static Object OPT_PACKAGENAME(Code) | | Specify the packagename; use --package <packagename> on command line; use sgen:package in config file
|
OPT_PROPERTY_SECTION | final protected static Object OPT_PROPERTY_SECTION(Code) | | Section declaration for properties section; use --propSection <...> on command line; use sgen:propSection in config file
|
OPT_PROP_TEMPLATE | final protected static Object OPT_PROP_TEMPLATE(Code) | | Template for writing out property declarations; use --propTemplate <...> on command line; use sgen:propTemplate in config file
|
OPT_ROOT | final protected static Object OPT_ROOT(Code) | | Specify the uri of the configuration root node; use --root <URL> on command line
|
OPT_STRICT_INDIVIDUALS | final protected static Object OPT_STRICT_INDIVIDUALS(Code) | | Option to exclude instances of classes in the allowed namespaces, where the individuals themselves are in other namespaces; use --strictIndividuals on command line; use sgen:strictIndividuals in config file
|
OPT_UC_NAMES | final protected static Object OPT_UC_NAMES(Code) | | Option for mapping constant names to uppercase; use --uppercase <...> on command line; use sgen:uppercase in config file
|
OPT_USE_INF | final protected static Object OPT_USE_INF(Code) | | Option to generate to force the model to perform inference, off by default.
|
m_cmdLineArgs | protected List m_cmdLineArgs(Code) | | The list of command line arguments
|
m_config | protected Model m_config(Code) | | The model that contains the configuration information
|
m_includeURI | protected List m_includeURI(Code) | | List of allowed namespace URI strings for admissible values
|
m_indentStep | protected int m_indentStep(Code) | | Size of indent step
|
m_nl | protected String m_nl(Code) | | Output file newline char - default is Unix, override with --dos
|
m_optionDefinitions | protected Object[][] m_optionDefinitions(Code) | | Option definitions
|
m_replacements | protected List m_replacements(Code) | | Stack of replacements to apply
|
m_resourcesToNames | protected Map m_resourcesToNames(Code) | | Map from resources to java names
|
m_root | protected Resource m_root(Code) | | The root of the options in the config file
|
m_source | protected OntModel m_source(Code) | | The model that contains the input source
|
m_usedNames | protected Set m_usedNames(Code) | | Set of names used so far
|
addReplacementPattern | protected void addReplacementPattern(String key, String replacement)(Code) | | Add a pattern-value pair to the list of available patterns
|
asLegalJavaID | protected String asLegalJavaID(String s, boolean cap)(Code) | | Convert s to a legal Java identifier; capitalise first char if cap is true
|
closeOutput | protected void closeOutput()(Code) | | Close the output file
|
determineConfigRoot | protected void determineConfigRoot()(Code) | | Determine the root resource in the configuration file
|
determineLanguage | protected void determineLanguage()(Code) | | Create the source model after determining which input language
|
determineNamespaceURI | protected String determineNamespaceURI()(Code) | | Determine what the namespace URI for this vocabulary is
|
filter | protected boolean filter(Resource r)(Code) | | Answer true if resource r does not show in output
|
formatComment | protected String formatComment(String comment)(Code) | | Format the comment as Javadoc, and limit the line width
|
getAllValues | protected List getAllValues(Object option)(Code) | | Answer all values for the given options as Strings
|
getClassName | protected String getClassName()(Code) | | Determine the class name of the vocabulary from the URI
|
getComment | protected String getComment(Resource r)(Code) | | Answer all of the commentary on the given resource, as a string
|
getDefaultPrefixNamespace | protected String getDefaultPrefixNamespace()(Code) | | Document has set an empty prefix for the model
|
getImports | protected String getImports()(Code) | | Determine the list of imports to include in the file
|
getOntologyElementNamespace | protected String getOntologyElementNamespace()(Code) | | Document has an owl:Ontology or daml:Ontology element
|
getOpt | protected OptionDefinition getOpt(Object option)(Code) | | Answer the option object for the given option
|
getOptionNamespace | protected String getOptionNamespace()(Code) | | User has set namespace via a schemagen option
|
getResource | protected Resource getResource(Object option)(Code) | | Answer the value of the option or null
|
getUCValueName | protected String getUCValueName(Resource r)(Code) | | Answer the local name of resource r mapped to upper case
|
getValue | protected String getValue(Object option)(Code) | | Answer the value of the option or null
|
go | protected void go(String[] args)(Code) | | Read the configuration parameters and do setup
|
guessNamespace | protected String guessNamespace()(Code) | | Guess the URI from the most prevalent URI
|
hasComment | protected boolean hasComment(Resource r)(Code) | | Answer true if the given resource has an rdf:comment or daml:comment
|
hasResourceValue | protected boolean hasResourceValue(Object option)(Code) | | Answer true if the given option has a resource value
|
hasValue | protected boolean hasValue(Object option)(Code) | | Answer true if the given option has value
|
includeSource | protected boolean includeSource()(Code) | | Answer true if ontology source code is to be included
|
indentTo | protected int indentTo(int i, StringBuffer buf)(Code) | | Add the appropriate indent to a buffer
|
isIncluded | protected boolean isIncluded(Resource r)(Code) | | Answer true if the given resource is accepted for presentation in the output, which
is true iff it is a URI node, whose namespace is one of the accepted namespaces in
schemagen.m_includeURI .
Parameters: r - A resource to test True if the resource is to be included in the generated output |
isTrue | protected boolean isTrue(Object option)(Code) | | Answer true if the given option is set to true
|
noComments | protected boolean noComments()(Code) | | Answer true if all comments are suppressed
|
pop | protected void pop(int n)(Code) | | Pop n replacements off the stack
|
processFooter | protected void processFooter()(Code) | | Process the footer at the end of the file, if defined
|
processHeader | protected void processHeader()(Code) | | Process the header at the start of the file, if defined
|
processInput | protected void processInput()(Code) | | The sequence of steps to process an entire file
|
selectIndividuals | protected ExtendedIterator selectIndividuals()(Code) | | Answer an iterator over the individuals selected for output
|
selectInput | protected void selectInput()(Code) | | Identify the URL that is to be read in and translated to a vocabulary file, and load the source into the source model
|
selectOutput | protected void selectOutput()(Code) | | Identify the file we are to write the output to
|
setGlobalReplacements | protected void setGlobalReplacements()(Code) | | The list of replacements that are always available
|
sorted | protected ExtendedIterator sorted(List members)(Code) | | Answer an iterator that contains the elements of the given iterator, but sorted by URI
|
substitute | protected String substitute(String sIn)(Code) | | Use the current replacements list to do the subs in the given string
|
urlCheck | protected String urlCheck(String uriOrFile)(Code) | | Return a URI formed from the given string, unchanged if it's already a URI or
converted to a file URI otherwise. If not recognisable as a URL, abort.
|
usage | protected void usage()(Code) | | Print usage message and abort
|
useOntology | protected boolean useOntology()(Code) | | Answer true if we are using ontology terms in this vocabulary
|
write | protected void write(int indentLevel, String s)(Code) | | Write out the given string with n spaces of indent
|
writeAnnotationProperties | protected void writeAnnotationProperties()(Code) | | Write any annotation properties in the vocabulary
|
writeClassClose | protected void writeClassClose()(Code) | | The close of the class decoration
|
writeClassDeclaration | protected void writeClassDeclaration()(Code) | | The opening class declaration
|
writeClasses | protected void writeClasses()(Code) | | Write any classes in the vocabulary
|
writeDatatypeProperties | protected void writeDatatypeProperties()(Code) | | Write any datatype properties in the vocabulary
|
writeIndividuals | protected void writeIndividuals()(Code) | | Write any instances (individuals) in the vocabulary
|
writeInitialDeclarations | protected void writeInitialDeclarations()(Code) | | Write the declarations at the head of the class
|
writeModelDeclaration | protected void writeModelDeclaration()(Code) | | Write the declaration of the model
|
writeNamespace | protected void writeNamespace()(Code) | | Write the string and resource that represent the namespace
|
writeObjectProperties | protected void writeObjectProperties()(Code) | | Write any object properties in the vocabulary
|
writeOntClasses | protected void writeOntClasses()(Code) | | Write classes as ontology terms
|
writeOntIndividuals | protected void writeOntIndividuals()(Code) | | Write individuals as ontology terms
|
writeProperties | protected void writeProperties()(Code) | | Write the list of properties
|
writeRDFClasses | protected void writeRDFClasses()(Code) | | Write classes as vanilla RDF terms
|
writeRDFIndividuals | protected void writeRDFIndividuals()(Code) | | Write individuals as vanilla RDF terms
|
writeRDFProperties | protected void writeRDFProperties(boolean useOntProperty)(Code) | | Write any vanilla RDF properties in the vocabulary
|
writeSource | protected void writeSource()(Code) | | Write the source code of the input model into the file itself
|
writeValue | protected void writeValue(Resource r, String template, String valueClass, String creator, String disambiguator)(Code) | | Write the value declaration out using the given template, optionally creating comments
|
writeln | protected void writeln(int indent)(Code) | | Write a blank line, with indent and newline
|
writeln | protected void writeln(int indent, String s)(Code) | | Write out the given string with n spaces of indent, with newline
|
|
|
|