de.interactive_instruments.ShapeChange.Target.Ontology
Class OntologyDocumentRDFXML

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

public class OntologyDocumentRDFXML
extends Object
implements OntologyDocument, MessageSource

Author:
Johannes Echterhoff

Field Summary
protected  String backPath
           
protected  List<ClassInfo> classInfos
           
protected  TargetOwlConfiguration config
           
protected  Map<String,String> declaredRdfNamespacesByNsabr
          Contains information on namespaces that should be declared in the ontology root element key: nsabr; value: rdf namespace
protected  Document document
           
protected  String fileName
           
protected  boolean finalized
           
protected  Set<String> globalPropertyNames
           
protected  Map<String,String> globalPropertyRangeValueByPropertyName
          key: PropertyInfo.name(); value: 19150-2owl:propertyName (rdfNamespace + propertyLocalName)
protected  Comment hook
           
protected  Set<String> imports
          Contains locations for relevant ontologies that need to be imported
protected  Model model
           
protected  PackageInfo mpackage
           
protected  String name
           
protected  Element ontology
           
protected  Options options
           
protected  OWLISO19150 owliso19150
           
protected  String path
           
protected  String prefix
           
protected  boolean printed
           
protected  String rdfNamespace
           
 ShapeChangeResult result
           
protected  Element root
           
protected  String targetNamespace
           
protected  Map<String,String> usedRdfNamespacesByNsabr
          Contains information on namespaces that are used internally key: nsabr; value: rdf namespace
 
Constructor Summary
OntologyDocumentRDFXML(PackageInfo pi, Model m, Options o, ShapeChangeResult r, String xmlprefix, OWLISO19150 owliso19150)
           
 
Method Summary
protected  void addAttribute(Element e, String name, String value)
          Add attribute to an element
 void addClass(ClassInfo ci)
           
 void addClassDefinition(ClassInfo ci)
           
 void addCodelist(ClassInfo ci)
           
 void addDatatype(ClassInfo ci)
           
 void addEnumeration(ClassInfo ci)
           
 void addFeature(ClassInfo ci)
           
protected  void addImport(String rdfns)
           
protected  void addImport(String rdfns, String loc)
          Logs an import statement for the given namespace, if it is not the same as the one of this ontology document (or its code namespace), and if the location is not null.
protected  void addImport(String prefix, String rdfns, String loc)
          Logs an import statement for the given namespace, if it is not the same as the one of this ontology document (or its code namespace), and if the location is not null.
 void addInterface(ClassInfo ci)
           
protected  void addMultiplicity(Element classE, PropertyInfo pi)
           
 void 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.
static String computeRelativeLocation(OntologyDocument from, OntologyDocument to)
          Computes the relative path/location from a given ontology document to another ontology document.
 void createDocument()
           
 void finalizeDocument()
           
 String getBackPath()
           
 String getCodeNamespace()
           
 Document getDocument()
           
 String getFileName()
           
 String getName()
           
 PackageInfo getPackage()
           
 String getPath()
           
 String getPrefix()
           
 String getPrefixForCode()
           
 String getRdfNamespace()
           
 com.hp.hpl.jena.rdf.model.Resource getResource(ClassInfo ci)
           
protected  String mapElement(ClassInfo ci)
           
protected  String mapElement(Type ti)
           
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected Document document

root

protected Element root

ontology

protected Element ontology

hook

protected Comment hook

options

protected Options options

result

public ShapeChangeResult result

model

protected Model model

mpackage

protected PackageInfo mpackage

imports

protected Set<String> imports
Contains locations for relevant ontologies that need to be imported


declaredRdfNamespacesByNsabr

protected Map<String,String> declaredRdfNamespacesByNsabr
Contains information on namespaces that should be declared in the ontology root element

key: nsabr; value: rdf namespace


usedRdfNamespacesByNsabr

protected Map<String,String> usedRdfNamespacesByNsabr
Contains information on namespaces that are used internally

key: nsabr; value: rdf namespace


globalPropertyRangeValueByPropertyName

protected Map<String,String> globalPropertyRangeValueByPropertyName
key: PropertyInfo.name(); value: 19150-2owl:propertyName (rdfNamespace + propertyLocalName)


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
Constructor Detail

OntologyDocumentRDFXML

public OntologyDocumentRDFXML(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:

createDocument

public void createDocument()
                    throws ParserConfigurationException
Throws:
ParserConfigurationException

addImport

protected void addImport(String rdfns,
                         String loc)
Logs an import statement for the given namespace, if it is not the same as the one of this ontology document (or its code namespace), and if the location is not null. Also adds the namespace declaration (including retrieval of the abbreviation/prefix).

Note: the information will be added to the document when finalizeDocument() is called.

Parameters:
rdfns -
loc -

addImport

protected void addImport(String prefix,
                         String rdfns,
                         String loc)
Logs an import statement for the given namespace, if it is not the same as the one of this ontology document (or its code namespace), and if the location is not null.

Also adds the namespace declaration.

Note: the information will be added to the document when finalizeDocument() is called.

Parameters:
rdfns -
loc -

addAttribute

protected void addAttribute(Element e,
                            String name,
                            String value)
Add attribute to an element


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.

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

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 void addFeature(ClassInfo ci)

addClassDefinition

public void addClassDefinition(ClassInfo ci)

addImport

protected void addImport(String rdfns)

addMultiplicity

protected void addMultiplicity(Element classE,
                               PropertyInfo pi)

mapElement

protected String mapElement(Type ti)

normalizedName

public static String normalizedName(PropertyInfo pi)

mapElement

protected String mapElement(ClassInfo ci)

computeRelativeLocation

public static String computeRelativeLocation(OntologyDocument from,
                                             OntologyDocument to)
Computes the relative path/location from a given ontology document to another ontology document.

Parameters:
from -
to -
Returns:

getFileName

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

addInterface

public void addInterface(ClassInfo ci)

addDatatype

public void addDatatype(ClassInfo ci)

addUnion

public void addUnion(ClassInfo ci)

addCodelist

public void addCodelist(ClassInfo ci)

addEnumeration

public void 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

getDocument

public Document getDocument()

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


Copyright © 2015. All rights reserved.