Skip to content
Snippets Groups Projects
Commit 6f848893 authored by alvaro's avatar alvaro
Browse files

Adding examples to doc/

parent 31ef9055
No related branches found
No related tags found
No related merge requests found
Showing
with 175 additions and 0 deletions
## Documentation
The latest version of the documentation is available at
https://github.com/alangrafu/lodspeakr/wiki
## Examples
Some real-world examples are provided under example/components to show how components are used
<?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 xmlns="http://www.w3.org/1999/xhtml" {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
{%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>TWC People directory</title>
<link href="{{lodspk.baseUrl}}css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>People</h1>
<ul>
{% for row in models.main %}
<li><a href="{{row.people.value}}">{{row.name.value}} - {{row.email.value}}</a></li>
{% endfor %}
</ul>
</body>
</html>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?person ?email ?name WHERE {
GRAPH ?g {
?person a foaf:Person ;
foaf:name ?name ;
foaf:mbox ?email .
}
}order by ?name
<?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 xmlns="http://www.w3.org/1999/xhtml" {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
{%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>TWC People directory</title>
<link href="{{lodspk.baseUrl}}css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>People</h1>
<ul>
{% for row in models.main %}
<li><a href="{{row.person.value}}">{{row.name.value}} - {{row.email.value}}</a></li>
{% endfor %}
</ul>
</body>
</html>
{
"people": [
{% for row in models.main %}
{
"uri": "{{row.person.value}}",
"name": "{{row.name.value}}",
"email": "{{row.email.value}}"
}{%if ! forloop.last%},{%endif%}
{% endfor %}
]
}
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?person ?email ?name WHERE {
GRAPH ?g {
?person a foaf:Person ;
foaf:name ?name ;
foaf:mbox ?email .
FILTER(regex(?name, "^{{lodspk.args.arg0}}", "i" ))
}
}order by ?name
<?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 xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>Page about {{lodspk.this.value}}</title>
<link href="{{lodspk.baseUrl}}css/basic.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="alternate" type="application/rdf+xml" title="RDF/XML Version" href="{{lodspk.this.value}}.rdf" />
<link rel="alternate" type="text/turtle" title="Turtle Version" href="{{lodspk.this.value}}.ttl" />
<link rel="alternate" type="text/plain" title="N-Triples Version" href="{{lodspk.this.value}}.nt" />
<link rel="alternate" type="application/json" title="RDFJSON Version" href="{{lodspk.this.value}}.json" />
</head>
<body>
<img style='float:right;width:200px' src='{{first.personalDetails.pic.mirroredUri}}'/>
<h1>{{first.personalDetails.name.value}}</h1>
<p>{{first.personalDetails.desc.value}}
</p>
<div>
<h2>{{first.personalDetails.name.value}} has attended meetings with</h2>
<ul>
{% for row in models.attendees %}
<li><a href="{{row.attendee.value}}">{%if row.attendeeName.value%}{{row.attendeeName.value}}{%else%}{{row.attendee.curie}}{%endif%}</a></li>
{%endfor%}
</ul>
</div>
{%if first.dbpedia.bplace == null%}
<div>
{{first.dbpedia.birthplace.bplace.value}}
<h3>Born in: {{first.dbpedia.location.name.value}}</h3>
<div>
<div style="float:left">
</div><p style="float:left">{{first.dbpedia.location.abstract.value}}</p>
{{models.dbpedia.geo|googlemaps:"lat,lon,name"}}
</div>
{%endif%}
</div>
</body>
</html>
PREFIX twc: <http://tw.rpi.edu/schema/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?attendee ?attendeeName WHERE {
GRAPH <http://tw.rpi.edu:2020/books>{
?event twc:hasAttendee <{{uri}}> .
?event twc:hasAttendee ?attendee .
OPTIONAL{
?attendee foaf:name ?attendeeName .
}
FILTER(str(?attendee) != "{{uri}}")
}
}
PREFIX twc: <http://tw.rpi.edu/schema/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbp: <http://dbpedia.org/ontology/>
SELECT distinct ?bplace WHERE {
GRAPH <http://tw.rpi.edu:2020/books>{
<{{uri}}> dbp:birthPlace ?bplace
}
}
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dbp: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT distinct ?lat ?lon ?name WHERE {
<{{first.birthplace.bplace.value}}> rdfs:label ?name ;
geo:lat ?lat;
geo:long ?lon.
}limit 1
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbp: <http://dbpedia.org/ontology/>
SELECT distinct ?name ?abstract WHERE {
<{{first.birthplace.bplace.value}}> dbp:abstract ?abstract;
rdfs:label ?name .
FILTER(lang(?abstract) = "en")
}limit 1
PREFIX twc: <http://tw.rpi.edu/schema/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?event ?eventName WHERE {
GRAPH <http://tw.rpi.edu:2020/books>{
?event twc:hasAttendee <{{uri}}> .
OPTIONAL{
?event foaf:name ?eventName .
}
}
}
PREFIX twc: <http://tw.rpi.edu/schema/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?name ?desc ?pic WHERE {
GRAPH <http://tw.rpi.edu:2020/books>{
<{{uri}}> foaf:name ?name ;
foaf:depiction ?pic ;
dcterms:description ?desc.
}
}
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