Skip to content

Commit

Permalink
Version 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Girardi committed Feb 11, 2020
2 parents 3751820 + 169fbad commit d6cf989
Show file tree
Hide file tree
Showing 25 changed files with 1,133 additions and 702 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/clojure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '11.0.5'
- name: Install dependencies
run: lein deps
- name: Run tests
run: lein test
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
.idea/
target/
pom.xml
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
starfish-clj.iml
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.lein-failures
.lein-repl-history
.nrepl-port

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
/.project
/.classpath
/.settings/
/codox
/bin/
/pom.xml.asc
.cpcache/
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: clojure
lein: lein
dist: xenial
jdk:
- oraclejdk11
- openjdk11

addons:
ssh_known_hosts: shrimp.octet.services

script: lein do clean, test :integration :default
script: lein do clean, test :default

branches:
only:
- master
- develop
59 changes: 52 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# starfish-clj

[![Build Status](https://travis-ci.com/DEX-Company/starfish-clj.svg?token=g26KMSqk9yTWH8J1QLSN&branch=master)](https://travis-ci.com/DEX-Company/starfish-clj) [![Clojars Project](https://img.shields.io/clojars/v/sg.dex/starfish-clj.svg)](https://clojars.org/sg.dex/starfish-clj)
[![Actions Status](https://github.com/DEX-Company/starfish-clj/workflows/CI/badge.svg)](https://github.com/DEX-Company/starfish-clj/actions) [![Clojars Project](https://img.shields.io/clojars/v/sg.dex/starfish-clj.svg)](https://clojars.org/sg.dex/starfish-clj)

Ocean protocol developer toolkit for Clojure
Toolkit for Decentralised Data Ecosystem development in Clojure

## Table of Contents

* [Overview](#overview)
* [Installation](#installation)
* [Configuration](#configuration)
* [Documentation](#documentation)
* [Example](#example)
* [Testing](#testing)
* [License](#license)

# Overview

Starfish-clj is an open-sourced developer toolkit for the data economy. It allows developers, data scientists and enterprises to create, interact, integrate and manage a data supply line through standardised and simple-to-use APIs.
Starfish-clj is an open source developer toolkit for the data economy. It allows developers, data scientists and enterprises to create, interact, integrate and manage decentralised data supply lines through standardised and simple-to-use APIs.

Based on an underlying data ecosystem standard, Starfish provides high-level APIs for common tasks within the data economy, for example, registering/publishing an asset, for subsequent use in a data supply line. In this case, an asset can be any data set, model or data service. The high-level API also allows developers to invoke operation on an asset, e.g. computing a predictive model or anonymising sensitive personal information, among other capabilities.

Starfish works with blockchain networks, such as Ocean Protocol, and common web services through agents, allowing unprecedented flexibility in asset discovery and data supply line management.
Starfish works with blockchain networks and common web services through agents, allowing unprecedented flexibility in asset discovery and data supply line management.

# Installation

Expand All @@ -29,9 +29,54 @@ Add a dependency in your build tool for [![Clojars Project](https://img.shields.

Here's an [example of a configuration file](https://github.com/DEX-Company/starfish-clj/blob/master/src/test/resources/squid_test.properties).

# Documentation
# Example

Starfish-clj is a thin wrapper on top of Starfish-java.
Here's an example of creating and managing assets using starfish-clj
```clj
;;define a memory asset
(def as1 (memory-asset ;; type of asset to construct
{:name "My Asset"} ;; metadata
"This is a test") ;; content (as a String))
)

;; display the metadata

(s/metadata as1)
;;{:dateCreated "2019-07-24T08:02:52.738504Z", :size "14", :name "My Asset", :type "dataset", :contentType "application/octet-stream", :contentHash "93b90fab55adf4e98787d33a38e71106e8c016f1a124dfc784f3cca4d938b1af"}

;; validate the content hash
(digest "This is a test")
;;"93b90fab55adf4e98787d33a38e71106e8c016f1a124dfc784f3cca4d938b1af"

;; Print the content
(to-string (content as1))
;;"This is a test"

;; ======================================================================================
;; USING REMOTE AGENTS
;; Agents are network-connected services providing asset and capabilities to other participants in the data ecosystem
(def my-agent (let [did (random-did)
ddostring (create-ddo "http://52.187.164.74:8080/")]
(remote-agent did ddostring "Aladdin" "OpenSesame")))

;; agents have a DID
(str (did my-agent))
;;"did:op:d394d2e1a211ba61f6f7543bd36df59994a5cb99e7d863405117b4c42c5cb2e9"

;; Get an asset
(def as2 (get-asset my-agent "10bc529b730b9372689af7c8848256c75b61e1c25addc0dc100059dcceb05d03"))

;; assets also have a DID, starting with the DID of the agent
(str (did as2))
;;"did:op:d394d2e1a211ba61f6f7543bd36df59994a5cb99e7d863405117b4c42c5cb2e9/10bc529b730b9372689af7c8848256c75b61e1c25addc0dc100059dcceb05d03"

;; print the content of asset data, which happens to be JSON
(json/read-str (s/to-string (content as2)))
;;{"age_derived" "12", "ownerManual" "", "age_score" "2"}

TBD

```

# Testing

Expand Down
154 changes: 0 additions & 154 deletions pom.xml

This file was deleted.

42 changes: 23 additions & 19 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
(defproject sg.dex/starfish-clj "0.5.2-SNAPSHOT"
(defproject sg.dex/starfish-clj "0.8.0"
:url "https://github.com/DEX-Company/starfish-clj"
:dependencies [
[sg.dex/starfish-java "0.6.0"]
[org.slf4j/jcl-over-slf4j "1.8.0-alpha2"]
[org.clojure/data.json "0.2.6"]
:dependencies [[sg.dex/starfish-java "0.8.1"]
[org.clojure/data.json "0.2.7"]
[org.clojure/data.csv "0.1.4"]
[clojurewerkz/propertied "1.3.0"]
[org.clojure/data.csv "0.1.4"]]
:exclusions [commons-logging/commons-logging]
:managed-dependencies [[com.fasterxml.jackson.core/jackson-databind "2.9.8"]]

:javac-options ["-target" "1.8", "-source" "1.8"]
;; Used to fix JCL issues with Apache HTTP logging via JCL
[org.slf4j/jcl-over-slf4j "1.7.30"]]

;; :javac-options ["-target" "8", "-source" "8"] ; TODO figure out of this is helpful? Causes a warning
:target-path "target/%s/"
:java-source-paths ["src/main/java"]
:source-paths ["src/main/clojure"]
:test-paths ["src/test/clojure"]
:test-paths ["src/test/clojure" "src/test/java"]
:test-selectors {:default (complement :integration)
:integration :integration}
:plugins [[lein-codox "0.10.7"]]
:plugins [[lein-codox "0.10.7"]
[lein-ancient "0.6.15"]]
:codox {:output-path "codox"}
:min-lein-version "2.8.1"
:lein-release {:deploy-via :clojars}
:profiles {:dev {:dependencies [[org.clojure/clojure "1.10.0"]]

:deploy-repositories [["releases" :clojars]
["snapshots" :clojars]]

:profiles {:dev {:source-paths ["src/dev"]
:resource-paths ["src/test/resources"]
}
:test {:dependencies [[net.mikera/cljunit "0.6.0" :scope "test"]
]
:dependencies [[org.clojure/clojure "1.10.1"]
[net.mikera/cljunit "0.7.0" :scope "test"]]}

:test {:dependencies []
:java-source-paths ["src/main/java" "src/test/java"]
;; :source-paths ["src/main/clojure" "src/test/clojure"]
:resource-paths ["src/main/resources" "src/test/resources"]
}}
)
:resource-paths ["src/main/resources" "src/test/resources"]}})
19 changes: 19 additions & 0 deletions src/dev/dev.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(ns dev
(:require [starfish.core :as sf]))

(comment
(defn demo-operation1
"Demo Operation 1"
[x]
nil)

(defn demo-operation2
[asset-x]
nil)

(sf/invokable-metadata #'demo-operation1)
(sf/invokable-metadata #'demo-operation2)

(sf/metadata (sf/in-memory-operation (sf/invokable-metadata #'demo-operation1)))

)
5 changes: 5 additions & 0 deletions src/dev/user.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns user)

(defn dev []
(require 'dev)
(in-ns 'dev))

0 comments on commit d6cf989

Please sign in to comment.