-- @atlcompiler atl2006 -- $Id: ECORE2OWL2.atl 7823 2008-12-10 09:33:51Z dwagelaa $ -- Translates Ecore to OWL2 module ECORE2OWL2; --extends ECORE2OWL create OUT : OWL from IN : ECORE, IN2 : ECORE; uses ECORE2OWL; -- ====================================================================== -- transformation rules begin -- ====================================================================== rule OtherEPackage { from s : ECORE!"ecore::EPackage" (thisModule.otherElements->includes(s)) to n : OWL!"rdfs::Namespace" ( name <- s.name.debug('OtherEPackage'), URI <- s.nsURI + '#'), allContainment : OWL!"owl::OWLObjectProperty" ( localName <- 'allContainment', OWLInverseOf <- allContainer, transitive <- true, namespace <- n), allContainer : OWL!"owl::OWLObjectProperty" ( localName <- 'allContainer', transitive <- true, namespace <- n), containment : OWL!"owl::OWLObjectProperty" ( localName <- 'containment', OWLInverseOf <- container, inverseFunctional <- true, RDFSSubPropertyOf <- allContainment, namespace <- n), container : OWL!"owl::OWLObjectProperty" ( localName <- 'container', functional <- true, RDFSSubPropertyOf <- allContainer, namespace <- n) } rule EClass { from s : ECORE!"ecore::EClass" to t : OWL!"owl::OWLClass" ( localName <- s.name.debug('EClass'), RDFSSubClassOf <- s.eSuperTypes, namespace <- s.ePackage) } rule EDataType { from s : ECORE!"ecore::EDataType" (s.oclIsTypeOf(ECORE!"ecore::EDataType")) to t : OWL!"rdfs::RDFSDatatype" ( localName <- s.xsdTypeName, namespace <- thisModule.XSDNamespace('xsd')) } rule EAttribute { from s : ECORE!"ecore::EAttribute" ( if not s.eContainingClass.oclIsUndefined() then -- some EAttributes are stored under EAnnotations not s.eType.oclIsKindOf(ECORE!"ecore::EEnum") else false endif) to t : OWL!"owl::OWLDatatypeProperty" ( localName <- s.eContainingClass.name + '_' + s.name, functional <- (s.upperBound = 1), RDFSDomain <- s.eContainingClass, RDFSRange <- s.eType, namespace <- s.eContainingClass.ePackage) } rule EAttribute_EEnum { from s : ECORE!"ecore::EAttribute" ( if not s.eContainingClass.oclIsUndefined() then -- some EAttributes are stored under EAnnotations s.eType.oclIsKindOf(ECORE!"ecore::EEnum") else false endif) to t : OWL!"owl::OWLDatatypeProperty" ( localName <- s.eContainingClass.name + '_' + s.name, functional <- (s.upperBound = 1), RDFSSubPropertyOf <- s.eType, RDFSDomain <- s.eContainingClass, namespace <- s.eContainingClass.ePackage) } rule EReference { from s : ECORE!"ecore::EReference" ( not s.eContainingClass.oclIsUndefined()) -- some EReferences are stored under EAnnotations to t : OWL!"owl::OWLObjectProperty" ( localName <- s.eContainingClass.name + '_' + s.name, functional <- (s.upperBound = 1), RDFSDomain <- s.eContainingClass, RDFSRange <- s.eType, OWLInverseOf <- s.eOpposite, RDFSSubPropertyOf <- if s.containment then Sequence{thisModule.resolveTemp(s.eContainingClass.ePackage, 'containment')} else if s.container then Sequence{thisModule.resolveTemp(s.eContainingClass.ePackage, 'container')} else Sequence{} endif endif, namespace <- s.eContainingClass.ePackage) } rule EEnum { from s : ECORE!"ecore::EEnum" to t : OWL!"owl::OWLDatatypeProperty" ( localName <- s.name, RDFSRange <- dr, namespace <- s.ePackage), dr : OWL!"owl::OWLDataRange" ( OWLOneOf <- s.eLiterals, namespace <- s.ePackage) } rule EEnumLiteral { from s : ECORE!"ecore::EEnumLiteral" to t : OWL!"rdfs::TypedLiteral" ( lexicalForm <- s.literal, datatype <- thisModule.XSDType('Name'), namespace <- s.eEnum.ePackage) } -- ====================================================================== -- transformation rules end -- ======================================================================