module Language.Drasil.Chunk.Concept (
ConceptChunk, dcc, dccWDS, cc, cc', ccs, cw,
ConceptInstance, cic
) where
import Language.Drasil.Classes (Idea, Definition(defn), ConceptDomain(cdom), Concept)
import Language.Drasil.Chunk.Concept.Core (ConceptChunk(ConDict), ConceptInstance(ConInst))
import Language.Drasil.Sentence (Sentence(S))
import Language.Drasil.Chunk.NamedIdea(mkIdea,nw, nc)
import Language.Drasil.NounPhrase (NP, pn)
import Language.Drasil.ShortName (shortname')
import Language.Drasil.UID (HasUID(uid))
import Control.Lens ((^.))
dcc :: String -> NP -> String -> ConceptChunk
dcc :: String -> NP -> String -> ConceptChunk
dcc String
i NP
ter String
des = IdeaDict -> Sentence -> [UID] -> ConceptChunk
ConDict (String -> NP -> Maybe String -> IdeaDict
mkIdea String
i NP
ter Maybe String
forall a. Maybe a
Nothing) (String -> Sentence
S String
des) []
dccWDS :: String -> NP -> Sentence -> ConceptChunk
dccWDS :: String -> NP -> Sentence -> ConceptChunk
dccWDS String
i NP
t Sentence
d = IdeaDict -> Sentence -> [UID] -> ConceptChunk
ConDict (String -> NP -> Maybe String -> IdeaDict
mkIdea String
i NP
t Maybe String
forall a. Maybe a
Nothing) Sentence
d []
cc :: Idea c => c -> String -> ConceptChunk
cc :: forall c. Idea c => c -> String -> ConceptChunk
cc c
n String
d = IdeaDict -> Sentence -> [UID] -> ConceptChunk
ConDict (c -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw c
n) (String -> Sentence
S String
d) []
cc' :: Idea c => c -> Sentence -> ConceptChunk
cc' :: forall c. Idea c => c -> Sentence -> ConceptChunk
cc' c
n Sentence
d = IdeaDict -> Sentence -> [UID] -> ConceptChunk
ConDict (c -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw c
n) Sentence
d []
ccs :: (Idea c, Concept d) => c -> Sentence -> [d] -> ConceptChunk
ccs :: forall c d.
(Idea c, Concept d) =>
c -> Sentence -> [d] -> ConceptChunk
ccs c
n Sentence
d [d]
l = IdeaDict -> Sentence -> [UID] -> ConceptChunk
ConDict (c -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw c
n) Sentence
d ([UID] -> ConceptChunk) -> [UID] -> ConceptChunk
forall a b. (a -> b) -> a -> b
$ (d -> UID) -> [d] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (d -> Getting UID d UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID d UID
forall c. HasUID c => Getter c UID
Getter d UID
uid) [d]
l
cw :: Concept c => c -> ConceptChunk
cw :: forall c. Concept c => c -> ConceptChunk
cw c
c = IdeaDict -> Sentence -> [UID] -> ConceptChunk
ConDict (c -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw c
c) (c
c c -> Getting Sentence c Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence c Sentence
forall c. Definition c => Lens' c Sentence
Lens' c Sentence
defn) (c -> [UID]
forall c. ConceptDomain c => c -> [UID]
cdom c
c)
cic :: Concept c => String -> Sentence -> String -> c -> ConceptInstance
cic :: forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
u Sentence
d String
sn c
dom = ConceptChunk -> String -> ShortName -> ConceptInstance
ConInst (IdeaDict -> Sentence -> [c] -> ConceptChunk
forall c d.
(Idea c, Concept d) =>
c -> Sentence -> [d] -> ConceptChunk
ccs (String -> NP -> IdeaDict
nc String
u (NP -> IdeaDict) -> NP -> IdeaDict
forall a b. (a -> b) -> a -> b
$ String -> NP
pn String
sn) Sentence
d [c
dom]) String
u (ShortName -> ConceptInstance) -> ShortName -> ConceptInstance
forall a b. (a -> b) -> a -> b
$ Sentence -> ShortName
shortname' (String -> Sentence
S String
sn)