public class ProtegeOwl2LG
extends java.lang.Object
Constructor and Description |
---|
ProtegeOwl2LG(java.net.URI owlURI,
CodingSchemeManifest manifest,
LoaderPreferences loadPrefs,
int memorySafe,
LgMessageDirectorIF messages)
Create a new instance for conversion.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAnnotationPropertyAssociations(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Create an association for annotation properties that have an
OWLNamedClass or OWLIndividual as their target.
|
protected AssociationWrapper |
addAssociation(edu.stanford.smi.protegex.owl.model.RDFProperty rdfProp) |
protected AssociationSource |
addAssocSrc2Assoc(AssociationWrapper aw,
AssociationSource assocSource) |
protected void |
addEntity(AssociationEntity lgEntity) |
protected void |
addEntity(Entity lgEntity) |
protected void |
addToSupportedPropertyAndMap(java.lang.String label,
java.lang.String propertyName,
edu.stanford.smi.protegex.owl.model.RDFProperty rdfProp) |
protected java.lang.String |
generateDatatypeID(int i)
Constructs a new datatype id with the given integer suffix.
|
protected java.lang.String |
generateDatatypeInstanceID(int i)
Constructs a new datatype instance id (e.g., instance of xsd:int is "24")
with the given integer suffix.
|
protected java.lang.String |
generatePropertyID(int i)
Constructs a new property id with the given integer suffix.
|
protected java.lang.String |
getAssociationLabel(java.lang.String associationName,
boolean forward) |
protected java.lang.String |
getFromLastIndexOfColonOrHash(java.lang.String str) |
protected java.lang.String |
getNameSpace(java.lang.String str) |
protected java.lang.String |
getRDFResourceLocalName(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource) |
protected void |
handleProtegeErrors(java.util.Collection errors) |
protected void |
initAssociationEntities() |
protected void |
initOWLModelFromSource()
Initialize the Java model from source.
|
protected void |
initScheme()
Initializes the EMF coding scheme and adds top-level containers for codes
and relations.
|
protected void |
initSchemeMetadata()
Initialize further metadata about the coding scheme.
|
protected Entity |
initSubtypeRoot()
Initialize and return the root node for the subclass hierarchy.
|
protected void |
initSupportedAssociationAnnotationProperties()
We need to find which annotation properties have a OWLNamedClass or
OWLIndividual as the RHS and treat them as an association.
|
protected void |
initSupportedDatatypeProperties()
This method initializes the OWL datatype properties.
|
protected void |
initSupportedDatatypes()
This method determines the various data types that are used in the
ontology and stores them.
|
protected void |
initSupportedMappings()
Initialize tracking of supported behavior specified in LexGrid metadata.
|
protected void |
initSupportedObjectProperties()
This method initializes the user defined OWL object properties in the
ontology.
|
protected boolean |
isEntityCodeRegistered(java.lang.String namespace,
java.lang.String code)
Indicates if the given entity code has been registered against a
namespace.
|
protected boolean |
isNoop(java.lang.String s)
Indicates whether the given string represents a null or empty resource.
|
protected boolean |
isNoopNamespace(java.lang.String s)
Indicates whether the given string defines a resource in a non-operative
namespace.
|
protected boolean |
isRootNode(edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
Determines if a given concept is a root node or not.
|
protected void |
processAllConceptsAndProperties(SimpleMemUsageReporter.Snapshot snap)
This method is responsible for processing of all the OWL concepts.
|
protected void |
processAllConceptsRelations() |
protected void |
processAllInstanceAndProperties(SimpleMemUsageReporter.Snapshot snap)
Process the instance information in the ontology.
|
protected void |
processAllInstanceRelations() |
protected void |
processConcepts(SimpleMemUsageReporter.Snapshot snap)
This method is responsible for processing of all the OWL concepts.
|
protected void |
processInstances(SimpleMemUsageReporter.Snapshot snap)
Process the instance information in the ontology.
|
protected void |
processOWL()
Create and populate the EMF representation of the coding scheme.
|
protected void |
processOWLDatatypeProperties(SimpleMemUsageReporter.Snapshot snap)
This method determines the domain and ranges for the OWL Datatype
properties.
|
protected void |
processOWLObjectProperties(SimpleMemUsageReporter.Snapshot snap)
This method determines the domain and ranges for the OWL Object
properties.
|
protected void |
processRestriction(edu.stanford.smi.protegex.owl.model.OWLRestriction restriction,
AssociationSource assocSource,
AssociationSource source) |
protected void |
relateAssociationSourceData(AssociationWrapper aw,
AssociationSource source,
AssociationData data) |
protected void |
relateAssociationSourceTarget(AssociationWrapper aw,
AssociationSource source,
AssociationTarget target) |
protected void |
relateAssocSourceWithRDFResourceTarget(EntityTypes type,
AssociationWrapper aw,
AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFResource tgtResource)
The RDFResource is used to compute the target.
|
protected void |
resolveAnnotationPropertyRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Create an association for the annotation properties that have a
OWLNamedClass or OWLIndividual as RHS
|
protected java.lang.String |
resolveAnonymousClass(edu.stanford.smi.protegex.owl.model.OWLClass owlClass,
AssociationSource assocSource)
This method handles the resolution of owl:Anonymous classes.
|
protected Entity |
resolveAssociation(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Defines an EMF concept and properties based on the given rdf source.
|
protected void |
resolveAssociationProperty(AssociationEntity assocEntity,
edu.stanford.smi.protegex.owl.model.RDFProperty rdfProp)
Resolve all properties encapsulated by the RDFProperty and assign
corresponding EMF properties to the given association.
|
protected void |
resolveComplementOfRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
Defines EMF complementOf relations based on OWL source.
|
protected Entity |
resolveConcept(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Defines an EMF concept and properties based on the given rdf source.
|
protected java.lang.String |
resolveConceptID(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Return the concept identifier mapped to the given rdf resource, or the
null if no mapping exists.
|
protected void |
resolveDatatypePropertyRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Create an association for the datatype properties when the preference is
both or association
|
protected void |
resolveDifferentFromRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFIndividual individual)
Defines EMF differentFrom relations based on OWL source.
|
protected void |
resolveDisjointWithRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
Defines EMF equivalentClass relations based on OWL source.
|
protected void |
resolveEntityProperties(Entity lgEntity,
edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Resolve and assign all property information contained by the given RDF
resource to the EMF Entity.
|
protected void |
resolveEquivalentClassRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
Defines EMF equivalentClass relations based on OWL source.
|
protected Entity |
resolveIndividual(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Defines an EMF instance.
|
protected void |
resolveIndividualProperties(Entity lgInstance,
edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
This method associates OWLIndividuals and their properties: OWLDatatype
and OWLObject.
|
protected java.lang.String |
resolveInstanceID(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Return the instance identifier mapped to the given rdf resource name, or
the rdf class name if no mapping exists.
|
protected java.lang.String |
resolveLabel(edu.stanford.smi.protegex.owl.model.RDFResource rdf)
Return the first label assigned to the given resource, or the rdf
resource name if no labels are assigned.
|
protected void |
resolveOWLObjectPropertyRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
Defines EMF class RDF properties.
|
protected Property |
resolveProp(edu.stanford.smi.protegex.owl.model.RDFProperty prop,
java.lang.String lgClass,
java.lang.String lgID,
java.lang.String lgLabel,
java.lang.String lgDType,
java.lang.String rdfNamespace,
java.lang.String rdfText,
java.lang.String lang)
Instantiate and return a new EMF property based on the provided values.
|
protected java.lang.String |
resolveRDFText(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource,
java.lang.Object rdfProperty)
Return the text value assigned to the given rdf property.
|
protected void |
resolveRdfTypeRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFIndividual individual)
Defines EMF RDFType relations based on OWL source.
|
protected void |
resolveSameAsRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFIndividual individual)
Defines EMF complementOf relations based on OWL source.
|
protected void |
resolveSubClassOfRelations(AssociationSource source,
edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
Defines EMF subClassOf relations based on OWL source.
|
protected java.util.Map<java.lang.String,java.lang.String> |
resolveXMLTagsAndValues(java.lang.String src)
Returns a map from the xml tags imbedded within the given source string
to associated text values.
|
CodingScheme |
run()
Runs the conversion.
|
protected void |
updateApproximateConceptNumber() |
protected void |
writeAssociationSourceTarget(AssociationWrapper aw,
AssociationSource source,
AssociationTarget target) |
protected void |
writeEntity(Entity entity) |
public ProtegeOwl2LG(java.net.URI owlURI, CodingSchemeManifest manifest, LoaderPreferences loadPrefs, int memorySafe, LgMessageDirectorIF messages)
owlURI
- The OWL input file.manifest
- The OWL manifest Objectmessages
- Responsible for handling display of program messages to the
user.dbDriver
- If specified, enables database on Protege load (reduced memory
footprint).dbUrl
- If specified, enables database on Protege load (reduced memory
footprint).dbTable
- If specified, enables database on Protege load (reduced memory
footprint).dbUser
- If specified, enables database on Protege load (reduced memory
footprint).dbPassword
- If specified, enables database on Protege load (reduced memory
footprint).public CodingScheme run() throws LgConvertException
LgConvertException
- If an error occurs in processing.protected void processOWL() throws LgConvertException
LgConvertException
- If an error occurs in processing.protected void processAllConceptsAndProperties(SimpleMemUsageReporter.Snapshot snap)
protected void processAllConceptsRelations()
protected void processAllInstanceAndProperties(SimpleMemUsageReporter.Snapshot snap)
protected void processAllInstanceRelations()
protected void processConcepts(SimpleMemUsageReporter.Snapshot snap)
protected void processInstances(SimpleMemUsageReporter.Snapshot snap)
protected void processOWLObjectProperties(SimpleMemUsageReporter.Snapshot snap)
protected void processOWLDatatypeProperties(SimpleMemUsageReporter.Snapshot snap)
protected Entity resolveConcept(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
rdfResource
- The resource to evaluate.protected Entity resolveAssociation(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
rdfResource
- The resource to evaluate.protected void resolveSubClassOfRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
protected void resolveEquivalentClassRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
protected void resolveDisjointWithRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
protected void resolveComplementOfRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
protected void resolveOWLObjectPropertyRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
protected void resolveDifferentFromRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFIndividual individual)
protected void resolveSameAsRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFIndividual individual)
protected void resolveRdfTypeRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFIndividual individual)
protected void resolveEntityProperties(Entity lgEntity, edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
lgEntity
- rdfResource
- Last updated: 05/28/2008protected Entity resolveIndividual(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
protected void resolveIndividualProperties(Entity lgInstance, edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
lgInstance
- rdfResource
- protected void resolveAnnotationPropertyRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
protected Property resolveProp(edu.stanford.smi.protegex.owl.model.RDFProperty prop, java.lang.String lgClass, java.lang.String lgID, java.lang.String lgLabel, java.lang.String lgDType, java.lang.String rdfNamespace, java.lang.String rdfText, java.lang.String lang)
lgClass
- The EMF property class to instantiate (presentation, comment,
etc).lgID
- The identifier to assign to the new property; not null.lgLabel
- The name or label for the new property; not null.lgDType
- The data type of the new property; null if not applicable.rdfNamespace
- Namespace of the RDF property being converted.rdfText
- Text from the RDF property being converted.protected java.lang.String resolveAnonymousClass(edu.stanford.smi.protegex.owl.model.OWLClass owlClass, AssociationSource assocSource)
owlClass
- protected void resolveDatatypePropertyRelations(AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
protected void processRestriction(edu.stanford.smi.protegex.owl.model.OWLRestriction restriction, AssociationSource assocSource, AssociationSource source)
restriction
- assocSource
- - The assocSource that should be added if processing strict
owlsource
- - The normal source of the associationprotected void initOWLModelFromSource() throws LgConvertException
LgConvertException
protected void initSupportedMappings()
protected void initScheme()
protected void initSchemeMetadata()
protected void initSupportedDatatypeProperties()
protected void addToSupportedPropertyAndMap(java.lang.String label, java.lang.String propertyName, edu.stanford.smi.protegex.owl.model.RDFProperty rdfProp)
protected void initAssociationEntities()
protected void initSupportedDatatypes()
protected void initSupportedObjectProperties()
protected void initSupportedAssociationAnnotationProperties()
protected void addAnnotationPropertyAssociations(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
rdfResource
- protected AssociationWrapper addAssociation(edu.stanford.smi.protegex.owl.model.RDFProperty rdfProp)
protected Entity initSubtypeRoot()
protected boolean isEntityCodeRegistered(java.lang.String namespace, java.lang.String code)
code
- protected boolean isNoop(java.lang.String s)
s
- protected boolean isNoopNamespace(java.lang.String s)
s
- protected boolean isRootNode(edu.stanford.smi.protegex.owl.model.RDFSNamedClass rdfsNamedClass)
rdfsNamedClass
- protected java.lang.String generatePropertyID(int i)
i
- protected java.lang.String generateDatatypeID(int i)
i
- protected java.lang.String generateDatatypeInstanceID(int i)
i
- protected void resolveAssociationProperty(AssociationEntity assocEntity, edu.stanford.smi.protegex.owl.model.RDFProperty rdfProp)
assoc
- rdfProp
- protected java.lang.String resolveLabel(edu.stanford.smi.protegex.owl.model.RDFResource rdf)
rdf
- protected java.lang.String resolveRDFText(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource, java.lang.Object rdfProperty)
rdfResource
- rdfProperty
- protected java.util.Map<java.lang.String,java.lang.String> resolveXMLTagsAndValues(java.lang.String src)
Note: This method assumes a non-repeating single-level tag structure, and bypasses formal xml parsing in favor of performance/simplicity.
src
- protected java.lang.String resolveConceptID(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
rdfResource
- protected java.lang.String resolveInstanceID(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
rdfResource
- protected AssociationSource addAssocSrc2Assoc(AssociationWrapper aw, AssociationSource assocSource)
protected java.lang.String getAssociationLabel(java.lang.String associationName, boolean forward)
protected java.lang.String getFromLastIndexOfColonOrHash(java.lang.String str)
protected java.lang.String getRDFResourceLocalName(edu.stanford.smi.protegex.owl.model.RDFResource rdfResource)
protected java.lang.String getNameSpace(java.lang.String str)
protected void handleProtegeErrors(java.util.Collection errors)
protected void addEntity(Entity lgEntity)
protected void addEntity(AssociationEntity lgEntity)
protected void writeEntity(Entity entity) throws java.lang.Exception
java.lang.Exception
protected void relateAssocSourceWithRDFResourceTarget(EntityTypes type, AssociationWrapper aw, AssociationSource source, edu.stanford.smi.protegex.owl.model.RDFResource tgtResource)
type
- assoc
- source
- tgtResource
- protected void relateAssociationSourceTarget(AssociationWrapper aw, AssociationSource source, AssociationTarget target)
protected void relateAssociationSourceData(AssociationWrapper aw, AssociationSource source, AssociationData data)
protected void writeAssociationSourceTarget(AssociationWrapper aw, AssociationSource source, AssociationTarget target)
protected void updateApproximateConceptNumber()