Tie Triple Browser (GUI)
A complete triple-store browser GUI built with Fyne, backed by the tie module. Search for a tag value and see every document that has it, then add new triples from a form.
ℹ️
Requires a running tie-daemon listening on
http://localhost:1161. Start one from the tie repository (go run ./cmd/tie-daemon) before running this example.Features
- Reverse query UI - Enter a tag and list every document carrying it
- Total count - Status bar shows
result.total_count(useful for pagination) - Add triples - Form to add
key | relation | valueand re-sync - Table display - Query results shown with document key and attributes
- Live refresh - Re-runs the active query after adding new data
Code
require(["v0.7", "@tie", "@strings"])
let db = tie.connect("http://localhost:1161", {
username: "defaultuser",
password: "defaultpassword"
})
// Seed sample documents (abridged)
db.add("rust-guide", "tag", "programming")
db.add("go-concurrency", "tag", "programming")
db.sync()
let tableData = [["", ""]]
let queryEntry = widget.NewEntry()
queryEntry.SetPlaceHolder("Enter tag (e.g., 'programming')")
let table = widget.NewTable("results", 20)
table.Columns(() => ["Document", "Attributes"])
table.RowCount(() => len(tableData))
table.Data((offset, limit) => {
let end = offset + limit
if (offset > len(tableData)) { return [] }
if (end > len(tableData)) { end = len(tableData) }
return tableData[offset:end]
})
let queryButton = widget.NewButton("Search", () => {
let term = queryEntry.Text
if (term == "") { window.SetStatus("Enter a tag to search for"); return }
// Reverse query with expand to pull each match's attributes
let result = db.query({terms: [term], reverse: true, expand: true})
tableData = result.rows.map(row => {
let parts = []
list(row.attributes.keys()).each(attr => {
parts.append(attr + ": " + strings.join(row.attributes.get(attr), ", "))
})
return [row.key, strings.join(parts, "; ")]
})
table.Refresh()
window.SetStatus("Found " + string(result.total_count) + " documents tagged '" + term + "'")
})
window.SetContent(container.NewBorder(
container.NewBorder(nil, nil, widget.NewLabel("Search by tag:"), queryButton, queryEntry),
nil, nil, nil,
container.NewVBox(widget.NewLabel("Results:"), table)
))The Go host builds the window with gui.NewApp("Tie Triple Browser", gui.WithTie(), gui.WithStrings()).
Running
cd examples/37-tie-gui
go run main.go