Hash :
3591fad0
Author :
Thomas de Grivel
Date :
2024-10-09T14:43:21
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
defmodule Fx do
def db = Facts.database()
Facts.open(db, "db/fx.facts")
def property_index = fn (path) {
if Str.starts_with?(path, "./") do
path = Str.slice(path, 2, -1)
end
Facts.collect_with_tags(db, path, p = ?, o = ?, fn (fact) {
{p, o}
})
}
def property_add = fn (path, property, value) {
Facts.add_tags(db, path, property, value)
}
def property_remove = fn (path, property, value) {
Facts.remove_tags(db, path, property, value)
}
def tag_index = fn (path) {
Facts.collect_with_tags(db, path, :tag, tag = ?, fn (fact) {
tag
})
}
def tag_add = fn (path, tag) {
Facts.add_tags(db, path, :tag, tag)
}
def tag_remove = fn (path, tag) {
Facts.remove_tags(db, path, :tag, tag)
}
end