Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
project-3-draft [2021/04/22 12:16]
pdmatei
project-3-draft [2021/04/25 16:07] (current)
roxana_elena.stiuca prerequisite for taskset3
Line 26: Line 26:
     | Cartesian (Row -> Row -> Row) [String] Query Query     | Cartesian (Row -> Row -> Row) [String] Query Query
     | Projection [String] Query     | Projection [String] Query
---    ​| forall a. Filter (FilterCondition a) Query +    ​| forall a. FEval a => Filter (FilterCondition a) Query 
-    | Graph EdgeOp ​query+    | Graph EdgeOp ​Query
     ​     ​
 -- where EdgeOp is defined: -- where EdgeOp is defined:
Line 34: Line 34:
 **Don'​t worry about Graph or Filter queries yet.** **Don'​t worry about Graph or Filter queries yet.**
  
- +==== Prerequisite ==== 
 +Add the following lines at the beginning of your .hs files: 
 +<code haskell>​ 
 +{-# LANGUAGE ExistentialQuantification #-} 
 +{-# LANGUAGE FlexibleInstances #-} 
 +</​code>​ 
 + 
 +The first line allows ''​forall a''​. 
 +The second allows ''​instance FEval String''​. 
 ===== Query Evaluation ===== ===== Query Evaluation =====
  
Line 159: Line 168:
 From      To      Value From      To      Value
 Mihai     ​Stefan ​ 321 Mihai     ​Stefan ​ 321
-Andrei ​   ​Ana     ​322+Ana       Andrei  ​322
 </​code>​ </​code>​
  
Line 165: Line 174:
 <code haskell> <code haskell>
 edgeop [_,x,_] [_,​y,​_] ​ edgeop [_,x,_] [_,​y,​_] ​
-   | abs $ x - y <= 1 = Just "​similar"​+   | abs $ (read :: Int) (read :: Int) <= 1 = Just "​similar"​
    | otherwise = Nothing    | otherwise = Nothing
 </​code>​ </​code>​
Line 172: Line 181:
 <​code>​ <​code>​
 From      To      Value From      To      Value
-Mihai     Andrei ​ similar+Andrei ​   ​Mihai ​  similar
 Mihai     ​Stefan ​ similar Mihai     ​Stefan ​ similar
-Mihai     Ana     ​similar +Ana       Mihai   similar 
-Andrei ​   ​Ana     ​similar +Ana       Andrei  ​similar 
-Stefan ​   ​Ana     ​similar+Ana       Stefan  ​similar
 </​code>​ </​code>​
  
  
 ==== Similarities graph, using queries ==== ==== Similarities graph, using queries ====
 +
 We want to check the similarities between students lecture points. We want to check the similarities between students lecture points.
   * For that, we want to obtain a graph where "​From"​ and "​To"​ are students'​ emails and "​Value"​ is the distance between the 2 students'​ points.   * For that, we want to obtain a graph where "​From"​ and "​To"​ are students'​ emails and "​Value"​ is the distance between the 2 students'​ points.
Line 186: Line 196:
   * The edges in the resulting graph (the rows in the resulting table) should be sorted by the "​Value"​ column. If email is missing, don't include that entry.   * The edges in the resulting graph (the rows in the resulting table) should be sorted by the "​Value"​ column. If email is missing, don't include that entry.
  
-Your task is to write ''​similarities_query''​ as a sequence of queries, that once evaluated results in the graph described above.+Your task is to write ''​similarities_query''​ as a **sequence of queries**, that once evaluated results in the graph described above
 + 
 +**Note**: ''​similarities_query''​ is a Query. The checker applies ''​eval''​ on it.
  
 ===== TL;DR Tasks ===== ===== TL;DR Tasks =====
-  - Enroll Query in class Eval (without Filter or Graph). 0.3p +  - Enroll ​''​Query'' ​in class ''​Eval'' ​(without ​''​Filter'' ​or ''​Graph''​). **0.3p** 
-  -  Enroll FilterCondition in class FEval and implement eval for Filter query. 0.2p +  - Enroll ​''​FilterCondition'' ​in class ''​FEval'' ​and implement ​''​eval'' ​for ''​Filter'' ​query. ​**0.2p** 
-  - Implement eval for Graph query. 0.2p +  - Implement ​''​eval'' ​for ''​Graph'' ​query. 0.2p 
-  - Get graph for similarities. 0.3p+  - Extract similarity ​graph. 0.3p
  
 ===== Checker ===== ===== Checker =====