From 08be704c2e2f66719620d079d8c38fd3c73bf4b7 Mon Sep 17 00:00:00 2001 From: mcodescu Date: Wed, 16 Mar 2016 23:29:06 +0100 Subject: [PATCH 1/2] removed source and target from names for now --- OWL2/StaticAnalysis.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OWL2/StaticAnalysis.hs b/OWL2/StaticAnalysis.hs index 85712dd0cd..10fb9d77af 100644 --- a/OWL2/StaticAnalysis.hs +++ b/OWL2/StaticAnalysis.hs @@ -438,8 +438,8 @@ corr2theo aname ssig tsig l1 l2 eMap1 eMap2 rref = do case (match1, match2) of ([e1], [e2]) -> do - let e1' = e1 {cutIRI = addString (cutIRI e1, "_source")} - e2' = e2 {cutIRI = addString (cutIRI e2, "_target")} + let e1' = e1 -- {cutIRI = addString (cutIRI e1, "_source")} + e2' = e2 -- {cutIRI = addString (cutIRI e2, "_target")} sig = emptySign eMap1' = Map.union eMap1 $ Map.fromAscList [(e1', e1)] eMap2' = Map.union eMap2 $ Map.fromAscList [(e2', e2)] From 36780327ef7de799210a7fdcfdb666a4cf3ce648 Mon Sep 17 00:00:00 2001 From: mcodescu Date: Thu, 17 Mar 2016 00:10:10 +0100 Subject: [PATCH 2/2] added a flag to decide whether to add _source and _target or not --- Logic/Logic.hs | 3 ++- OWL2/StaticAnalysis.hs | 8 ++++---- Static/AnalysisLibrary.hs | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Logic/Logic.hs b/Logic/Logic.hs index 9c3d5ac2a8..459e9dc818 100644 --- a/Logic/Logic.hs +++ b/Logic/Logic.hs @@ -601,7 +601,8 @@ class ( Syntax lid basic_spec symbol symb_items symb_map_items theory_to_taxonomy l _ _ _ _ = statFail l "theory_to_taxonomy" -- | create a theory from a correspondence corresp2th :: lid - -> String + -> String -- the name of the alignment + -> Bool -- flag: should we disambiguate in the bridge -> sign -> sign -> [symb_items] diff --git a/OWL2/StaticAnalysis.hs b/OWL2/StaticAnalysis.hs index 10fb9d77af..89987d13d1 100644 --- a/OWL2/StaticAnalysis.hs +++ b/OWL2/StaticAnalysis.hs @@ -424,11 +424,11 @@ addEquiv ssig tsig l1 l2 = do _ -> fail $ "non-unique symbol match:" ++ show l1 ++ " " ++ show l2 _ -> fail "terms not yet supported in alignments" -corr2theo :: String -> Sign -> Sign -> [SymbItems] -> [SymbItems] -> +corr2theo :: String -> Bool -> Sign -> Sign -> [SymbItems] -> [SymbItems] -> EndoMap Entity -> EndoMap Entity -> REL_REF -> Result (Sign, [Named Axiom], Sign, Sign, EndoMap Entity, EndoMap Entity) -corr2theo aname ssig tsig l1 l2 eMap1 eMap2 rref = do +corr2theo aname flag ssig tsig l1 l2 eMap1 eMap2 rref = do let l1' = statSymbItems ssig l1 l2' = statSymbItems tsig l2 case (l1', l2') of @@ -438,8 +438,8 @@ corr2theo aname ssig tsig l1 l2 eMap1 eMap2 rref = do case (match1, match2) of ([e1], [e2]) -> do - let e1' = e1 -- {cutIRI = addString (cutIRI e1, "_source")} - e2' = e2 -- {cutIRI = addString (cutIRI e2, "_target")} + let e1' = if flag then e1 {cutIRI = addString (cutIRI e1, "_source")} else e1 + e2' = if flag then e2 {cutIRI = addString (cutIRI e2, "_target")} else e2 sig = emptySign eMap1' = Map.union eMap1 $ Map.fromAscList [(e1', e1)] eMap2' = Map.union eMap2 $ Map.fromAscList [(e2', e2)] diff --git a/Static/AnalysisLibrary.hs b/Static/AnalysisLibrary.hs index 77ec967fb0..422e194287 100644 --- a/Static/AnalysisLibrary.hs +++ b/Static/AnalysisLibrary.hs @@ -790,12 +790,25 @@ generateWAlign an -- the signatures s1'' and s2'' of the involved symbols -- together with the maps (aname:e1 -> e1) and (aname:e2 -> e2) -- This is done by corresp2th, in a logic dependent way. + -- first we check if we must disambiguate names in the bridge ontology + let flag = let insNames aSet aLid aSItems = foldl (\s n -> Set.insert n s) aSet $ + map (symb_items_name aLid) aSItems + (syms1, syms2) = + foldl (\ (set1, set2) c -> case c of + Single_correspondence _ (G_symb_items_list lidS1 sitems1) + (G_symb_items_list lidS2 sitems2) _ _ -> + (insNames set1 lidS1 sitems1, + insNames set2 lidS2 sitems2) + _ -> error "only single corrs") + (Set.empty, Set.empty) corrs + in not $ Set.null $ Set.intersection syms1 syms2 + -- then we set a flag in addCorresp to True if disambiguation is needed let addCorresp (s1, s2, s, sens, p1, p2) (G_symb_items_list lids1 l1, G_symb_items_list lids2 l2, rrel) = do l1' <- coerceSymbItemsList lids1 lid1 "coerceSymbItemsList" l1 l2' <- coerceSymbItemsList lids2 lid1 "coerceSymbItemsList" l2 (sigb, senb, s1', s2', eMap1, eMap2) <- - corresp2th lid1 (iriToStringUnsecure an) + corresp2th lid1 (iriToStringUnsecure an) flag ssig tsig' l1' l2' p1 p2 rrel s1'' <- signature_union lid1 s1 s1'