Skip to content

Commit

Permalink
Merge pull request #2 from earthcube/master
Browse files Browse the repository at this point in the history
Cruft removal
  • Loading branch information
fils authored Oct 13, 2021
2 parents 9ae6e06 + e6ac5b0 commit 43c0374
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 78 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release_nabu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release Nabu binaries

on:
release:
types: [created]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/amd64
# goos: [linux, windows, darwin]
# goarch: [amd64,arm]
goos: [linux]
goarch: [amd64]
exclude:
- goarch: "386"
goos: darwin
steps:
- uses: actions/checkout@v2
# - name: Run tests
# run: go test -v -p=1 -timeout=0 ./...
- uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "./cmd/nabu"
binary_name: "nabu"
ldflags: "-s -w"
extra_files: README.md
# extra_files: LICENSE README.md
21 changes: 1 addition & 20 deletions cmd/nabu/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ func main() {
case "prefix":
fmt.Println("Load graphs from prefix to triplestore")
err = flows.ObjectAssembly(v1, mc)
<<<<<<< HEAD
=======

if err != nil {
log.Println(err)
}
Expand All @@ -95,14 +94,7 @@ func main() {
case "tika":
fmt.Println("Tika extract text from objects")
err = tika.SingleBuild(v1, mc)
>>>>>>> multiprefix
if err != nil {
log.Println(err)
}

case "prune":
fmt.Println("Prune graphs in triplestore not in object store")
err = prune.Snip(v1, mc)
if err != nil {
log.Println(err)
}
Expand All @@ -116,25 +108,14 @@ func main() {
}
log.Println(string(s))

<<<<<<< HEAD
case "tika":
fmt.Println("Tika extract text from objects")
err = tika.SingleBuild(v1, mc)
if err != nil {
log.Println(err)
}

case "txtai":
fmt.Println("Index descriptions to txtai")
err = semsearch.ObjectAssembly(v1, mc)
if err != nil {
log.Println(err)
}

}
=======
}
>>>>>>> multiprefix

}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/gosuri/uiprogress v0.0.1
github.com/knakk/rdf v0.0.0-20190304171630-8521bf4c5042
github.com/minio/minio-go v6.0.14+incompatible
github.com/minio/minio-go/v7 v7.0.10 // indirect
github.com/minio/minio-go/v7 v7.0.10
github.com/neuml/txtai.go v1.0.0
github.com/piprate/json-gold v0.3.0
github.com/schollz/progressbar v1.0.0
Expand Down
53 changes: 1 addition & 52 deletions internal/prune/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

//Snip removes graphs in TS not in object store
func Snip(v1 *viper.Viper, mc *minio.Client) error {
<<<<<<< HEAD

var pa []string
err := v1.UnmarshalKey("objects.prefix", &pa)
Expand Down Expand Up @@ -111,54 +110,7 @@ func graphList(v1 *viper.Viper, mc *minio.Client, prefix string) ([]string, erro
log.Println("response Status:", resp.Status)
log.Println("response Headers:", resp.Header)
log.Println("response Body:", string(body))
=======

var pa []string
err := v1.UnmarshalKey("objects.prefix", &pa)
if err != nil {
log.Println(err)
}

fmt.Println(pa)

for p := range pa {

// do the object assembly
oa, err := ObjectList(v1, mc, pa[p])
if err != nil {
log.Println(err)
return err
}

// collect all the graphs from triple store
ga, err := graphList(v1, mc, pa[p])
if err != nil {
log.Println(err)
return err
}

objs := v1.GetStringMapString("objects")
// convert the object names to the URN pattern used in the graph
for x := range oa {
s := strings.TrimSuffix(oa[x], ".rdf")
s2 := strings.Replace(s, "/", ":", -1)
g := fmt.Sprintf("urn:%s:%s", objs["bucket"], s2)
oa[x] = g
}

//compare lists.. anything IN graph not in objects list should be removed
d := difference(ga, oa) // return array of items in ga that are NOT in oa

fmt.Printf("Graph items: %d Object items: %d difference: %d\n", len(ga), len(oa), len(d))

// For each in d will delete that graph
bar := progressbar.Default(int64(len(d)))
for x := range d {
log.Printf("Remove graph: %s\n", d[x])
flows.Drop(v1, d[x])
bar.Add(1)
}
>>>>>>> multiprefix
}

//fmt.Println("response Body:", string(body))
Expand All @@ -174,11 +126,8 @@ func graphList(v1 *viper.Viper, mc *minio.Client, prefix string) ([]string, erro
return ga, nil
}

<<<<<<< HEAD
func graphListStatements(v1 *viper.Viper, mc *minio.Client, prefix string) ([]string, error) {
=======
func graphList(v1 *viper.Viper, mc *minio.Client, prefix string) ([]string, error) {
>>>>>>> multiprefix

ga := []string{}

spql := v1.GetStringMapString("sparql")
Expand Down
7 changes: 2 additions & 5 deletions internal/triplestore/loadGraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package triplestore

import (
"fmt"
"strings"

"github.com/UFOKN/nabu/internal/graph"
"github.com/UFOKN/nabu/internal/objects"

"github.com/gosuri/uiprogress"
"github.com/minio/minio-go/v7"
)
Expand Down Expand Up @@ -51,17 +51,14 @@ func DEPRECATEDLoadGraph(mc *minio.Client, srcbckt string, sue string) error {
}
// fmt.Println(nq)

<<<<<<< HEAD:internal/triplestore/loadGraph.go
// BUG FIX HACK
// I typo-ed schema.org/AdditonalType as schema.org/AdditionType
// here I could do a simple find and replace to resolve that. Then remove
// later when I hide my shame (it's been fixed in VaultWalker FYI)
nqhacked := strings.ReplaceAll(nq, "additionType", "additionalType")

_, err = BlazeUpdateNQ([]byte(nqhacked), sue) // TODO add the above graph string to target a database on jena
=======
_, err = triplestore.BlazeUpdateNQ([]byte(nq), sue) // TODO add the above graph string to target a database on jena
>>>>>>> multiprefix:internal/flows/loadGraph.go

// _, err = triplestore.JenaUpdateNQ([]byte(nqhacked), sue) // TODO add the above graph string to target a database on jena

if err != nil {
Expand Down

0 comments on commit 43c0374

Please sign in to comment.