Skip to content

Commit

Permalink
Moved blaze source code to cirss/blaze repo and reorganized.
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy McPhillips committed Mar 16, 2021
1 parent 39ba907 commit 0fcde9c
Show file tree
Hide file tree
Showing 105 changed files with 398 additions and 5,303 deletions.
2 changes: 2 additions & 0 deletions .gopath/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg
bin
7 changes: 4 additions & 3 deletions .repro/000_Makefile.repro
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ REPRO_IMAGE=${REPRO_DOCKER_ORG}/${REPRO_NAME}:${REPRO_IMAGE_TAG}
# provide runtime options for Docker when running this REPRO
REPRO_DOCKER_OPTIONS=-p 9999:9999
REPRO_MOUNT_CLI=--volume $(CURDIR)/../go-cli:/mnt/go-cli
REPRO_MOUNT_OTHER_VOLUMES=$(REPRO_MOUNT_CLI)
REPRO_MOUNT_BLAZE=--volume $(CURDIR)/../blaze:/mnt/blaze
REPRO_MOUNT_OTHER_VOLUMES=$(REPRO_MOUNT_CLI) $(REPRO_MOUNT_BLAZE)

# define mount point for REPRO directory tree in running container
REPRO_DIR=/mnt/${REPRO_NAME}

# identify important REPRO subdirectories
REPRO_EXAMPLES_DIR=examples
REPRO_CODE_DIR=go
REPRO_SERVICE_DIR=service

# define command for running the REPRO Docker image
REPRO_RUN_COMMAND=docker run -it --rm $(REPRO_DOCKER_OPTIONS) \
Expand All @@ -27,7 +28,7 @@ REPRO_RUN_COMMAND=docker run -it --rm $(REPRO_DOCKER_OPTIONS) \
ifdef IN_RUNNING_REPRO
RUN_IN_REPRO=bash -ic
else
RUN_IN_REPRO=$(REPRO_RUN_COMMAND) bash -ic
RUN_IN_REPRO=$(REPRO_RUN_COMMAND) bash -icl
endif

# detect if running in a Windows environment
Expand Down
4 changes: 2 additions & 2 deletions .repro/020_Makefile.examples
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## run-examples: Run all of the examples.
run-examples:
$(RUN_IN_REPRO) 'make -C go install && \
blaze status --timeout 5000 --quiet && \
$(RUN_IN_REPRO) 'make -C ${REPRO_DIR} -f Makefile-go install && \
geist status --timeout 5000 --quiet && \
make -C examples all'

clean-examples: ## Delete all products of examples.
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions .repro/050_Makefile.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##
## # Targets for running the service provided by this REPRO locally
##

# Define target aliases available only outside a running REPRO
ifndef IN_RUNNING_REPRO

start-service: ## Run the service provided by this REPRO locally
$(RUN_IN_REPRO) 'make -C ${REPRO_SERVICE_DIR} run'

else

start-service:
@echo
@echo "Error: The start-service target is not available in a running REPRO."
@echo

endif
18 changes: 9 additions & 9 deletions .repro/070_Makefile.code
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
##
## # Targets for building, testing, and install custom code in this REPRO.
## # Targets for building and testing custom code in this REPRO.
##

clean-code: ## Delete artifacts from previous builds.
$(RUN_IN_REPRO) 'make -C ${REPRO_CODE_DIR} clean'
$(RUN_IN_REPRO) 'make -C ${REPRO_DIR} -f Makefile-go clean'

build-code: ## Build custom code.
$(RUN_IN_REPRO) 'make -C ${REPRO_CODE_DIR} build'
$(RUN_IN_REPRO) 'make -C ${REPRO_DIR} -f Makefile-go build'

test-code: ## Run tests on custom code.
$(RUN_IN_REPRO) 'make -C ${REPRO_CODE_DIR} test'
$(RUN_IN_REPRO) 'make -C ${REPRO_DIR} -f Makefile-go test'

install-code: ## Install custom code.
$(RUN_IN_REPRO) 'make -C ${REPRO_CODE_DIR} install'
install-code: ## Install built artifacts in REPRO.
$(RUN_IN_REPRO) 'make -C ${REPRO_DIR} -f Makefile-go install'

package-code: ## Package custom artifacts for distribution.
$(RUN_IN_REPRO) 'make -C ${REPRO_CODE_DIR} package'
package-code: # Package custom artifacts for distribution.
$(RUN_IN_REPRO) 'make -C ${REPRO_DIR} -f Makefile-go package'
15 changes: 10 additions & 5 deletions .repro/090_Makefile.aliases
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
##

# Define target aliases available both inside and outside a running REPRO
examples: run-examples ## Run all of the examples

examples: run-examples ## Run all of the examples.
##
clean: clean-code ## Delete artifacts from previous builds.
build: build-code ## Build all of the custom code.
test: test-code ## Run all of the tests on custom code.
install: install-code ## Install built artifacts in REPRO.
package: package-code ## Package custom artifacts for distribution.

##
serve: start-service ## Run the service provided by this REPRO locally.

# Define target aliases available only outside a running REPRO
ifndef IN_RUNNING_REPRO
start: start-image ## Start a container using this REPRO's Docker image.
image: build-image ## Build the Docker image used to run this REPRO.
endif

image: build-image ## Build the Docker image used to run this REPRO.
start: start-image ## Start a new container using the REPRO Docker image.

endif
##
8 changes: 2 additions & 6 deletions .repro/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ RUN echo '***** Install packages required for creating this image *****' \
&& echo '***** Install command-line utility packages *****' \
&& apt -y install sudo man less file tree jq graphviz libxml2-utils

RUN echo '***** Install python3 and required pip packages *****' \
&& apt -y install python3 python3-pip \
&& pip3 install -U pip \
&& pip3 install pandas

ENV GO_VERSION 1.16
ENV GO_DOWNLOADS_URL https://dl.google.com/go
ENV GO_ARCHIVE go${GO_VERSION}.linux-amd64.tar.gz
Expand Down Expand Up @@ -76,7 +71,8 @@ ENV BLAZEGRAPH_CMD "java ${BLAZEGRAPH_OPTIONS} -jar ${BLAZEGRAPH_JAR}"
ENV BLAZEGRAPH_LOG ${BLAZEGRAPH_DOT_DIR}/blazegraph_`date +%s`.log

RUN echo '***** Start Blazegraph at login *****' \
&& echo "cd ${BLAZEGRAPH_DOT_DIR} && ${BLAZEGRAPH_CMD} 2>&1 > ${BLAZEGRAPH_LOG} &" >> ${BASHRC}
&& echo "source .bashrc" >> .bash_profile \
&& echo "cd ${BLAZEGRAPH_DOT_DIR} && ${BLAZEGRAPH_CMD} 2>&1 > ${BLAZEGRAPH_LOG} &" >> .bash_profile

ENV GOPATH ${REPRO_MNT}/.gopath

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ default_target: help
include .repro/000_Makefile.repro
include .repro/010_Makefile.help
include .repro/020_Makefile.examples
include .repro/060_Makefile.services
include .repro/040_Makefile.data
include .repro/050_Makefile.service
include .repro/070_Makefile.code
include .repro/080_Makefile.image
include .repro/090_Makefile.aliases
13 changes: 8 additions & 5 deletions go/common/Makefile → Makefile-go
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
all: build test install

clean:
go clean ./...

build:
go build ./...
Expand All @@ -11,5 +7,12 @@ build:
test:
go test ./... -count 1 -p 1

install:
clean:
go clean ./...
chmod -R +w ${GOPATH}
rm -rf ${GOPATH}/*

package: install

install: # Install custom code.
go install ./...
4 changes: 2 additions & 2 deletions go/blaze/cmd/blaze/blaze_main.go → cmd/geist/geist_main.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package main
import (
"os"

"github.com/cirss/geist/go/blaze"
"github.com/cirss/blaze/pkg/blaze"
"github.com/cirss/go-cli/pkg/cli"
)

var Main *cli.ProgramContext

func init() {
Main = cli.NewProgramContext("blaze", main)
Main = cli.NewProgramContext("geist", main)
}

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
run_query='../common/run_query.sh'
data_file='../data/address-book.jsonld'

blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet

bash ${run_query} ${data_file} Q1 "List all triples in blazegraph." << END_QUERY
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
Expand Down
32 changes: 16 additions & 16 deletions examples/02-blazegraph-examples/01-import/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ RUNNER='../../common/run_script_example.sh'

bash ${RUNNER} SETUP "INITIALIZE BLAZEGRAPH INSTANCE" << END_SCRIPT
blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet
END_SCRIPT

# *****************************************************************************

bash ${RUNNER} S1 "IMPORT TWO TRIPLES AS N-TRIPLES" << END_SCRIPT
blaze import --format nt | sort << END_DATA
geist import --format nt | sort << END_DATA
<http://tmcphill.net/data#y> <http://tmcphill.net/tags#tag> "eight" .
<http://tmcphill.net/data#x> <http://tmcphill.net/tags#tag> "seven" .
END_DATA
blaze export --format nt --sort=true
geist export --format nt --sort=true
END_SCRIPT

# *****************************************************************************

bash ${RUNNER} S2 "IMPORT TWO TRIPLES AS TURTLE" << END_SCRIPT
blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet
blaze import --format ttl << END_DATA
geist import --format ttl << END_DATA
@prefix data: <http://tmcphill.net/data#> .
@prefix tags: <http://tmcphill.net/tags#> .
Expand All @@ -43,18 +43,18 @@ blaze import --format ttl << END_DATA
END_DATA
blaze export --format nt --sort=true
geist export --format nt --sort=true
END_SCRIPT

# *****************************************************************************

bash ${RUNNER} S3 "IMPORT TWO TRIPLES AS JSON-LD" << END_SCRIPT
blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet
blaze import --format jsonld << END_DATA
geist import --format jsonld << END_DATA
[
{
Expand All @@ -69,18 +69,18 @@ blaze import --format jsonld << END_DATA
END_DATA
blaze export --format nt --sort=true
geist export --format nt --sort=true
END_SCRIPT

# *****************************************************************************

bash ${RUNNER} S4 "IMPORT TWO TRIPLES AS RDF-XML" << END_SCRIPT
blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet
blaze import --format xml << END_DATA
geist import --format xml << END_DATA
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
Expand All @@ -96,6 +96,6 @@ blaze import --format xml << END_DATA
END_DATA
blaze export --format nt --sort=true
geist export --format nt --sort=true
END_SCRIPT
32 changes: 16 additions & 16 deletions examples/02-blazegraph-examples/01-import/run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

# INITIALIZE BLAZEGRAPH INSTANCE

blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet

------------------------------------------- SETUP OUTPUTS ------------------------------------------------

Expand All @@ -14,14 +14,14 @@ blaze create --dataset kb --quiet

# IMPORT TWO TRIPLES AS N-TRIPLES

blaze import --format nt | sort << END_DATA
geist import --format nt | sort << END_DATA

<http://tmcphill.net/data#y> <http://tmcphill.net/tags#tag> "eight" .
<http://tmcphill.net/data#x> <http://tmcphill.net/tags#tag> "seven" .

END_DATA

blaze export --format nt --sort=true
geist export --format nt --sort=true

------------------------------------------- S1 OUTPUTS ------------------------------------------------

Expand All @@ -35,10 +35,10 @@ blaze export --format nt --sort=true

# IMPORT TWO TRIPLES AS TURTLE

blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet

blaze import --format ttl << END_DATA
geist import --format ttl << END_DATA

@prefix data: <http://tmcphill.net/data#> .
@prefix tags: <http://tmcphill.net/tags#> .
Expand All @@ -48,7 +48,7 @@ blaze import --format ttl << END_DATA

END_DATA

blaze export --format nt --sort=true
geist export --format nt --sort=true

------------------------------------------- S2 OUTPUTS ------------------------------------------------

Expand All @@ -60,10 +60,10 @@ blaze export --format nt --sort=true

# IMPORT TWO TRIPLES AS JSON-LD

blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet

blaze import --format jsonld << END_DATA
geist import --format jsonld << END_DATA

[
{
Expand All @@ -78,7 +78,7 @@ blaze import --format jsonld << END_DATA

END_DATA

blaze export --format nt --sort=true
geist export --format nt --sort=true

------------------------------------------- S3 OUTPUTS ------------------------------------------------

Expand All @@ -90,10 +90,10 @@ blaze export --format nt --sort=true

# IMPORT TWO TRIPLES AS RDF-XML

blaze destroy --dataset kb --quiet
blaze create --dataset kb --quiet
geist destroy --dataset kb --quiet
geist create --dataset kb --quiet

blaze import --format xml << END_DATA
geist import --format xml << END_DATA

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

Expand All @@ -109,7 +109,7 @@ blaze import --format xml << END_DATA

END_DATA

blaze export --format nt --sort=true
geist export --format nt --sort=true

------------------------------------------- S4 OUTPUTS ------------------------------------------------

Expand Down
Loading

0 comments on commit 0fcde9c

Please sign in to comment.