Skip to content

chonla/fact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fact

Example

package main

import (
	"fact/fact"
	"fmt"
)

func main() {
	// We store fact in graph database.
	// Here we use Cayley to store them.
	f := fact.NewFact("")

	// Pass a file name to create a persistent fact
	// f := fact.NewFact("./db/knowledge.db")

	defer f.Close()

	// Declare truth
	f.Let("แมว").Has("ชื่อ", "เหมียว")
	f.Let("หมา").Has("ชื่อ", "โฮ่ง")
	f.Let("เหมียว").Has("สี", "ดำ")

	fmt.Println(f.What("แมว", "ชื่อ"))
	fmt.Println(f.WhoHas("ชื่อ", "เหมียว"))
	fmt.Println(f.WhoHas("ชื่อ", "โฮ่ง"))
	fmt.Println(f.What(f.What("แมว", "ชื่อ"), "สี"))

	// 

	// Fact supports some built-in truths.
	// Finding time
	fmt.Println(f.What("เวลา"))
}

About

Fact is knowledge database written in go. Fact wraps Cayley for more readable.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages