Skip to content

A webservice to configure rdf to json conversion - uri, name, label, type, icon, weight.

License

Notifications You must be signed in to change notification settings

hbz/to.science.labels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

to.science.labels

Codacy Badge travis status

labels helps you to render URIs. URI rendering is a common use case when dealing with rdf data.

  • presentation of rdf data to end users - etikett stores labels and icon information
  • json-ld transformation from rdf database - etikett stores shortnames and types

With labels one can establish unified rdf handling to similar applications.

etikett screenshot

Requirements

Java 8

echo $JAVA_HOME //check if java 8 assigned

Typesafe Activator


cd /tmp
wget http://downloads.typesafe.com/typesafe-activator/1.3.2/typesafe-activator-1.3.2-minimal.zip
unzip typesafe-activator-1.3.2-minimal.zip
sudo mv activator-1.3.2-minimal /opt

Run

Download

cd /tmp
git clone https://github.com/hbz/to.science.labels
cd to.science.labels

Run

This will start the application in developer mode. Some test data is loaded at startup

/opt/activator-1.3.2-minimal/activator run

Go to http://localhost:9000/tools/etikett

Editing and Uploading

To edit/delete/upload data password authentification is required. Default user is admin. Default password is admin. To change the default password edit the application.conf:

etikett.admin-password="admin"

Manual Test

List all

curl "http://localhost:9000/tools/etikett" -H"accept: application/json"

Or list info for a single uri

curl "http://localhost:9000/tools/etikett?url=http%3A%2F%2Fpurl.orms%2Fissued" -H"accept: application/json"

Install on Ubuntu

cd /tmp/to.science.labels
/opt/activator-1.3.2-minimal/activator dist
cp target/universal/etikett-0.1.0-SNAPSHOT.zip  /tmp
cd /tmp
unzip etikett-0.1.0-SNAPSHOT.zip
mv etikett-0.1.0-SNAPSHOT /opt/to.science.labels

edit startscript


sudo cp /tmp/to.science.labels/install/etikett.tmpl /etc/init.d/to.science.labels
sudo chmod u+x /etc/init.d/to.science.labels
sudo editor /etc/init.d/to.science.labels

set the following vars


JAVA_HOME=/opt/java
HOME="/opt/to.science.labels"
USER="user to run etikett"
GROUP="user to run etikett"
SECRET=`uuidgen` # generate a secret e.g. using uuidgen
PORT=9002

include into system start and shutdown

sudo update-rc.d to.science.labels defaults 99 20

Create/Configure Mysql Table


mysql -u root -p
CREATE DATABASE etikett  DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'etikett'@'localhost' IDENTIFIED BY 'etikett';
GRANT ALL ON etikett.* TO 'etikett'@'localhost';

Set /opt/to.science.labels/conf/application.conf

db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/etikett?characterEncoding=UTF-8"
db.default.user=etikett
db.default.password="etikett"

To connect to a to.science.api also edit the following vars

application.toscience.url="http://localhost"
application.toscience.url.api="http://api.localhost"

start

sudo service to.science.labels start

Update

rm -rf /tmp/labels
cd /tmp
git clone https://github.com/hbz/to.science.labels labels
cd labels
rm -r conf
ln -s /etc/to.science/labels.conf  conf
/opt/activator-1.3.2-minimal/activator dist
# wenn das nicht geht, folgende Verzeichnisse entfernen:
rm $HOME/.ivy2
rm $HOME/.sbt
cp target/universal/etikett-0.1.0-SNAPSHOT.zip  /tmp
cd /tmp
unzip etikett-0.1.0-SNAPSHOT.zip
rm -r /tmp/etikett-0.1.0-SNAPSHOT/conf
ln -s /etc/to.science/labels.conf /tmp/etikett-0.1.0-SNAPSHOT/conf
sudo service labels stop
rm -rf /opt/labels/*
mv /tmp/etikett-0.1.0-SNAPSHOT/* /opt/labels/
sudo service labels start

Etikett internals

Just for documentation here is how etikett stores it's data interally as in 08.2018

Current status:

uri* label* name* icon reference_type (default is String) container comment weight type multilangLabel

'*' are mandatory, all others are optional

uri*: The rdf predicate

label: A label you might want to use for display. Labels can also be used to generate enhanced documents that provide labels for certain uris.

name*: the name of the json element. This field can also be used to introduce shortenings to a json context

icon: use this to add an icon font

reference_type: the json-ld type (default is String)

container: the json-ld container

comment: a comment you might want to add

weight: a weight you can use to display elements in the correct order

type: internal type of Etikett. Must be one of CACHE, CONTEXT, STORE

multilangLabel: of course you can specify labels in multiple languages

Example:

{
  "uri" : "http://purl.org/dc/terms/alternative",
  "comment" : "",
  "label" : "Titelzusatz",
  "icon" : "",
  "name" : "alternative",
  "referenceType" : "String",
  "container" : "@set",
  "weight" : "3",
  "type" : "CONTEXT",
  "multilangLabel" : { }
}

converts to context entry ...

alternative": {
    "@id": "http://purl.org/dc/terms/alternative",
    "@container": "@set"
}

or (annotated context)

alternative": {
    "icon": "",
    "weight": "3",
    "comment": "",
    "@id": "http://purl.org/dc/terms/alternative",
    "label": "Titelzusatz",
    "@container": "@set"
}

Etikett for displaying Json-Ld

The content of an etikett database can be used to display Json-Ld documents to the enduser. The procedure is as follows.

  1. Use the etikett database to generate an annotated Json-Ld-Context for your json documents
  2. Iterate through the Json-Ld-Context in order to display all fields in the correct order (weight). Instead of showing URIs or Json-Field-Names show the labels from the annotated context.
  3. Take the reference_type of field into account to provide proper renderings for multiple fields of fields with references to other objects (type:@id).

Etikett for Json-LD serialization

If your database uses rdf as internal storage format you can use etikett together with our JsonConverter to generate nice indexable and humanreadable Json-Ld documents. Just pass the content of your etikett database to the converter and it will look up labels for the containing uris and generate a Json-Document that is directly usable for tools like elasticsearch etc.

License

GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007

About

A webservice to configure rdf to json conversion - uri, name, label, type, icon, weight.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published