de.interactive_instruments.ShapeChange.Target.Ontology
Class OntologyModel

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

public class OntologyModel
extends Object
implements OntologyDocument, MessageSource

Author:
Clemens Portele

Field Summary
protected  String backPath
           
protected  List<ClassInfo> classInfos
           
protected  TargetOwlConfiguration config
           
protected  String fileName
           
protected  boolean finalized
           
protected  Set<String> globalPropertyNames
           
protected  Model model
           
protected  PackageInfo mpackage
           
protected  String name
           
protected  com.hp.hpl.jena.ontology.OntModel ontmodel
           
protected  com.hp.hpl.jena.ontology.Ontology ontology
           
protected  Options options
           
protected  OWLISO19150 owliso19150
           
protected  String path
           
protected  String prefix
           
protected  boolean printed
           
protected  Map<String,de.interactive_instruments.ShapeChange.Target.Ontology.OntologyModel.OwlProperty> properties
           
protected  String rdfNamespace
           
protected static com.hp.hpl.jena.rdf.model.Model refmodel
           
 ShapeChangeResult result
           
protected  String targetNamespace
           
 
Constructor Summary
OntologyModel(PackageInfo pi, Model m, Options o, ShapeChangeResult r, String xmlprefix, OWLISO19150 owliso19150)
           
 
Method Summary
protected  void addAllValuesFrom(com.hp.hpl.jena.ontology.OntClass cls, PropertyInfo pi, com.hp.hpl.jena.rdf.model.Property p)
           
 void addClass(ClassInfo ci)
           
 com.hp.hpl.jena.rdf.model.Resource addClassDefinition(ClassInfo ci)
           
 com.hp.hpl.jena.rdf.model.Resource addCodelist(ClassInfo ci)
           
 com.hp.hpl.jena.rdf.model.Resource addDatatype(ClassInfo ci)
           
 com.hp.hpl.jena.rdf.model.Resource addEnumeration(ClassInfo ci)
           
 com.hp.hpl.jena.rdf.model.Resource addFeature(ClassInfo ci)
           
protected  void addImport(String rdfns, String uri)
           
 com.hp.hpl.jena.rdf.model.Resource addInterface(ClassInfo ci)
           
protected  void addMultiplicity(com.hp.hpl.jena.ontology.OntClass cls, PropertyInfo pi, com.hp.hpl.jena.rdf.model.Property p)
           
 com.hp.hpl.jena.rdf.model.Resource addUnion(ClassInfo ci)
           
static String computeBackPath(PackageInfo pi)
           
 String computeName()
          Determines the ontology name of a given package.
static String computePath(PackageInfo pi)
          Provides the path (of packages) that leads from the main schema package down to this package.
 void finalizeDocument()
           
 String getBackPath()
           
 String getCodeNamespace()
           
 String getFileName()
           
 String getName()
           
 com.hp.hpl.jena.ontology.OntModel getOntologyModel()
           
 PackageInfo getPackage()
           
 String getPath()
           
 String getPrefix()
           
 String getPrefixForCode()
           
 String getRdfNamespace()
           
 com.hp.hpl.jena.rdf.model.Resource getResource(ClassInfo ci)
           
protected  com.hp.hpl.jena.rdf.model.Property mapProperty(PropertyInfo pi)
           
protected  com.hp.hpl.jena.rdf.model.Resource mapResource(ClassInfo ci, boolean processMapEntry)
           
protected  com.hp.hpl.jena.rdf.model.Resource mapTypeResource(PropertyInfo pi)
           
 String message(int mnr)
           This method returns messages belonging to the XML Schema target by their message number.
protected  String messageText(int mnr)
          This is the message text provision proper.
static String normalizedName(ClassInfo ci)
           
static String normalizedName(PackageInfo pi)
          Normalizes the name of a package according to the rules in ISO 19150-2owl:ontologyName.
static String normalizedName(PropertyInfo pi)
           
 void print(String outputDirectory, ShapeChangeResult r)
           
 void setupModel()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ontmodel

protected com.hp.hpl.jena.ontology.OntModel ontmodel

ontology

protected com.hp.hpl.jena.ontology.Ontology ontology

refmodel

protected static com.hp.hpl.jena.rdf.model.Model refmodel

options

protected Options options

result

public ShapeChangeResult result

model

protected Model model

mpackage

protected PackageInfo mpackage

printed

protected boolean printed

targetNamespace

protected String targetNamespace

name

protected String name

fileName

protected String fileName

rdfNamespace

protected String rdfNamespace

prefix

protected String prefix

owliso19150

protected OWLISO19150 owliso19150

finalized

protected boolean finalized

path

protected String path

backPath

protected String backPath

classInfos

protected List<ClassInfo> classInfos

config

protected TargetOwlConfiguration config

globalPropertyNames

protected Set<String> globalPropertyNames

properties

protected Map<String,de.interactive_instruments.ShapeChange.Target.Ontology.OntologyModel.OwlProperty> properties
Constructor Detail

OntologyModel

public OntologyModel(PackageInfo pi,
                     Model m,
                     Options o,
                     ShapeChangeResult r,
                     String xmlprefix,
                     OWLISO19150 owliso19150)
              throws ShapeChangeAbortException
Throws:
ShapeChangeAbortException
Method Detail

computeName

public String computeName()
Determines the ontology name of a given package. The name is constructed following the ISO 19150-2owl:ontologyName requirement. The ontologyName is defined via the following rules, in descending priority: If URIbase is used and the encoding rule OWLISO19150.RULE_OWL_PKG_PATH_IN_ONTOLOGY_NAME is in effect, then the umlPackageName is constructed using the path of the package to the upmost owner that is in the same targetNamespace - using a combination of "/" and normalized package names for all parent packages in the same target namespace; otherwise just the normalized package name is appended to URIbase as per 19150-2owl:ontologyName.

Parameters:
pi -
Returns:

normalizedName

public static String normalizedName(ClassInfo ci)

computePath

public static String computePath(PackageInfo pi)
Provides the path (of packages) that leads from the main schema package down to this package. The main schema package is the topmost parent/owner package that has the same target namespace as the given one. Each segment of the path is preceded by "/", followed by the normalized package name.

Parameters:
pi -
Returns:
See Also:
normalizedName(PackageInfo)

computeBackPath

public static String computeBackPath(PackageInfo pi)

normalizedName

public static String normalizedName(PackageInfo pi)
Normalizes the name of a package according to the rules in ISO 19150-2owl:ontologyName.

Parameters:
pi -
Returns:

setupModel

public void setupModel()

message

public String message(int mnr)

This method returns messages belonging to the XML Schema target by their message number. The organization corresponds to the logic in module ShapeChangeResult. All functions in that class, which require an 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.

finalizeDocument

public void finalizeDocument()
Specified by:
finalizeDocument in interface OntologyDocument

getName

public String getName()
Specified by:
getName in interface OntologyDocument
Returns:
the ontology name

getRdfNamespace

public String getRdfNamespace()
Specified by:
getRdfNamespace in interface OntologyDocument
Returns:
the rdfNamespace

getCodeNamespace

public String getCodeNamespace()
Specified by:
getCodeNamespace in interface OntologyDocument
Returns:
the rdfNamespace

addFeature

public com.hp.hpl.jena.rdf.model.Resource addFeature(ClassInfo ci)

addClassDefinition

public com.hp.hpl.jena.rdf.model.Resource addClassDefinition(ClassInfo ci)

addImport

protected void addImport(String rdfns,
                         String uri)

addMultiplicity

protected void addMultiplicity(com.hp.hpl.jena.ontology.OntClass cls,
                               PropertyInfo pi,
                               com.hp.hpl.jena.rdf.model.Property p)

addAllValuesFrom

protected void addAllValuesFrom(com.hp.hpl.jena.ontology.OntClass cls,
                                PropertyInfo pi,
                                com.hp.hpl.jena.rdf.model.Property p)

mapResource

protected com.hp.hpl.jena.rdf.model.Resource mapResource(ClassInfo ci,
                                                         boolean processMapEntry)

mapTypeResource

protected com.hp.hpl.jena.rdf.model.Resource mapTypeResource(PropertyInfo pi)

mapProperty

protected com.hp.hpl.jena.rdf.model.Property mapProperty(PropertyInfo pi)

normalizedName

public static String normalizedName(PropertyInfo pi)

getFileName

public String getFileName()
Specified by:
getFileName in interface OntologyDocument

addInterface

public com.hp.hpl.jena.rdf.model.Resource addInterface(ClassInfo ci)

addDatatype

public com.hp.hpl.jena.rdf.model.Resource addDatatype(ClassInfo ci)

addUnion

public com.hp.hpl.jena.rdf.model.Resource addUnion(ClassInfo ci)

addCodelist

public com.hp.hpl.jena.rdf.model.Resource addCodelist(ClassInfo ci)

addEnumeration

public com.hp.hpl.jena.rdf.model.Resource addEnumeration(ClassInfo ci)

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface OntologyDocument
Returns:
the prefix

getPrefixForCode

public String getPrefixForCode()
Specified by:
getPrefixForCode in interface OntologyDocument
Returns:
the prefix defined for the ontology, with 'code' appended.

getPath

public String getPath()
Specified by:
getPath in interface OntologyDocument
Returns:
the path

getBackPath

public String getBackPath()
Specified by:
getBackPath in interface OntologyDocument
Returns:
the backPath

getPackage

public PackageInfo getPackage()
Returns:
the mpackage

getOntologyModel

public com.hp.hpl.jena.ontology.OntModel getOntologyModel()

addClass

public void addClass(ClassInfo ci)
Specified by:
addClass in interface OntologyDocument

print

public void print(String outputDirectory,
                  ShapeChangeResult r)
Specified by:
print in interface OntologyDocument

getResource

public com.hp.hpl.jena.rdf.model.Resource getResource(ClassInfo ci)
Specified by:
getResource in interface OntologyDocument

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


Copyright © 2015. All rights reserved.