de.interactive_instruments.ShapeChange.Target.Ontology
Class OWLISO19150

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.Target.Ontology.OWLISO19150
All Implemented Interfaces:
MessageSource, SingleTarget, Target

public class OWLISO19150
extends Object
implements SingleTarget, MessageSource

Author:
Johannes Echterhoff

Field Summary
protected static Map<String,Integer> counterByXmlprefix
          key: xml prefix value, value: current counter (used to establish unique xml prefixes for referencing elements from the same target namespace [which might be contained in different ontologies])
static String NS_XMLNS
           
protected static Map<String,OntologyDocument> ontologyByCodeNs
          key: code namespace of an ontology document; value: the ontology document
protected static Map<PackageInfo,OntologyDocument> ontologyByPiMap
          key: a package, value: the according ontology object
protected static Map<String,OntologyDocument> ontologyByRdfNs
          key: rdf namespace of an ontology document; value: the ontology document
static String PARAM_GLOBALPROPERTIES
           
static String PARAM_LANGUAGE
           
static String PARAM_ONTOLOGYNAME_TAGGED_VALUE_NAME
          Name of the parameter whose value provides the name of the tagged value which, if present on a package, defines the ontologyName (see 19150-2owl:ontologyName) of the package.
static String PARAM_SOURCE
           
static String PARAM_SOURCE_TAGGED_VALUE_NAME
           
static String PARAM_URIBASE
          Defines the global URIbase for construction of the ontologyName (see 19150-2owl:ontologyName).
static String PARAM_VERSIONINFO
           
static String PREFIX_ISO_19150_2
           
protected static Set<AssociationInfo> processedAssociations
           
static String RDF_NS_DC
           
static String RDF_NS_DCT
           
static String RDF_NS_ISO_19150_2
           
static String RDF_NS_ISO_GFM
           
static String RDF_NS_OGC_GEOSPARQL
           
static String RDF_NS_W3C_OWL
           
static String RDF_NS_W3C_RDF
           
static String RDF_NS_W3C_RDFS
           
static String RDF_NS_W3C_SKOS
           
static String RDF_NS_W3C_XML_SCHEMA
           
protected static Map<String,String> rdfNsByPrefix
          key: namespace abbreviation / prefix; value: RDF namespace
static String RULE_OWL_ALL_CONSTRAINTS
          If this rule is included, the target will create constraint definitions.
static String RULE_OWL_ALL_SUPPRESS_DC_SOURCE
          If this rule is included, dc:source in not included except on the ontology subject
static String RULE_OWL_CLS_19150_2_FEATURES
          If this rule is included, each feature type definition gets a subClassOf declaration to the ISO 19150-2 defined FeatureType class (which defines the according stereotype) as well as AnyFeature.
static String RULE_OWL_CLS_CODELIST_EXTERNAL
          If this rule is included, code lists are not represented as part of the RDF vocabulary and where available the vocabulary or codelist tagged value is used for the rdfs:range.
static String RULE_OWL_CLS_GEOSPARQL_FEATURES
          If this rule is included, each feature type definition gets a subClassOf declaration to the GeoSPARQL defined FeatureType class.
static String RULE_OWL_PKG_APP_SCHEMA_CODE
           
static String RULE_OWL_PKG_PATH_IN_ONTOLOGY_NAME
          If this rule is enabled, ontology names will be constructed using the path of packages (usually from a leaf package to its main schema package).
static String RULE_OWL_PKG_SINGLE_ONTOLOGY_PER_SCHEMA
          If this rule is enabled, ontologies will be created for selected schema, but not for all of their child packages.
static String RULE_OWL_PROP_SUPPRESS_ALLVALUESFROM_RESTRICTIONS
          If this rule is included, allValuesFrom restrictions are not included in the ontology
static String RULE_OWL_PROP_SUPPRESS_ASSOCIATION_NAMES
          If this rule is included, association names are not included in the ontology
static String RULE_OWL_PROP_SUPPRESS_CARDINALITY_RESTRICTIONS
          If this rule is included, cardinality restrictions are not included in the ontology
static String RULE_OWL_PROP_VOIDABLE_AS_MINCARDINALITY0
          If this rule is included, minCardinality is set to 0 for voidable properties
protected static Map<String,PackageInfo> schemaByTargetNamespace
          key: targetNamespace, value: main schema package
static int TARGET_OWL
           
 
Constructor Summary
OWLISO19150()
           
 
Method Summary
 String computePrefixForRdfNamespace(String rdfns)
           
 OntologyDocument computeRelevantOntology(ClassInfo ci)
          Identifies the ontology document to which the given class belongs.
 String computeSource(Info i)
          Computes the value for the dc:source that qualifies an ontology element.
 TargetOwlConfiguration getConfig()
           
static Set<String> getGlobalPropertyNames()
           
 String getLanguage()
           
 String getOntologyNameTaggedValue()
           
 Set<AssociationInfo> getProcessedAssociations()
           
 int getTargetID()
           
 String getUriBase()
           
 String getVersionInfo()
           
 void initialise(PackageInfo p, Model m, Options o, ShapeChangeResult r, boolean diagOnly)
          Allows a target to perform the necessary initialization routines before processing.
 String message(int mnr)
          This method returns messages belonging to the target by their message number.
protected  String messageText(int mnr)
          This is the message text provision proper.
 void process(ClassInfo ci)
          The converter will call this method for each class belonging to the package given during initialization (see Target.initialise(de.interactive_instruments.ShapeChange.Model.PackageInfo, de.interactive_instruments.ShapeChange.Model.Model, de.interactive_instruments.ShapeChange.Options, de.interactive_instruments.ShapeChange.ShapeChangeResult, boolean)).
 void reset()
          All relevant fields of the target will be reset, so that it is ready for processing selected schemas based upon a specific target configuration.
 void write()
           
 void writeAll(ShapeChangeResult r)
          Instructs the target to output the processing results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TARGET_OWL

public static final int TARGET_OWL
See Also:
Constant Field Values

RDF_NS_W3C_XML_SCHEMA

public static final String RDF_NS_W3C_XML_SCHEMA
See Also:
Constant Field Values

RDF_NS_W3C_RDF

public static final String RDF_NS_W3C_RDF
See Also:
Constant Field Values

RDF_NS_W3C_RDFS

public static final String RDF_NS_W3C_RDFS
See Also:
Constant Field Values

RDF_NS_W3C_OWL

public static final String RDF_NS_W3C_OWL
See Also:
Constant Field Values

RDF_NS_DC

public static final String RDF_NS_DC
See Also:
Constant Field Values

RDF_NS_DCT

public static final String RDF_NS_DCT
See Also:
Constant Field Values

RDF_NS_W3C_SKOS

public static final String RDF_NS_W3C_SKOS
See Also:
Constant Field Values

RDF_NS_ISO_19150_2

public static final String RDF_NS_ISO_19150_2
See Also:
Constant Field Values

RDF_NS_OGC_GEOSPARQL

public static final String RDF_NS_OGC_GEOSPARQL
See Also:
Constant Field Values

RDF_NS_ISO_GFM

public static final String RDF_NS_ISO_GFM
See Also:
Constant Field Values

PREFIX_ISO_19150_2

public static final String PREFIX_ISO_19150_2
See Also:
Constant Field Values

NS_XMLNS

public static final String NS_XMLNS
See Also:
Constant Field Values

RULE_OWL_PKG_SINGLE_ONTOLOGY_PER_SCHEMA

public static final String RULE_OWL_PKG_SINGLE_ONTOLOGY_PER_SCHEMA
If this rule is enabled, ontologies will be created for selected schema, but not for all of their child packages.

See Also:
Constant Field Values

RULE_OWL_PKG_PATH_IN_ONTOLOGY_NAME

public static final String RULE_OWL_PKG_PATH_IN_ONTOLOGY_NAME
If this rule is enabled, ontology names will be constructed using the path of packages (usually from a leaf package to its main schema package). This rule changes ontology names only if the rule "rule-owl-pkg-singleOntologyPerSchema" is not in effect (because otherwise child packages will not be considered).

See Also:
Constant Field Values

RULE_OWL_ALL_CONSTRAINTS

public static final String RULE_OWL_ALL_CONSTRAINTS
If this rule is included, the target will create constraint definitions. Constraints on properties (not for union properties) and classes are supported.

See Also:
Constant Field Values

RULE_OWL_CLS_GEOSPARQL_FEATURES

public static final String RULE_OWL_CLS_GEOSPARQL_FEATURES
If this rule is included, each feature type definition gets a subClassOf declaration to the GeoSPARQL defined FeatureType class.

See Also:
Constant Field Values

RULE_OWL_CLS_19150_2_FEATURES

public static final String RULE_OWL_CLS_19150_2_FEATURES
If this rule is included, each feature type definition gets a subClassOf declaration to the ISO 19150-2 defined FeatureType class (which defines the according stereotype) as well as AnyFeature.

See Also:
Constant Field Values

RULE_OWL_PROP_SUPPRESS_ALLVALUESFROM_RESTRICTIONS

public static final String RULE_OWL_PROP_SUPPRESS_ALLVALUESFROM_RESTRICTIONS
If this rule is included, allValuesFrom restrictions are not included in the ontology

See Also:
Constant Field Values

RULE_OWL_PROP_SUPPRESS_CARDINALITY_RESTRICTIONS

public static final String RULE_OWL_PROP_SUPPRESS_CARDINALITY_RESTRICTIONS
If this rule is included, cardinality restrictions are not included in the ontology

See Also:
Constant Field Values

RULE_OWL_PROP_VOIDABLE_AS_MINCARDINALITY0

public static final String RULE_OWL_PROP_VOIDABLE_AS_MINCARDINALITY0
If this rule is included, minCardinality is set to 0 for voidable properties

See Also:
Constant Field Values

RULE_OWL_PROP_SUPPRESS_ASSOCIATION_NAMES

public static final String RULE_OWL_PROP_SUPPRESS_ASSOCIATION_NAMES
If this rule is included, association names are not included in the ontology

See Also:
Constant Field Values

RULE_OWL_ALL_SUPPRESS_DC_SOURCE

public static final String RULE_OWL_ALL_SUPPRESS_DC_SOURCE
If this rule is included, dc:source in not included except on the ontology subject

See Also:
Constant Field Values

RULE_OWL_CLS_CODELIST_EXTERNAL

public static final String RULE_OWL_CLS_CODELIST_EXTERNAL
If this rule is included, code lists are not represented as part of the RDF vocabulary and where available the vocabulary or codelist tagged value is used for the rdfs:range. If not set, owl:Class is used.

See Also:
Constant Field Values

RULE_OWL_PKG_APP_SCHEMA_CODE

public static final String RULE_OWL_PKG_APP_SCHEMA_CODE
See Also:
Constant Field Values

PARAM_VERSIONINFO

public static final String PARAM_VERSIONINFO
See Also:
Constant Field Values

PARAM_SOURCE

public static final String PARAM_SOURCE
See Also:
Constant Field Values

PARAM_LANGUAGE

public static final String PARAM_LANGUAGE
See Also:
Constant Field Values

PARAM_SOURCE_TAGGED_VALUE_NAME

public static final String PARAM_SOURCE_TAGGED_VALUE_NAME
See Also:
Constant Field Values

PARAM_URIBASE

public static String PARAM_URIBASE
Defines the global URIbase for construction of the ontologyName (see 19150-2owl:ontologyName).

The ontologyName is defined via the following rules, in descending priority:


PARAM_ONTOLOGYNAME_TAGGED_VALUE_NAME

public static String PARAM_ONTOLOGYNAME_TAGGED_VALUE_NAME
Name of the parameter whose value provides the name of the tagged value which, if present on a package, defines the ontologyName (see 19150-2owl:ontologyName) of the package.

The ontologyName is defined via the following rules, in descending priority:


PARAM_GLOBALPROPERTIES

public static String PARAM_GLOBALPROPERTIES

ontologyByPiMap

protected static Map<PackageInfo,OntologyDocument> ontologyByPiMap
key: a package, value: the according ontology object


ontologyByRdfNs

protected static Map<String,OntologyDocument> ontologyByRdfNs
key: rdf namespace of an ontology document; value: the ontology document


ontologyByCodeNs

protected static Map<String,OntologyDocument> ontologyByCodeNs
key: code namespace of an ontology document; value: the ontology document


schemaByTargetNamespace

protected static Map<String,PackageInfo> schemaByTargetNamespace
key: targetNamespace, value: main schema package


counterByXmlprefix

protected static Map<String,Integer> counterByXmlprefix
key: xml prefix value, value: current counter (used to establish unique xml prefixes for referencing elements from the same target namespace [which might be contained in different ontologies])


rdfNsByPrefix

protected static Map<String,String> rdfNsByPrefix
key: namespace abbreviation / prefix; value: RDF namespace


processedAssociations

protected static Set<AssociationInfo> processedAssociations
Constructor Detail

OWLISO19150

public OWLISO19150()
Method Detail

getTargetID

public int getTargetID()
Specified by:
getTargetID in interface Target

initialise

public void initialise(PackageInfo p,
                       Model m,
                       Options o,
                       ShapeChangeResult r,
                       boolean diagOnly)
                throws ShapeChangeAbortException
Description copied from interface: Target
Allows a target to perform the necessary initialization routines before processing.

Will be called by the Converter for each selected schema (see Model.selectedSchemas() and PackageInfo.isSchema()).

Specified by:
initialise in interface Target
Parameters:
p - a schema from the model selected via the configuration (see Model.selectedSchemas()) - not necessarily always an application schema
Throws:
ShapeChangeAbortException
See Also:
Model.selectedSchemas(), PackageInfo.isSchema()

process

public void process(ClassInfo ci)
Description copied from interface: Target
The converter will call this method for each class belonging to the package given during initialization (see Target.initialise(de.interactive_instruments.ShapeChange.Model.PackageInfo, de.interactive_instruments.ShapeChange.Model.Model, de.interactive_instruments.ShapeChange.Options, de.interactive_instruments.ShapeChange.ShapeChangeResult, boolean)).

NOTE: will be called not only for the classes directly contained in the package, but also all sub-packages belonging to the same targetNamespace!

Specified by:
process in interface Target

computeRelevantOntology

public OntologyDocument computeRelevantOntology(ClassInfo ci)
Identifies the ontology document to which the given class belongs. Usually this is the ontology that represents the package the class is in, but that also depends upon the configured rules.

Parameters:
ci -
Returns:
the ontology document for the class, or null if no ontology could be found for the class

write

public void write()
Specified by:
write in interface Target

messageText

protected String messageText(int mnr)
This is the message text provision proper. It returns a message for a number.

Parameters:
mnr - Message number
Returns:
Message text or null

message

public String message(int mnr)
This method returns messages belonging to the target by their message number. The organization corresponds to the logic in module ShapeChangeResult. All functions in that class, which require a message number can be redirected to the function at hand.

Specified by:
message in interface MessageSource
Parameters:
mnr - Message number
Returns:
Message text, including $x$ substitution points.

writeAll

public void writeAll(ShapeChangeResult r)
Description copied from interface: SingleTarget
Instructs the target to output the processing results.

Will be called by the Converter after initialization and processing for all of the selected schema has been performed.

Specified by:
writeAll in interface SingleTarget
See Also:
Model.selectedSchemas()

reset

public void reset()
Description copied from interface: SingleTarget
All relevant fields of the target will be reset, so that it is ready for processing selected schemas based upon a specific target configuration.

The Converter will reset SingleTargets whenever it processes a target configuration.

Specified by:
reset in interface SingleTarget

getVersionInfo

public String getVersionInfo()
Returns:
the versionInfo

computeSource

public String computeSource(Info i)
Computes the value for the dc:source that qualifies an ontology element. The value is computed according to the following instructions, in descending order:

Parameters:
i -
Returns:

computePrefixForRdfNamespace

public String computePrefixForRdfNamespace(String rdfns)
Parameters:
rdfns -
Returns:
the abbreviation/prefix belonging to the given rdf namespace, or null if no such prefix was found.

getProcessedAssociations

public Set<AssociationInfo> getProcessedAssociations()

getConfig

public TargetOwlConfiguration getConfig()
Returns:
the config

getUriBase

public String getUriBase()
Returns:
the uriBase

getLanguage

public String getLanguage()
Returns:
the language

getOntologyNameTaggedValue

public String getOntologyNameTaggedValue()
Returns:
the ontologyNameTaggedValue

getGlobalPropertyNames

public static Set<String> getGlobalPropertyNames()
Returns:
the globalPropertyNames


Copyright © 2015. All rights reserved.