| 158 | | |
| | 158 | mapEntity :: Map.Map Entity URI -> Entity -> Entity |
| | 159 | mapEntity m (Entity ty u) = Entity ty $ getUri ty u m |
| | 160 | |
| | 161 | mapAnno :: Map.Map Entity URI -> Annotation -> Annotation |
| | 162 | mapAnno m ann = case ann of |
| | 163 | Annotation a e -> Annotation a $ mapEntity m e |
| | 164 | _ -> ann |
| | 165 | |
| | 166 | mapSen :: OWLMorphism -> Axiom -> Result Axiom |
| | 167 | mapSen m = return . mapAxiom (mmaps m) |
| | 168 | |
| | 169 | mapAxiom :: Map.Map Entity URI -> Axiom -> Axiom |
| | 170 | mapAxiom m axm = case axm of |
| | 171 | PlainAxiom as a -> PlainAxiom (map (mapAnno m) as) $ mapPlainAxiom m a |
| | 172 | EntityAnno (EntityAnnotation as e bs) -> |
| | 173 | EntityAnno $ EntityAnnotation (map (mapAnno m) as) (mapEntity m e) |
| | 174 | $ map (mapAnno m) bs |
| | 175 | |
| | 176 | mapObjExpr :: Map.Map Entity URI -> ObjectPropertyExpression |
| | 177 | -> ObjectPropertyExpression |
| | 178 | mapObjExpr m ope = case ope of |
| | 179 | OpURI u -> OpURI $ getUri ObjectProperty u m |
| | 180 | InverseOp o -> InverseOp $ mapObjExpr m o |
| | 181 | |
| | 182 | mapDRange :: Map.Map Entity URI -> DataRange -> DataRange |
| | 183 | mapDRange m dr = case dr of |
| | 184 | DRDatatype u -> DRDatatype $ getUri Datatype u m |
| | 185 | DataComplementOf d -> DataComplementOf $ mapDRange m d |
| | 186 | DataOneOf _ -> dr |
| | 187 | DatatypeRestriction d l -> DatatypeRestriction (mapDRange m d) l |
| | 188 | |
| | 189 | mapDataExpr :: Map.Map Entity URI -> DataPropertyExpression |
| | 190 | -> DataPropertyExpression |
| | 191 | mapDataExpr m dpe = getUri DataProperty dpe m |
| | 192 | |
| | 193 | getClassUri :: URI -> Map.Map Entity URI -> URI |
| | 194 | getClassUri = getUri OWLClass |
| | 195 | |
| | 196 | getIndUri :: URI -> Map.Map Entity URI -> URI |
| | 197 | getIndUri = getUri Individual |
| | 198 | |
| | 199 | mapCard :: (a -> b) -> (c -> d) -> Cardinality a c -> Cardinality b d |
| | 200 | mapCard f g (Cardinality ty i a mb) = |
| | 201 | Cardinality ty i (f a) $ fmap g mb |
| | 202 | |
| | 203 | mapDescr :: Map.Map Entity URI -> Description -> Description |
| | 204 | mapDescr m desc = case desc of |
| | 205 | OWLClassDescription u -> OWLClassDescription $ getClassUri u m |
| | 206 | ObjectJunction ty ds -> ObjectJunction ty $ map (mapDescr m) ds |
| | 207 | ObjectComplementOf d -> ObjectComplementOf $ mapDescr m d |
| | 208 | ObjectOneOf is -> ObjectOneOf $ map (flip getIndUri m) is |
| | 209 | ObjectValuesFrom ty o d -> ObjectValuesFrom ty (mapObjExpr m o) |
| | 210 | $ mapDescr m d |
| | 211 | ObjectExistsSelf o -> ObjectExistsSelf $ mapObjExpr m o |
| | 212 | ObjectHasValue o i -> ObjectHasValue (mapObjExpr m o) $ getIndUri i m |
| | 213 | ObjectCardinality c -> ObjectCardinality |
| | 214 | $ mapCard (mapObjExpr m) (mapDescr m) c |
| | 215 | DataValuesFrom ty d ds dr -> DataValuesFrom ty (mapDataExpr m d) |
| | 216 | (map (mapDataExpr m) ds) $ mapDRange m dr |
| | 217 | DataHasValue d c -> DataHasValue (mapDataExpr m d) c |
| | 218 | DataCardinality c -> DataCardinality |
| | 219 | $ mapCard (mapDataExpr m) (mapDRange m) c |
| | 220 | |
| | 221 | mapSubObjExpr :: Map.Map Entity URI -> SubObjectPropertyExpression |
| | 222 | -> SubObjectPropertyExpression |
| | 223 | mapSubObjExpr m ope = case ope of |
| | 224 | OPExpression o -> OPExpression $ mapObjExpr m o |
| | 225 | SubObjectPropertyChain os -> SubObjectPropertyChain |
| | 226 | $ map (mapObjExpr m) os |
| | 227 | |
| | 228 | mapDataDomOrRange :: Map.Map Entity URI -> DataDomainOrRange |
| | 229 | -> DataDomainOrRange |
| | 230 | mapDataDomOrRange m ddr = case ddr of |
| | 231 | DataDomain d -> DataDomain $ mapDescr m d |
| | 232 | DataRange d -> DataRange $ mapDRange m d |
| | 233 | |
| | 234 | mapAssertion :: Map.Map Entity URI -> (a -> b) -> (c -> d) |
| | 235 | -> Assertion a c -> Assertion b d |
| | 236 | mapAssertion m f g (Assertion a ty i b) = |
| | 237 | Assertion (f a) ty (getIndUri i m) $ g b |
| | 238 | |
| | 239 | mapPlainAxiom :: Map.Map Entity URI -> PlainAxiom -> PlainAxiom |
| | 240 | mapPlainAxiom m pax = case pax of |
| | 241 | SubClassOf s t -> SubClassOf (mapDescr m s) $ mapDescr m t |
| | 242 | EquivOrDisjointClasses ty ds -> EquivOrDisjointClasses ty |
| | 243 | $ map (mapDescr m) ds |
| | 244 | DisjointUnion u ds -> DisjointUnion (getClassUri u m) |
| | 245 | $ map (mapDescr m) ds |
| | 246 | SubObjectPropertyOf so o -> SubObjectPropertyOf (mapSubObjExpr m so) |
| | 247 | $ mapObjExpr m o |
| | 248 | EquivOrDisjointObjectProperties ty os -> EquivOrDisjointObjectProperties ty |
| | 249 | $ map (mapObjExpr m) os |
| | 250 | ObjectPropertyDomainOrRange odr o d -> ObjectPropertyDomainOrRange odr |
| | 251 | (mapObjExpr m o) $ mapDescr m d |
| | 252 | InverseObjectProperties o p -> InverseObjectProperties (mapObjExpr m o) |
| | 253 | $ mapObjExpr m p |
| | 254 | ObjectPropertyCharacter c o -> ObjectPropertyCharacter c $ mapObjExpr m o |
| | 255 | SubDataPropertyOf d e -> SubDataPropertyOf (mapDataExpr m d) |
| | 256 | $ mapDataExpr m e |
| | 257 | EquivOrDisjointDataProperties ty ds -> EquivOrDisjointDataProperties ty |
| | 258 | $ map (mapDataExpr m) ds |
| | 259 | DataPropertyDomainOrRange dd d -> DataPropertyDomainOrRange |
| | 260 | (mapDataDomOrRange m dd) $ mapDataExpr m d |
| | 261 | FunctionalDataProperty d -> FunctionalDataProperty $ mapDataExpr m d |
| | 262 | SameOrDifferentIndividual ty is -> SameOrDifferentIndividual ty |
| | 263 | $ map (flip getIndUri m) is |
| | 264 | ClassAssertion i d -> ClassAssertion (getIndUri i m) $ mapDescr m d |
| | 265 | ObjectPropertyAssertion a -> ObjectPropertyAssertion |
| | 266 | $ mapAssertion m (mapObjExpr m) (flip getIndUri m) a |
| | 267 | DataPropertyAssertion a -> DataPropertyAssertion |
| | 268 | $ mapAssertion m (mapDataExpr m) id a |
| | 269 | Declaration (Entity ty u) -> Declaration $ Entity ty $ getUri ty u m |
| | 270 | |