Skip to content

Commit

Permalink
Updates default project to include new mu.semte.ch additions
Browse files Browse the repository at this point in the history
  • Loading branch information
langens-jonathan committed Jul 19, 2020
1 parent 9257866 commit 3dd3c63
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 90 deletions.
29 changes: 6 additions & 23 deletions config/dispatcher/dispatcher.ex
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
defmodule Dispatcher do
use Plug.Router
use Matcher
define_accept_types [
json: [ "application/json", "application/vnd.api+json" ]
]

def start(_argv) do
port = 80
IO.puts "Starting Plug with Cowboy on port #{port}"
Plug.Adapters.Cowboy.http __MODULE__, [], port: port
:timer.sleep(:infinity)
end

plug Plug.Logger
plug :match
plug :dispatch
@json %{ accept: %{ json: true } }

# In order to forward the 'themes' resource to the
# resource service, use the following forward rule.
#
# docker-compose stop; docker-compose rm; docker-compose up
# after altering this file.
#
# match "/themes/*path" do
# Proxy.forward conn, path, "http://resource/themes/"
# end

match _ do
match "/*_", %{ last_call: true } do
send_resp( conn, 404, "Route not found. See config/dispatcher.ex" )
end

end
7 changes: 7 additions & 0 deletions config/resources/domain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": "0.1",
"prefixes": {
},
"resources": {
}
}
67 changes: 2 additions & 65 deletions config/resources/domain.lisp
Original file line number Diff line number Diff line change
@@ -1,67 +1,4 @@
(in-package :mu-cl-resources)

;;;;
;; NOTE
;; docker-compose stop; docker-compose rm; docker-compose up
;; after altering this file.

;; Describe your resources here

;; The general structure could be described like this:
;;
;; (define-resource <name-used-in-this-file> ()
;; :class <class-of-resource-in-triplestore>
;; :properties `((<json-property-name-one> <type-one> ,<triplestore-relation-one>)
;; (<json-property-name-two> <type-two> ,<triplestore-relation-two>>))
;; :has-many `((<name-of-an-object> :via ,<triplestore-relation-to-objects>
;; :as "<json-relation-property>")
;; (<name-of-an-object> :via ,<triplestore-relation-from-objects>
;; :inverse t ; follow relation in other direction
;; :as "<json-relation-property>"))
;; :has-one `((<name-of-an-object :via ,<triplestore-relation-to-object>
;; :as "<json-relation-property>")
;; (<name-of-an-object :via ,<triplestore-relation-from-object>
;; :as "<json-relation-property>"))
;; :resource-base (s-url "<string-to-which-uuid-will-be-appended-for-uri-of-new-items-in-triplestore>")
;; :on-path "<url-path-on-which-this-resource-is-available>")


;; An example setup with a catalog, dataset, themes would be:
;;
;; (define-resource catalog ()
;; :class (s-prefix "dcat:Catalog")
;; :properties `((:title :string ,(s-prefix "dct:title")))
;; :has-many `((dataset :via ,(s-prefix "dcat:dataset")
;; :as "datasets"))
;; :resource-base (s-url "http://webcat.tmp.semte.ch/catalogs/")
;; :on-path "catalogs")

;; (define-resource dataset ()
;; :class (s-prefix "dcat:Dataset")
;; :properties `((:title :string ,(s-prefix "dct:title"))
;; (:description :string ,(s-prefix "dct:description")))
;; :has-one `((catalog :via ,(s-prefix "dcat:dataset")
;; :inverse t
;; :as "catalog"))
;; :has-many `((theme :via ,(s-prefix "dcat:theme")
;; :as "themes"))
;; :resource-base (s-url "http://webcat.tmp.tenforce.com/datasets/")
;; :on-path "datasets")

;; (define-resource distribution ()
;; :class (s-prefix "dcat:Distribution")
;; :properties `((:title :string ,(s-prefix "dct:title"))
;; (:access-url :url ,(s-prefix "dcat:accessURL")))
;; :resource-base (s-url "http://webcat.tmp.tenforce.com/distributions/")
;; :on-path "distributions")

;; (define-resource theme ()
;; :class (s-prefix "tfdcat:Theme")
;; :properties `((:pref-label :string ,(s-prefix "skos:prefLabel")))
;; :has-many `((dataset :via ,(s-prefix "dcat:theme")
;; :inverse t
;; :as "datasets"))
;; :resource-base (s-url "http://webcat.tmp.tenforce.com/themes/")
;; :on-path "themes")

;;
;; reading in the domain.json
(read-domain-file "domain.json")
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ version: '3.4'

services:
identifier:
image: semtech/mu-identifier:1.8.1
image: semtech/mu-identifier:1.9.0
links:
- dispatcher:dispatcher
ports:
- "80:80"
dispatcher:
image: semtech/mu-dispatcher:1.1.2
image: semtech/mu-dispatcher:2.0.0
links:
- resource:resource
volumes:
Expand Down

0 comments on commit 3dd3c63

Please sign in to comment.