Skip to content

Commit

Permalink
Merge pull request #1606 from spechub/1597_names_in_bridges
Browse files Browse the repository at this point in the history
1597 names in bridges
  • Loading branch information
tillmo committed Mar 17, 2016
2 parents 8774d49 + 3678032 commit 6b19c82
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Logic/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions OWL2/StaticAnalysis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)]
Expand Down
15 changes: 14 additions & 1 deletion Static/AnalysisLibrary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 6b19c82

Please sign in to comment.