selectNgramsByNodeUser cId' nt' =
runPGSQuery queryNgramsByNodeUser
( cId'
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, ngramsTypeId nt'
-- , 100 :: Int -- limit
-- , 0 :: Int -- offset
JOIN nodes_nodes nn ON nn.node2_id = nng.node2_id
JOIN nodes n ON nn.node2_id = n.id
WHERE nn.node1_id = ? -- CorpusId
- AND n.typename = ? -- hasDBid
+ AND n.typename = ? -- toDBid
AND nng.ngrams_type = ? -- NgramsTypeId
AND nn.category > 0
GROUP BY nng.node2_id, ng.terms
runPGSQuery queryNgramsOccurrencesOnlyByNodeUser
( Values fields ((DPS.Only . unNgramsTerm) <$> tms)
, cId
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, ngramsTypeId nt
)
where
JOIN nodes_nodes nn ON nn.node2_id = nng.node2_id
JOIN nodes n ON nn.node2_id = n.id
WHERE nn.node1_id = ? -- CorpusId
- AND n.typename = ? -- hasDBid
+ AND n.typename = ? -- toDBid
AND nng.ngrams_type = ? -- NgramsTypeId
AND nn.category > 0
GROUP BY nng.node2_id, ng.terms
JOIN nodes_nodes nn ON nn.node2_id = nng.node2_id
JOIN nodes n ON nn.node2_id = n.id
WHERE nn.node1_id = ? -- CorpusId
- AND n.typename = ? -- hasDBid
+ AND n.typename = ? -- toDBid
AND nng.ngrams_type = ? -- NgramsTypeId
AND nn.category > 0
GROUP BY nng.node2_id, ng.terms
, Values [QualifiedIdentifier Nothing "int4"]
(DPS.Only <$> (map (\(NodeId n) -> n) ls))
, cId
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, ngramsTypeId nt
)
where
JOIN nodes_nodes nn ON nn.node2_id = nng.node2_id
JOIN nodes n ON nn.node2_id = n.id
WHERE nn.node1_id = ? -- CorpusId
- AND n.typename = ? -- hasDBid
+ AND n.typename = ? -- toDBid
AND nng.ngrams_type = ? -- NgramsTypeId
AND nn.category > 0
GROUP BY ng.terms, nng.node2_id
, Values [QualifiedIdentifier Nothing "int4"]
(DPS.Only <$> (map (\(NodeId n) -> n) ls))
, cId
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, ngramsTypeId nt
)
where
queryNgramsByNodeMaster'
( ucId
, ngramsTypeId NgramsTerms
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, p
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, p
, n
, mcId
- , hasDBid NodeDocument
+ , toDBid NodeDocument
, ngramsTypeId NgramsTerms
)
JOIN node_node_ngrams nng ON nng.node2_id = n.id
JOIN ngrams ng ON nng.ngrams_id = ng.id
WHERE nn.node1_id = ? -- UserCorpusId
- -- AND n.typename = ? -- hasDBid
+ -- AND n.typename = ? -- toDBid
AND nng.ngrams_type = ? -- NgramsTypeId
AND nn.category > 0
AND node_pos(n.id,?) >= ?
JOIN node_node_ngrams nng ON n.id = nng.node2_id
JOIN ngrams ng ON ng.id = nng.ngrams_id
- WHERE n.parent_id = ? -- Master Corpus hasDBid
- AND n.typename = ? -- hasDBid
+ WHERE n.parent_id = ? -- Master Corpus toDBid
+ AND n.typename = ? -- toDBid
AND nng.ngrams_type = ? -- NgramsTypeId
GROUP BY n.id, ng.terms
)