Changeset 12764
- Timestamp:
- 30.10.2009 18:15:26 (3 weeks ago)
- Location:
- trunk/OWL
- Files:
-
- 3 modified
-
Logic_OWL.hs (modified) (2 diffs)
-
Morphism.hs (modified) (5 diffs)
-
StaticAnalysis.hs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/OWL/Logic_OWL.hs
r12478 r12764 67 67 if isAxiom namedSen then empty else space <> text "%implied" 68 68 sym_of OWL = symOf 69 symmap_of OWL = symMapOf 69 70 70 71 instance StaticAnalysis OWL OntologyFile Axiom … … 85 86 symbol_to_raw OWL = ASymbol 86 87 induced_from_morphism OWL = inducedFromMor 88 induced_from_to_morphism OWL = inducedFromToMor 87 89 cogenerated_sign OWL = cogeneratedSign 88 90 generated_sign OWL = fail "cogenerated_sign OWL nyi" -
trunk/OWL/Morphism.hs
r12072 r12764 23 23 , statSymbMapItems 24 24 , inducedFromMor 25 , inducedFromToMor 26 , symMapOf 25 27 , mapSen 26 28 ) where … … 33 35 import Common.DocUtils 34 36 import Common.Doc 37 import Common.ExtSign 35 38 import Common.Result 36 39 import Common.Lib.State (execState) 40 import Common.Lib.Rel (setToMap) 37 41 38 42 import Control.Monad … … 56 60 isOWLInclusion m = Map.null (mmaps m) && isSubSign (osource m) (otarget m) 57 61 62 symMap :: Map.Map Entity URI -> Map.Map Entity Entity 63 symMap = Map.mapWithKey (\ (Entity ty _) -> Entity ty) 64 58 65 inducedElems :: Map.Map Entity URI -> [Entity] 59 inducedElems = Map.elems . Map.mapWithKey (\ (Entity ty _) u -> Entity ty u)66 inducedElems = Map.elems . symMap 60 67 61 68 inducedSign :: Map.Map Entity URI -> Sign -> Sign … … 82 89 , mmaps = mm } 83 90 91 inducedFromToMor :: Map.Map RawSymb RawSymb -> ExtSign Sign Entity 92 -> ExtSign Sign Entity -> Result OWLMorphism 93 inducedFromToMor rm (ExtSign sig _) (ExtSign tar _) = do 94 mor <- inducedFromMor rm sig 95 if isSubSign (otarget mor) tar 96 then return mor { otarget = tar } 97 else fail "OWL.inducedFromToMor" 98 99 symMapOf :: OWLMorphism -> Map.Map Entity Entity 100 symMapOf mor = Map.union (symMap $ mmaps mor) $ setToMap $ symOf $ osource mor 101 84 102 instance Pretty OWLMorphism where 85 103 pretty m = let … … 148 166 ++ showDoc u " and " ++ showDoc t "") 149 167 Map.empty 150 . (concatMap 151 $ \ (SymbMapItems m us) -> 168 . concatMap (\ (SymbMapItems m us) -> 152 169 let ps = map (\ (u, v) -> (u, fromMaybe u v)) us in 153 170 case m of -
trunk/OWL/StaticAnalysis.hs
r11854 r12764 70 70 DatatypeRestriction r fcs -> do 71 71 anaDataRange r 72 mapM_ anaConstant $ map sndfcs72 mapM_ (anaConstant . snd) fcs 73 73 74 74 anaDescription :: Description -> State Sign () … … 165 165 integrateNamespaces (namespaceMap inSign) ns 166 166 ofile' = renameNamespace transMap ofile 167 syms = Set.difference (symOf accSign) $ symOf inSign 167 168 (sens, accSign) = runState 168 169 (mapM anaAxiom $ axiomsList $ ontology ofile') 169 170 inSign {namespaceMap = integNamespace 170 ,ontologyID = uri $ ontology $ofile'171 ,ontologyID = uri $ ontology ofile' 171 172 } 172 in Result diags1 $ Just (ofile', mkExtSign accSign, concat sens) 173 in Result diags1 174 $ Just (ofile', ExtSign accSign syms, concat sens) 173 175 where 174 176 oName = uri $ ontology ofile … … 178 180 if null iuri then [] 179 181 else 180 let uri' = take ( (length iuri) -1) iuri181 in if uri' `elem`importList182 let uri' = take (length iuri - 1) iuri 183 in if elem uri' importList 182 184 then [] 183 185 else … … 186 188 ("\"" ++ uri' ++ "\"" ++ 187 189 " is not imported in ontology: " ++ 188 (show $localPart oName))190 show (localPart oName)) 189 191 ()] 190 importList = (localPart oName):191 (map localPart (importsList $ ontology ofile))192 importList = localPart oName 193 : map localPart (importsList $ ontology ofile) 192 194 193 195 removeDefault :: Namespace -> Namespace 194 removeDefault namespace=195 Map.delete "owl11" (Map.delete "owl" (Map.delete "xsd"196 (Map.delete "rdf" (Map.delete "rdfs"197 (Map.delete "xml" namespace)))))196 removeDefault = 197 Map.delete "owl11" . Map.delete "owl" . Map.delete "xsd" 198 . Map.delete "rdf" . Map.delete "rdfs" 199 . Map.delete "xml" 198 200 199 201 getObjRoleFromExpression :: ObjectPropertyExpression -> IndividualRoleURI … … 207 209 getObjRoleFromSubExpression sopExp = 208 210 case sopExp of 209 OPExpression opExp -> (getObjRoleFromExpression opExp):[]211 OPExpression opExp -> [getObjRoleFromExpression opExp] 210 212 SubObjectPropertyChain expList -> 211 213 map getObjRoleFromExpression expList … … 224 226 case anno of 225 227 ExplicitAnnotation auri (Constant value (Typed _)) -> 226 if localPart auri == "Implied" then 227 if value == "true" then 228 True 229 else False 228 if localPart auri == "Implied" then value == "true" 230 229 else isToProve r 231 230 _ -> isToProve r