Skip to content
Snippets Groups Projects
Commit 61f63481 authored by alangrafu's avatar alangrafu
Browse files

Automatic query conversion to publish non-human formats

parent 2a9ded97
No related branches found
No related tags found
No related merge requests found
This directory will include useful templates for different classes.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?firstName ?lastName ?img ?homepage ?k WHERE {
{
%u foaf:name ?name ;
foaf:firstName ?firstName;
foaf:depiction ?img ;
foaf:homepage ?homepage;
foaf:lastName ?lastName .
}UNION{
%u foaf:knows ?k .
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
{%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>Page about {{row.value.name}}</title>
<link href="{{base.baseUrl}}lodspeakr/css/person.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
{% for row in r %}
{% if row.value.name != '' %}
<h1>{{row.value.firstName}} {{row.value.lastName}}{% if row.value.img != '' %} <img src="{{row.value.img}}" width="100px"/>{%endif%}</h1>
<p>This is a page about {{row.value.name}}. He has a personal homepage located at <a href='{{row.value.homepage}}'>{{row.value.homepage}}</a>.</p>
{%endif%}
{% endfor %}
{% for row in r %}
{% if row.value.k != '' %}<p>He knows <a href='{{row.value.k}}'>{{row.value.k}}</a></p>{%endif%}
{% endfor %}
</body>
</html>
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
USAGE="Usage: $0 create|delete uri|class|service foo [html|rdf|ttl|nt|json]"
formats=( html rdf ttl nt json all )
operations=( create delete )
modules=( class service uri )
currentOperation=
currentFormat=
currentModule=
if [[ ${operations[@]} =~ $1 ]]
then
currentOperation=$1
else
echo "Operation \"$1\" not valid"
echo $USAGE
exit 1
fi
if [[ ${modules[@]} =~ $2 ]]
then
currentModule=$2
else
echo "Module \"$2\" not valid"
echo $USAGE
exit 1
fi
if [[ ${formats[@]} =~ $4 ]]
then
currentFormat=$4
else
if [ -z "$4" ]
then
currentFormat="all"
else
echo "Format \"$4\" not valid"
echo $USAGE
exit 1
fi
fi
currentUnit=$3
if [[ $currentOperation == "create" ]]
then
$DIR/modules/create-$currentModule.sh "$currentUnit" "$currentFormat"
fi
if [[ $currentOperation == "delete" ]]
then
$DIR/modules/delete-$currentModule.sh "$currentUnit" "$currentFormat"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment