From bded8e148350e8be8a04ffcfab9a606d1b9a8288 Mon Sep 17 00:00:00 2001 From: jazzyray Date: Fri, 6 Sep 2019 11:05:42 +0100 Subject: [PATCH 1/9] Minor change to use plantuml.cfg --- bin/rdfpuml.pl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/rdfpuml.pl b/bin/rdfpuml.pl index 3b96cd0..462b90d 100644 --- a/bin/rdfpuml.pl +++ b/bin/rdfpuml.pl @@ -25,6 +25,7 @@ use lib "$FindBin::Bin/../lib"; # Curie is my own module, not yet on CPAN use RDF::Prefixes::Curie; #use Smart::Comments; +use File::Basename; my %PREFIXES = ( @@ -109,14 +110,20 @@ $parser->parse_into_model (undef, $turtle, $model); my $map = RDF::Prefixes::Curie->new ($prefixes_all); +my $dirname = dirname(__FILE__); +my $plantuml_cfg_fn = "plantuml.cfg"; +my $sep = File::Spec->catfile('', ''); +my $plantuml_cfg_path = $dirname . $sep . $plantuml_cfg_fn; + +open my $plantuml_cfg_fh, '<', $plantuml_cfg_path or die "Can't open $plantuml_cfg_path $!"; +my $plantuml_cfg = do { local $/; <$plantuml_cfg_fh> }; + myprint (<<'EOF'); @startuml -hide empty methods -hide empty attributes -hide circle -skinparam classAttributeIconSize 0 EOF +myprint ("$plantuml_cfg\n"); + stereotypes(); replace_inlines(); collect_predicate_arrows(); From 4c9c371646a77abdd961e697847243bda99f03bb Mon Sep 17 00:00:00 2001 From: jazzyray Date: Fri, 6 Sep 2019 11:12:24 +0100 Subject: [PATCH 2/9] Code formatting minor --- bin/rdfpuml.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/rdfpuml.pl b/bin/rdfpuml.pl index 462b90d..6b6ade7 100644 --- a/bin/rdfpuml.pl +++ b/bin/rdfpuml.pl @@ -113,8 +113,7 @@ my $dirname = dirname(__FILE__); my $plantuml_cfg_fn = "plantuml.cfg"; my $sep = File::Spec->catfile('', ''); -my $plantuml_cfg_path = $dirname . $sep . $plantuml_cfg_fn; - +my $plantuml_cfg_path = $dirname . $sep . $plantuml_cfg_fn; open my $plantuml_cfg_fh, '<', $plantuml_cfg_path or die "Can't open $plantuml_cfg_path $!"; my $plantuml_cfg = do { local $/; <$plantuml_cfg_fh> }; From 90d4df1b14ab44f8ffabbeaf0ab940c63efd848d Mon Sep 17 00:00:00 2001 From: jazzyray Date: Mon, 16 Sep 2019 17:14:25 +0100 Subject: [PATCH 3/9] Updated to use options for input files --- bin/rdfpuml.pl | 108 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 85 insertions(+), 23 deletions(-) diff --git a/bin/rdfpuml.pl b/bin/rdfpuml.pl index 6b6ade7..f4b8364 100644 --- a/bin/rdfpuml.pl +++ b/bin/rdfpuml.pl @@ -16,6 +16,11 @@ use strict; use Encode; +use warnings; +use autodie; +use Getopt::Long; +use Pod::Usage; +use Path::Tiny; use Carp::Always; # http://search.cpan.org/~ferreira/Carp-Always-0.13/lib/Carp/Always.pm # stronger than $Carp::Verbose = 1; use RDF::Trine; @@ -93,41 +98,97 @@ SPARQL ## $RE_SPARQL; -my $fname = shift or die "perl rdfpuml : read .ttl, write .puml\n"; -$fname =~ s{\.ttl$}{}; +my $infile = ''; +my $outfile = ''; +my $prefixfile = ''; +my $plantumlcfgfile = ''; +my $help = 0; +GetOptions('infile' => \$infile, 'outfile=s'=> \$outfile, 'prefixfile'=> \$prefixfile, 'plantumlcfgfile=s'=> \$plantumlcfgfile, 'help|?'=> \$help) or pod2usage(2); +pod2usage(1) if $help; -my $prefixes = -e "prefixes.ttl" ? slurp("prefixes.ttl") : ""; -my $file = slurp("$fname.ttl"); -my $turtle = decode_utf8 "$PREFIXES_TURTLE\n$prefixes\n$file"; -my $prefixes_all = decode_utf8 "$PREFIXES_TURTLE\n$prefixes"; -open (STDOUT, ">:encoding(UTF-8)", "$fname.puml") or die "can't create $fname.puml: $!\n"; +=head1 NAME + +RdfPuml: Converts Turtle files .ttl into plantuml .puml + +=head1 SYNOPSIS + +rdfpuml [file] [options] + +Options: + -help + -infile + -outfile + -prefixfile + -plantumlcfgfile + +=over 8 + +=item B + +Brief help message + +=item B + +Turtle file to process + +=item B + +Output to this puml file. + +=item B + +RDF prefixies to use for URI shortening + +=item B + +plantuml config to add style and layout, etc + +=back + +=head1 DESCRIPTION + +B will read the input file and translate it into puml + +=cut + +pod2usage("$0: Missing input filename.\n") unless (@ARGV); + +$infile = path( $ARGV[0] ); +myprint ("Processing file [$ARGV[0]] \n"); + +my $sep = File::Spec->catfile('', ''); +$outfile = path( $outfile || $infile->parent . $sep . $infile->basename('.ttl') . '.puml' ); +myprint ("PUML output file [$outfile] \n"); + +$prefixfile = $prefixfile || $infile->sibling('prefixes.ttl'); + +my $prefixes = $prefixfile->exists ? $prefixfile->slurp_utf8 : ""; +my $data = $infile->slurp_utf8; +my $turtle = "$PREFIXES_TURTLE\n$prefixes\n$data"; +my $prefixes_all = "$PREFIXES_TURTLE\n$prefixes"; +unless ($plantumlcfgfile) { + $plantumlcfgfile = dirname(__FILE__) . $sep . "plantuml.cfg"; +} +my $plantumlcfgfile_path = path( $plantumlcfgfile ); +my $plantuml_cfg = $plantumlcfgfile_path->exists ? $plantumlcfgfile_path->slurp_utf8 : ""; + +open (STDOUT, ">:encoding(UTF-8)", $outfile); binmode STDERR, ":encoding(UTF-8)"; -#print STDERR $turtle; die; my $store = RDF::Trine::Store::Memory->new(); -my $model = RDF::Trine::Model->new($store) or die "can't create model: $!\n"; +my $model = RDF::Trine::Model->new($store); my $parser = RDF::Trine::Parser->new('turtle'); $parser->parse_into_model (undef, $turtle, $model); my $map = RDF::Prefixes::Curie->new ($prefixes_all); -my $dirname = dirname(__FILE__); -my $plantuml_cfg_fn = "plantuml.cfg"; -my $sep = File::Spec->catfile('', ''); -my $plantuml_cfg_path = $dirname . $sep . $plantuml_cfg_fn; -open my $plantuml_cfg_fh, '<', $plantuml_cfg_path or die "Can't open $plantuml_cfg_path $!"; -my $plantuml_cfg = do { local $/; <$plantuml_cfg_fh> }; - -myprint (<<'EOF'); -@startuml -EOF - +myprint ("\@startuml\n"); myprint ("$plantuml_cfg\n"); stereotypes(); replace_inlines(); collect_predicate_arrows(); -for my $s ($model->subjects(undef,undef)) { +for my $s ( sort { RDF::Trine::Node::compare( $a, $b ) } $model->subjects(undef,undef) ) { my $s1 = puml_node($s); my $noReify = print_types ($s, $s1); # types come first print_relations ($s, $s1, $noReify); @@ -139,7 +200,7 @@ sub print_types { my ($s, $s1) = @_; - my @types = map puml_node2($_), $model->objects ($s, U("rdf:type")); + my @types = sort map puml_node2($_), $model->objects ($s, U("rdf:type")); my $noReify = grep m{puml:NoReify}, @types; my $types = join ", ", grep !m{puml:NoReify}, @types; myprint (qq{$s1 : a $types\n}) if $types; @@ -148,7 +209,8 @@ sub print_types { sub print_relations { my ($s, $s1, $noReify) = @_; - for my $o ($model->objects ($s, undef, undef, type=>'resource'), + for my $o (sort { RDF::Trine::Node::compare( $a, $b ) } + $model->objects ($s, undef, undef, type=>'resource'), $model->objects ($s, undef, undef, type=>'blank')) { # collect all relations between the two nodes. # TODO: also collect inverse relations? Then be careful for reifications! From a4efb522d91f190470c5cb960fb16c42d0dc13fd Mon Sep 17 00:00:00 2001 From: jazzyray Date: Tue, 17 Sep 2019 12:46:51 +0100 Subject: [PATCH 4/9] Dockerised rdfpuml --- .gitignore | 2 + Dockerfile | 64 ++++++++++++++++++++++++++++++ README.org | 37 +++++++++++------- bin/rdfpuml.pl | 7 ++-- docker-compose.yml | 10 +++++ docker_build.sh | 5 +++ docker_run.sh | 11 ++++++ {bin => plantuml}/plantuml.cfg | 0 plantuml/plantuml.sh | 3 ++ rdfpuml-docker/MyConfig.pm | 71 ++++++++++++++++++++++++++++++++++ rdfpuml-docker/gen_puml.sh | 23 +++++++++++ rdfpuml-docker/rdfpuml | 3 ++ 12 files changed, 218 insertions(+), 18 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 docker_build.sh create mode 100755 docker_run.sh rename {bin => plantuml}/plantuml.cfg (100%) create mode 100755 plantuml/plantuml.sh create mode 100644 rdfpuml-docker/MyConfig.pm create mode 100755 rdfpuml-docker/gen_puml.sh create mode 100755 rdfpuml-docker/rdfpuml diff --git a/.gitignore b/.gitignore index 2a91869..20a9e10 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /0old +out/* +ttl/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b94d123 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,64 @@ +FROM ubuntu:18.10 + +LABEL MAINTANER Jem Rayfield "jem.rayfield@ontotext.com" + +RUN apt-get update -y +RUN apt-get install -y software-properties-common +RUN apt-get install -y perl +RUN apt-get install -y automake +RUN apt-get install -y graphviz +RUN apt-get install -y curl +RUN apt-get install -y git +RUN apt-get install -y wget + +ENV DST_DIR=/puml-doc +ENV DST_DIR_OUT=/puml-doc/out + +WORKDIR ${DST_DIR} + +# CPAN +RUN apt-get install -y build-essential && \ + curl -L https://cpanmin.us | perl - App::cpanminus +COPY rdfpuml-docker/MyConfig.pm /root/.cpan/CPAN/MyConfig.pm + +# RDFPUML +RUN cd ${DST_DIR} && \ + cpanm RDF::Trine && \ + cpanm RDF::Query && \ + cpanm RDF::Prefixes && \ + cpanm Encode && \ + cpanm FindBin && \ + cpanm Carp::Always && \ + cpanm Slurp && \ + cpanm Getopt::Long && \ + cpanm Pod::Usage && \ + cpanm Path::Tiny + +COPY rdfpuml-docker/rdfpuml ${DST_DIR}/ +COPY bin/ ${DST_DIR}/rdf2rml/bin +COPY lib/ ${DST_DIR}/rdf2rml/lib +# JAVA +RUN apt-get install -y openjdk-8-jdk + +# MAVEN +RUN cd ${DST_DIR} && \ + wget http://apache.mirror.anlx.net/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \ + tar xvfz apache-maven-3.6.1-bin.tar.gz + +ENV M2_HOME="${DST_DIR}/apache-maven-3.6.1" +ENV PATH=$PATH:$M2_HOME/bin + +# Plant UML +RUN cd ${DST_DIR} && \ + git clone https://github.com/plantuml/plantuml.git && \ + cd plantuml && \ + mvn -Djar.finalName=plantuml package + +COPY plantuml/plantuml.sh ${DST_DIR}/ +ENV PATH=$PATH:${DST_DIR}/plantuml + +COPY rdfpuml-docker/gen_puml.sh ${DST_DIR}/ + +COPY plantuml/plantuml.cfg ${DST_DIR} + +ENTRYPOINT [ "/puml-doc/gen_puml.sh" ] \ No newline at end of file diff --git a/README.org b/README.org index e898b77..aa20677 100644 --- a/README.org +++ b/README.org @@ -48,20 +48,29 @@ See http://twitter.com/hashtag/rdfpuml for news, diagrams and announcements. Source: [[./doc/rdfpuml.pod]], [[./doc/rdf2rml.pod]] * Installation -Checkout this repo and add ~rdf2rml/bin~ to your path. -Install the following prerequisites: -- both tools: Perl. Tested with version 5.22 on Windows (cygwin and Strawberry). -- rdfpuml: - - [[http://www.graphviz.org/][GraphViz]] - - [[http://plantuml.com/download][PlantUML]]. - You need a recent version for new features like arrow length and color. I'm currently running 1.2018.10beta7. - See in particular [[http://plantuml.com/class-diagram][plantuml class diagrams]]. - - Perl modules: use ~cpan~ or ~cpanm~ to install them: - ~RDF::Trine RDF::Query Encode FindBin Carp::Always Slurp~ - - ~RDF::Prefixes::Curie~. This is my own module located in [[./lib]], and *rdfpuml* needs ~FindBin~ to locate it. -- rdf2rml: - - [[https://jena.apache.org/download/][Apache Jena]]: ~riot~, ~update~. Tested with version 3.1.0 of 2016-05-10. - - cat, grep, rm +Clone this repo + +- Install Docker and Docker Compose + +* [Install docker](https://docs.docker.com/install/) +* [Install docker compose](https://docs.docker.com/compose/install/) + +- Build +``` +docker-compose build +``` + +- Place your .ttl file for processing in directory `./ttl` +- Add any prefixes to ./ttl/prefixes.ttl +- Update and configure plantuml.cfg in directory `./plantuml + +- Processing +``` +docker-compose up +``` + +- .puml and .png will be place in ./out + * Evolution Help needed for the following tasks. diff --git a/bin/rdfpuml.pl b/bin/rdfpuml.pl index f4b8364..0352ac6 100644 --- a/bin/rdfpuml.pl +++ b/bin/rdfpuml.pl @@ -103,7 +103,7 @@ my $prefixfile = ''; my $plantumlcfgfile = ''; my $help = 0; -GetOptions('infile' => \$infile, 'outfile=s'=> \$outfile, 'prefixfile'=> \$prefixfile, 'plantumlcfgfile=s'=> \$plantumlcfgfile, 'help|?'=> \$help) or pod2usage(2); +GetOptions('infile' => \$infile, 'outfile=s'=> \$outfile, 'prefixfile=s'=> \$prefixfile, 'plantumlcfgfile=s'=> \$plantumlcfgfile, 'help|?'=> \$help) or pod2usage(2); pod2usage(1) if $help; =head1 NAME @@ -158,16 +158,15 @@ =head1 DESCRIPTION my $sep = File::Spec->catfile('', ''); $outfile = path( $outfile || $infile->parent . $sep . $infile->basename('.ttl') . '.puml' ); -myprint ("PUML output file [$outfile] \n"); -$prefixfile = $prefixfile || $infile->sibling('prefixes.ttl'); +$prefixfile = path( $prefixfile || $infile->sibling('prefixes.ttl') ); my $prefixes = $prefixfile->exists ? $prefixfile->slurp_utf8 : ""; my $data = $infile->slurp_utf8; my $turtle = "$PREFIXES_TURTLE\n$prefixes\n$data"; my $prefixes_all = "$PREFIXES_TURTLE\n$prefixes"; unless ($plantumlcfgfile) { - $plantumlcfgfile = dirname(__FILE__) . $sep . "plantuml.cfg"; + $plantumlcfgfile = dirname(__FILE__) . $sep . ".." . $sep . "plantuml" . $sep . "plantuml.cfg"; } my $plantumlcfgfile_path = path( $plantumlcfgfile ); my $plantuml_cfg = $plantumlcfgfile_path->exists ? $plantumlcfgfile_path->slurp_utf8 : ""; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7b53506 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + rdf-puml-generator: + build: . + container_name: rdf-puml-generator + image: rdf-puml-generator + volumes: + - ./ttl:/puml-doc/ttl/ + - ./out:/puml-doc/out/ + - ./plantuml/plantuml.cfg:/puml-doc/plantuml-cfg/plantuml.cfg diff --git a/docker_build.sh b/docker_build.sh new file mode 100755 index 0000000..c0757ed --- /dev/null +++ b/docker_build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +docker build -t rdf-puml-gen:latest "${DIR}" diff --git a/docker_run.sh b/docker_run.sh new file mode 100755 index 0000000..46e0d4a --- /dev/null +++ b/docker_run.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +docker run \ + -it \ + -v ${DIR}/ttl:/puml-doc/ttl/ \ + -v ${DIR}/out:/puml-doc/out/ \ + -v ${DIR}/plantuml/plantuml.cfg:/puml-doc/plantuml-cfg/plantuml.cfg \ + rdf-puml-gen:latest \ + /bin/bash diff --git a/bin/plantuml.cfg b/plantuml/plantuml.cfg similarity index 100% rename from bin/plantuml.cfg rename to plantuml/plantuml.cfg diff --git a/plantuml/plantuml.sh b/plantuml/plantuml.sh new file mode 100755 index 0000000..dd53eda --- /dev/null +++ b/plantuml/plantuml.sh @@ -0,0 +1,3 @@ +#! /bin/sh -e +GRAPHVIZ_DOT=`which dot` +java -DPLANTUML_LIMIT_SIZE=8192 -jar /puml-doc/plantuml/target/plantuml.jar "$@" \ No newline at end of file diff --git a/rdfpuml-docker/MyConfig.pm b/rdfpuml-docker/MyConfig.pm new file mode 100644 index 0000000..cab1d0f --- /dev/null +++ b/rdfpuml-docker/MyConfig.pm @@ -0,0 +1,71 @@ + +$CPAN::Config = { + 'applypatch' => q[], + 'auto_commit' => q[0], + 'build_cache' => q[100], + 'build_dir' => q[/root/.cpan/build], + 'build_dir_reuse' => q[0], + 'build_requires_install_policy' => q[yes], + 'bzip2' => q[/bin/bzip2], + 'cache_metadata' => q[1], + 'check_sigs' => q[0], + 'cleanup_after_install' => q[0], + 'colorize_output' => q[0], + 'commandnumber_in_prompt' => q[1], + 'connect_to_internet_ok' => q[1], + 'cpan_home' => q[/root/.cpan], + 'ftp_passive' => q[1], + 'ftp_proxy' => q[], + 'getcwd' => q[cwd], + 'gpg' => q[/usr/bin/gpg], + 'gzip' => q[/bin/gzip], + 'halt_on_failure' => q[0], + 'histfile' => q[/root/.cpan/histfile], + 'histsize' => q[100], + 'http_proxy' => q[], + 'inactivity_timeout' => q[0], + 'index_expire' => q[1], + 'inhibit_startup_message' => q[0], + 'keep_source_where' => q[/root/.cpan/sources], + 'load_module_verbosity' => q[none], + 'make' => q[], + 'make_arg' => q[], + 'make_install_arg' => q[], + 'make_install_make_command' => q[], + 'makepl_arg' => q[INSTALLDIRS=site], + 'mbuild_arg' => q[], + 'mbuild_install_arg' => q[], + 'mbuild_install_build_command' => q[./Build], + 'mbuildpl_arg' => q[--installdirs site], + 'no_proxy' => q[], + 'pager' => q[/usr/bin/less], + 'patch' => q[/usr/bin/patch], + 'perl5lib_verbosity' => q[none], + 'prefer_external_tar' => q[1], + 'prefer_installer' => q[MB], + 'prefs_dir' => q[/root/.cpan/prefs], + 'prerequisites_policy' => q[follow], + 'recommends_policy' => q[1], + 'scan_cache' => q[atstart], + 'shell' => undef, + 'show_unparsable_versions' => q[0], + 'show_upload_date' => q[0], + 'show_zero_versions' => q[0], + 'suggests_policy' => q[0], + 'tar' => q[/bin/tar], + 'tar_verbosity' => q[none], + 'term_is_latin' => q[1], + 'term_ornaments' => q[1], + 'test_report' => q[0], + 'trust_test_report_history' => q[0], + 'unzip' => q[], + 'urllist' => [q[http://www.cpan.org/]], + 'use_prompt_default' => q[0], + 'use_sqlite' => q[0], + 'version_timeout' => q[15], + 'wget' => q[/usr/bin/wget], + 'yaml_load_code' => q[0], + 'yaml_module' => q[YAML], +}; +1; +__END__ diff --git a/rdfpuml-docker/gen_puml.sh b/rdfpuml-docker/gen_puml.sh new file mode 100755 index 0000000..465ac00 --- /dev/null +++ b/rdfpuml-docker/gen_puml.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Clean out all the .puml and .png +rm -rf /puml-doc/out/* + +# Transform all the .ttl into .puml, ignore prefixes.ttl +for f in /puml-doc/ttl/*.ttl +do + turtle_file=`basename $f` + if [ "$turtle_file" != "prefixes.ttl" ]; then + base=`basename $f .ttl` + puml_file="/puml-doc/out/${base}.puml" + echo "Transforming turtle [$f] to puml [${puml_file}]" + /puml-doc/rdfpuml $f -outfile ${puml_file} -plantumlcfgfile /puml-doc/plantuml-cfg/plantuml.cfg -prefixfile /puml-doc/ttl/prefixes.ttl + fi +done + +# Transform all the .puml to .png using plantuml +for f in /puml-doc/out/*.puml +do + echo "Transforming puml [$f] to PNG" + /puml-doc/plantuml.sh $f +done \ No newline at end of file diff --git a/rdfpuml-docker/rdfpuml b/rdfpuml-docker/rdfpuml new file mode 100755 index 0000000..1cb682c --- /dev/null +++ b/rdfpuml-docker/rdfpuml @@ -0,0 +1,3 @@ +#! /bin/sh -e + +perl -S /puml-doc/rdf2rml/bin/rdfpuml.pl "$@" \ No newline at end of file From 75f988d0063f29c7582f635922b18c96a0bf663b Mon Sep 17 00:00:00 2001 From: jazzyray Date: Tue, 17 Sep 2019 13:21:20 +0100 Subject: [PATCH 5/9] Push sample --- .gitignore | 3 +- ttl/prefixes.ttl | 13 ++++ ttl/sample.ttl | 194 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 ttl/prefixes.ttl create mode 100644 ttl/sample.ttl diff --git a/.gitignore b/.gitignore index 20a9e10..7820f73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /0old -out/* -ttl/* \ No newline at end of file +out/* \ No newline at end of file diff --git a/ttl/prefixes.ttl b/ttl/prefixes.ttl new file mode 100644 index 0000000..501e9bd --- /dev/null +++ b/ttl/prefixes.ttl @@ -0,0 +1,13 @@ + @base . + @prefix voc: . + @prefix bo: . + @prefix owl: . + @prefix rdf: . + @prefix rdfs: . + @prefix xml: . + @prefix xsd: . + @prefix foaf: . + @prefix prov: . + @prefix vs: . + @prefix dc: . + @prefix skos: . diff --git a/ttl/sample.ttl b/ttl/sample.ttl new file mode 100644 index 0000000..daa48e8 --- /dev/null +++ b/ttl/sample.ttl @@ -0,0 +1,194 @@ + a voc:Human ; + rdfs:label "Luke Skywalker" ; + bo:type "Human" ; + voc:birthYear "19BBY" ; + voc:eyeColor "blue" ; + voc:film , + , + , + , + ; + voc:gender "male" ; + voc:hairColor "blond" ; + voc:height "172.0"^^xsd:float ; + voc:homeworld ; + voc:mass 77.0 ; + voc:skinColor "fair" ; + voc:species voc:Human ; + voc:starship , + ; + voc:vehicle , + . + +voc:Species a rdfs:Class ; + rdfs:subClassOf rdfs:Class . + +voc:Mammal a rdfs:Class . + +voc:Sentient a rdfs:Class . + +voc:Human a voc:Species ; + rdfs:label "Human" ; + bo:type "Species" ; + rdfs:subClassOf voc:Mammal, + voc:Sentient ; + voc:averageHeight "180.0"^^xsd:float ; + voc:averageLifespan "120" ; + voc:character ; + voc:eyeColor "amber", + "blue", + "brown", + "green", + "grey", + "hazel" ; + # voc:film , + # , + # , + # , + # ; + voc:hairColor "black", + "blonde", + "brown", + "red" ; + voc:language "Galactic Basic" ; + # voc:planet ; + voc:skinColor "asian", + "black", + "caucasian", + "hispanic" . + + a voc:Film ; + rdfs:label "A New Hope" ; + bo:type "Film" ; + voc:character ; + voc:director "George Lucas" ; + voc:episodeId 4 ; +# voc:planet ; + voc:releaseDate "1977-05-25"^^xsd:date . +# voc:starship . + + a voc:Film ; + rdfs:label "The Empire Strikes Back" ; + bo:type "Film" ; + voc:character ; + voc:director "Irvin Kershner" ; + voc:episodeId 5 ; + voc:releaseDate "1980-05-17"^^xsd:date . + # voc:starship , + # ; + # voc:vehicle . + + a voc:Film ; + rdfs:label "Return of the Jedi" ; + bo:type "Film" ; + voc:character ; + voc:director "Richard Marquand" ; + voc:episodeId 6 ; + # voc:planet ; + voc:releaseDate "1983-05-25"^^xsd:date . +# voc:starship , +# ; + # voc:vehicle . + + a voc:Film ; + rdfs:label "Revenge of the Sith" ; + bo:type "Film" ; + voc:character ; + voc:director "George Lucas" ; + voc:episodeId 3 ; + # voc:planet ; + voc:releaseDate "2005-05-19"^^xsd:date . + + a voc:Film ; + rdfs:label "The Force Awakens" ; + bo:type "Film" ; + voc:character ; + voc:director "J. J. Abrams" ; + voc:episodeId 7 ; + voc:releaseDate "2015-12-11"^^xsd:date . + + a voc:Planet ; + rdfs:label "Tatooine" ; + bo:type "Planet" ; + voc:climate "arid" ; + voc:diameter 10465 ; + # voc:film , + # , + # ; + voc:gravity "1 standard" ; + voc:orbitalPeriod 304 ; + voc:population 200000 ; + voc:resident ; + voc:rotationPeriod 23 ; + voc:surfaceWater 1 ; + voc:terrain "desert" . + + a voc:Starship ; + rdfs:label "X-wing" ; + bo:type "Starship" ; + voc:cargoCapacity 110 ; + voc:consumables "1 week" ; + voc:costInCredits 149999 ; + voc:crew 1 ; + # voc:film , + # , + # ; + voc:hyperdriveRating "1.0"^^xsd:float ; + voc:length "12.5"^^xsd:float ; + voc:manufacturer "Incom Corporation" ; + voc:maxAtmospheringSpeed 1050 ; + voc:mglt 100 ; + voc:model "T-65 X-wing" ; + voc:passengers 0 ; + voc:pilot ; + voc:starshipClass "Starfighter" . + + a voc:Starship ; + rdfs:label "Imperial shuttle" ; + bo:type "Starship" ; + voc:cargoCapacity 80000 ; + voc:consumables "2 months" ; + voc:costInCredits 240000 ; + voc:crew 6 ; + # voc:film , + # ; + voc:hyperdriveRating "1.0"^^xsd:float ; + voc:length "20.0"^^xsd:float ; + voc:manufacturer "Sienar Fleet Systems" ; + voc:maxAtmospheringSpeed 850 ; + voc:mglt 50 ; + voc:model "Lambda-class T-4a shuttle" ; + voc:passengers 20 ; + voc:pilot ; + voc:starshipClass "Armed government transport" . + + a voc:Vehicle ; + rdfs:label "Snowspeeder" ; + bo:type "Vehicle" ; + voc:cargoCapacity 10 ; + voc:consumables "none" ; + voc:crew 2 ; + # voc:film ; + voc:length "4.5"^^xsd:float ; + voc:manufacturer "Incom corporation" ; + voc:maxAtmospheringSpeed 650 ; + voc:model "t-47 airspeeder" ; + voc:passengers 0 ; + voc:pilot ; + voc:vehicleClass "airspeeder" . + + a voc:Vehicle ; + rdfs:label "Imperial Speeder Bike" ; + bo:type "Vehicle" ; + voc:cargoCapacity 4 ; + voc:consumables "1 day" ; + voc:costInCredits 8000 ; + voc:crew 1 ; + # voc:film ; + voc:length "3.0"^^xsd:float ; + voc:manufacturer "Aratech Repulsor Company" ; + voc:maxAtmospheringSpeed 360 ; + voc:model "74-Z speeder bike" ; + voc:passengers 1 ; + voc:pilot ; + voc:vehicleClass "speeder" . \ No newline at end of file From c3323b070f83fa4163611a8fc8ff21366d8e3041 Mon Sep 17 00:00:00 2001 From: jazzyray Date: Wed, 16 Dec 2020 14:30:15 +0000 Subject: [PATCH 6/9] Fix ubuntu version --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b94d123..fe44b7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.10 +FROM ubuntu:20.10 LABEL MAINTANER Jem Rayfield "jem.rayfield@ontotext.com" @@ -42,10 +42,10 @@ RUN apt-get install -y openjdk-8-jdk # MAVEN RUN cd ${DST_DIR} && \ - wget http://apache.mirror.anlx.net/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \ - tar xvfz apache-maven-3.6.1-bin.tar.gz + wget https://www.mirrorservice.org/sites/ftp.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz && \ + tar xvfz apache-maven-3.6.3-bin.tar.gz -ENV M2_HOME="${DST_DIR}/apache-maven-3.6.1" +ENV M2_HOME="${DST_DIR}/apache-maven-3.6.3" ENV PATH=$PATH:$M2_HOME/bin # Plant UML @@ -61,4 +61,4 @@ COPY rdfpuml-docker/gen_puml.sh ${DST_DIR}/ COPY plantuml/plantuml.cfg ${DST_DIR} -ENTRYPOINT [ "/puml-doc/gen_puml.sh" ] \ No newline at end of file +ENTRYPOINT [ "/puml-doc/gen_puml.sh" ] From 43f63597412ddfb03f1238e31b5822a46c962369 Mon Sep 17 00:00:00 2001 From: jazzyray Date: Wed, 16 Dec 2020 14:55:41 +0000 Subject: [PATCH 7/9] Fix java install woes --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fe44b7d..d31a7ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,8 @@ COPY rdfpuml-docker/rdfpuml ${DST_DIR}/ COPY bin/ ${DST_DIR}/rdf2rml/bin COPY lib/ ${DST_DIR}/rdf2rml/lib # JAVA -RUN apt-get install -y openjdk-8-jdk +RUN apt update && \ + apt-get install -y openjdk-11-jdk # MAVEN RUN cd ${DST_DIR} && \ From 8f780b15a8609da8222fda7e78f8052a13b7c74e Mon Sep 17 00:00:00 2001 From: jazzyray Date: Wed, 16 Dec 2020 15:03:47 +0000 Subject: [PATCH 8/9] Revert JAVA version to 8 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d31a7ca..20c90ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ COPY bin/ ${DST_DIR}/rdf2rml/bin COPY lib/ ${DST_DIR}/rdf2rml/lib # JAVA RUN apt update && \ - apt-get install -y openjdk-11-jdk + apt-get install -y openjdk-8-jdk # MAVEN RUN cd ${DST_DIR} && \ From 3d161fb6c2721e3ecce98a00e72ad4ee179ba801 Mon Sep 17 00:00:00 2001 From: jazzyray Date: Wed, 16 Dec 2020 15:47:01 +0000 Subject: [PATCH 9/9] Temp use plantuml jar...instead of compiling --- Dockerfile | 12 ++++++++---- plantuml/plantuml.sh | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20c90ae..ca75bc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,6 +41,9 @@ COPY lib/ ${DST_DIR}/rdf2rml/lib RUN apt update && \ apt-get install -y openjdk-8-jdk +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ +RUN export JAVA_HOME + # MAVEN RUN cd ${DST_DIR} && \ wget https://www.mirrorservice.org/sites/ftp.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz && \ @@ -51,10 +54,11 @@ ENV PATH=$PATH:$M2_HOME/bin # Plant UML RUN cd ${DST_DIR} && \ - git clone https://github.com/plantuml/plantuml.git && \ - cd plantuml && \ - mvn -Djar.finalName=plantuml package - + wget https://sourceforge.net/projects/plantuml/files/plantuml.jar +# git clone https://github.com/plantuml/plantuml.git && \ +# cd plantuml && \ +# mvn -Djar.finalName=plantuml package + COPY plantuml/plantuml.sh ${DST_DIR}/ ENV PATH=$PATH:${DST_DIR}/plantuml diff --git a/plantuml/plantuml.sh b/plantuml/plantuml.sh index dd53eda..ff4c4cd 100755 --- a/plantuml/plantuml.sh +++ b/plantuml/plantuml.sh @@ -1,3 +1,3 @@ #! /bin/sh -e GRAPHVIZ_DOT=`which dot` -java -DPLANTUML_LIMIT_SIZE=8192 -jar /puml-doc/plantuml/target/plantuml.jar "$@" \ No newline at end of file +java -DPLANTUML_LIMIT_SIZE=8192 -jar /puml-doc/plantuml.jar "$@" \ No newline at end of file