Skip to content

Commit 9d9bcf0

Browse files
committed
MakeURNPrefix also needed the fix for the unique org URN
1 parent adef72e commit 9d9bcf0

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

internal/graph/urn.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,14 @@ func MakeURNPrefix(v1 *viper.Viper, prefix string) (string, error) {
4646
err error
4747
)
4848

49-
check := prefixTransform(prefix)
50-
ps := strings.Split(check, "/")
49+
if prefix == "orgs" {
50+
g = fmt.Sprintf("urn:gleaner.io:%s:orgs", gcfg.Orgname)
5151

52-
g = fmt.Sprintf("urn:gleaner.io:%s:%s:%s", gcfg.Orgname, ps[len(ps)-1], ps[len(ps)-2])
52+
} else {
53+
check := prefixTransform(prefix)
54+
ps := strings.Split(check, "/")
55+
g = fmt.Sprintf("urn:gleaner.io:%s:%s:%s", gcfg.Orgname, ps[len(ps)-1], ps[len(ps)-2])
56+
}
5357

5458
//fmt.Printf("=Prefix===========> %s \n\n", g)
5559

scripts/simpletest/orgtest.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
NABU='go run ../../cmd/nabu/main.go'
4+
CFG='../../xxx/iow/iow_dev_v4.yaml'
5+
BLAZE='http://coreos.lan:9090/blazegraph/namespace/iow/sparql'
6+
GRAPHDB='http://coreos.lan:7200/repositories/testing'
7+
8+
echo "------- BLAZEGRAPH PROV"
9+
echo "---------- clear, bulk, prune "
10+
time {
11+
${NABU} clear --cfg ${CFG} --dangerous --endpoint ec_blazegraph
12+
${NABU} bulk --cfg ${CFG} --prefix orgs --endpoint ec_blazegraph
13+
${NABU} prune --cfg ${CFG} --prefix orgs --endpoint ec_blazegraph
14+
}
15+
16+
curl -H 'Accept: application/sparql-results+json' ${BLAZE} --data-urlencode 'query=SELECT (COUNT(DISTINCT ?graph) AS ?namedGraphsCount)(COUNT(*) AS ?triplesCount)WHERE {GRAPH ?graph {?subject ?predicate ?object}}' | jq '.results.bindings[0] | { namedGraphsCount: .namedGraphsCount.value, triplesCount: .triplesCount.value }' input.json -
17+
18+
19+
echo "---------- clear, release, object, prune "
20+
time {
21+
${NABU} clear --cfg ${CFG} --dangerous --endpoint ec_blazegraph
22+
${NABU} release --cfg ${CFG} --prefix orgs --endpoint ec_blazegraph
23+
${NABU} object --cfg ${CFG} graphs/latest/organizations.nq --endpoint ec_blazegraph
24+
${NABU} prune --cfg ${CFG} --prefix orgs --endpoint ec_blazegraph
25+
}
26+
27+
curl -H 'Accept: application/sparql-results+json' ${BLAZE} --data-urlencode 'query=SELECT (COUNT(DISTINCT ?graph) AS ?namedGraphsCount)(COUNT(*) AS ?triplesCount)WHERE {GRAPH ?graph {?subject ?predicate ?object}}' | jq '.results.bindings[0] | { namedGraphsCount: .namedGraphsCount.value, triplesCount: .triplesCount.value }' input.json -
28+
29+
30+
echo "---------- clear, prefix, prune "
31+
time {
32+
${NABU} clear --cfg ${CFG} --dangerous --endpoint ec_blazegraph
33+
${NABU} prefix --cfg ${CFG} --prefix orgs --endpoint ec_blazegraph
34+
${NABU} prune --cfg ${CFG} --prefix orgs --endpoint ec_blazegraph
35+
}
36+
37+
curl -H 'Accept: application/sparql-results+json' ${BLAZE} --data-urlencode 'query=SELECT (COUNT(DISTINCT ?graph) AS ?namedGraphsCount)(COUNT(*) AS ?triplesCount)WHERE {GRAPH ?graph {?subject ?predicate ?object}}' | jq '.results.bindings[0] | { namedGraphsCount: .namedGraphsCount.value, triplesCount: .triplesCount.value }' input.json -
38+
39+
40+

0 commit comments

Comments
 (0)