-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclaim.go
60 lines (53 loc) · 1.46 KB
/
claim.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"fmt"
"time"
"github.com/google/uuid"
)
const PREMISE_RULE_NONE int = 0
const PREMISE_RULE_ALL int = 1
const PREMISE_RULE_ANY int = 2
const PREMISE_RULE_ANY_TWO int = 3
type Claim struct {
Key string `json:"_key"`
ID string `json:"id"`
CreatedAt time.Time `json:"start"`
Creator string `json:"creator"`
Title string `json:"title"`
Negation string `json:"negation"`
Question string `json:"question"`
Note string `json:"note"`
MultiPremise bool `json:"mp"`
PremiseRule int `json:"mprule"`
Truth float32 `json:"truth"`
}
func (claim Claim) ArangoID() string {
return fmt.Sprintf("claims/%s", claim.Key)
}
func NewClaim(node DebateMapNode) Claim {
return Claim{
Key: uuid.New().String(),
ID: node.ID,
CreatedAt: node.CreatedTime(),
Creator: node.Creator,
Title: node.Current.Title.Base,
Negation: node.Current.Title.Negation,
Question: node.Current.Title.Question,
Note: node.Note,
MultiPremise: node.MultiPremise,
PremiseRule: argumentTypeToPremiseRule(node.Current.ArgumentType),
Truth: 0.50,
}
}
func argumentTypeToPremiseRule(argumentType int) int {
switch argumentType {
case ARGUMENT_TYPE_ANY:
return PREMISE_RULE_ANY
case ARGUMENT_TYPE_ANY_TWO:
return PREMISE_RULE_ANY_TWO
case ARGUMENT_TYPE_ALL:
return PREMISE_RULE_ALL
default:
return PREMISE_RULE_NONE
}
}