1178N/ACopyright : (c) Dominik Luecke, 2008
1178N/AMaintainer : luecke@informatik.uni-bremen.de
1178N/AThis module implements conservativity checks for OWL 2.0 based on the
1178N/Athe syntactic locality checker written in Java from the OWL-Api.
1178N/A-- | Conservativity Check for Propositional Logic
4033N/AconserCheck :: String -- ^ Conser type
1178N/A -> (Sign, [Named Axiom]) -- ^ Initial sign and formulas
1178N/A -> OWLMorphism -- ^ morphism between specs
4033N/A -> [Named Axiom] -- ^ Formulas of extended spec
1178N/A -> IO (Result (Maybe (Conservativity, [Axiom])))
1178N/AconserCheck ct = uncurry $ doConservCheck localityJar ct
4033N/A-- | Real conservativity check in IO Monad
0N/AdoConservCheck :: String -- ^ Jar name
0N/A -> String -- ^ Conser Type
0N/A -> Sign -- ^ Signature of Onto 1
0N/A -> [Named Axiom] -- ^ Formulas of Onto 1
0N/A -> OWLMorphism -- ^ Morphism
0N/A -> [Named Axiom] -- ^ Formulas of Onto 2
0N/A -> IO (Result (Maybe (Conservativity, [Axiom])))
0N/AdoConservCheck jar ct sig1 sen1 mor sen2 =
0N/A let ontoFile = printOWLBasicTheory (otarget mor, filter isAxiom sen2)
0N/A sigFile = printOWLBasicTheory (sig1, filter isAxiom sen1)
0N/A in runLocalityChecker jar ct (show ontoFile) (show sigFile)
0N/A-- | Invoke the Java checker
1178N/ArunLocalityChecker :: String -- ^ Jar name
0N/A -> String -- ^ Conser Type
1178N/A -> IO (Result (Maybe (Conservativity, [Axiom])))
0N/ArunLocalityChecker jar ct onto sig = do
1178N/A (progTh, toolPath) <- check4HetsOWLjar jar
4033N/A if progTh then withinDirectory toolPath $ do
4033N/A tempDir <- getTemporaryDirectory
1178N/A command = "java -jar " ++ jar ++ " file://" ++ ontoFile
4033N/A ++ " file://" ++ sigFile ++ " " ++ ct
4033N/A (mExit, outh, _) <- timeoutCommand tLimit command
0N/A Just cont -> parseOutput outh cont
4033N/A return $ fail $ "Timelimit " ++ show tLimit ++ " exceeded"
4033N/A else return $ fail $ jar ++ " not found"
0N/AparseOutput :: Handle -- ^ handel of stdout
0N/A -> IO (Result (Maybe (Conservativity, [Axiom])))
0N/A ExitFailure 10 -> return $ Just (Cons, [])
4033N/A ExitFailure 20 -> fail $ unlines ls
1178N/A x -> fail $ "Internal program error: " ++ show x ++ "\n" ++ unlines ls