diff --git a/doc/README b/doc/README new file mode 100644 index 0000000000000000000000000000000000000000..604e9e250f7de569c346733ac8b68df994275f0f --- /dev/null +++ b/doc/README @@ -0,0 +1,11 @@ +## 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 + + diff --git a/doc/examples/components/services/people/html.template b/doc/examples/components/services/people/html.template new file mode 100644 index 0000000000000000000000000000000000000000..43c17e2cad4fd64a360c78d67f8b9d6bb93f83a9 --- /dev/null +++ b/doc/examples/components/services/people/html.template @@ -0,0 +1,18 @@ +<?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> diff --git a/doc/examples/components/services/people/queries/main.query b/doc/examples/components/services/people/queries/main.query new file mode 100644 index 0000000000000000000000000000000000000000..3fcb2facef4a7f3dbbfe47002f5fc88280d99647 --- /dev/null +++ b/doc/examples/components/services/people/queries/main.query @@ -0,0 +1,10 @@ +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 diff --git a/doc/examples/components/services/peopleByName/html.template b/doc/examples/components/services/peopleByName/html.template new file mode 100644 index 0000000000000000000000000000000000000000..982cdd8d7e34a5bacc05729c665bddec9e314aba --- /dev/null +++ b/doc/examples/components/services/peopleByName/html.template @@ -0,0 +1,18 @@ +<?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> diff --git a/doc/examples/components/services/peopleByName/json.template b/doc/examples/components/services/peopleByName/json.template new file mode 100644 index 0000000000000000000000000000000000000000..9aae302631b31bd5d7b6c42cdcdd6a445d4e1fe1 --- /dev/null +++ b/doc/examples/components/services/peopleByName/json.template @@ -0,0 +1,11 @@ +{ + "people": [ + {% for row in models.main %} + { + "uri": "{{row.person.value}}", + "name": "{{row.name.value}}", + "email": "{{row.email.value}}" + }{%if ! forloop.last%},{%endif%} + {% endfor %} + ] +} diff --git a/doc/examples/components/services/peopleByName/queries/main.query b/doc/examples/components/services/peopleByName/queries/main.query new file mode 100644 index 0000000000000000000000000000000000000000..e1d9d71e2b1aab631c65dcac6aa9772434eaf8b6 --- /dev/null +++ b/doc/examples/components/services/peopleByName/queries/main.query @@ -0,0 +1,11 @@ +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 diff --git a/doc/examples/components/types/foaf:Person/html.template b/doc/examples/components/types/foaf:Person/html.template new file mode 100644 index 0000000000000000000000000000000000000000..5d3b254b39f868aa5b0f4c26416c7ca163b49bec --- /dev/null +++ b/doc/examples/components/types/foaf:Person/html.template @@ -0,0 +1,38 @@ +<?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> diff --git a/doc/examples/components/types/foaf:Person/queries/attendees.query b/doc/examples/components/types/foaf:Person/queries/attendees.query new file mode 100644 index 0000000000000000000000000000000000000000..19b4390df2b7e799b9112005078598f670bcc1a5 --- /dev/null +++ b/doc/examples/components/types/foaf:Person/queries/attendees.query @@ -0,0 +1,12 @@ +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}}") + } +} diff --git a/doc/examples/components/types/foaf:Person/queries/birthplace.query b/doc/examples/components/types/foaf:Person/queries/birthplace.query new file mode 100644 index 0000000000000000000000000000000000000000..526417f818b393b9862e72114ccc37cf2aa053ae --- /dev/null +++ b/doc/examples/components/types/foaf:Person/queries/birthplace.query @@ -0,0 +1,8 @@ +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 + } +} diff --git a/doc/examples/components/types/foaf:Person/queries/endpoint.dbpedia/geo.query b/doc/examples/components/types/foaf:Person/queries/endpoint.dbpedia/geo.query new file mode 100644 index 0000000000000000000000000000000000000000..b895676dfce2274fb5c72aa6bfeec3c08b92e7ba --- /dev/null +++ b/doc/examples/components/types/foaf:Person/queries/endpoint.dbpedia/geo.query @@ -0,0 +1,9 @@ +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 diff --git a/doc/examples/components/types/foaf:Person/queries/endpoint.dbpedia/location.query b/doc/examples/components/types/foaf:Person/queries/endpoint.dbpedia/location.query new file mode 100644 index 0000000000000000000000000000000000000000..f76659a1fb37ab95c8122f02f58f1cd1138e3f29 --- /dev/null +++ b/doc/examples/components/types/foaf:Person/queries/endpoint.dbpedia/location.query @@ -0,0 +1,7 @@ +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 diff --git a/doc/examples/components/types/foaf:Person/queries/main.query b/doc/examples/components/types/foaf:Person/queries/main.query new file mode 100644 index 0000000000000000000000000000000000000000..1b878b6252b6b7e96102e4f754f272c5a748b662 --- /dev/null +++ b/doc/examples/components/types/foaf:Person/queries/main.query @@ -0,0 +1,10 @@ +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 . + } + } +} diff --git a/doc/examples/components/types/foaf:Person/queries/personalDetails.query b/doc/examples/components/types/foaf:Person/queries/personalDetails.query new file mode 100644 index 0000000000000000000000000000000000000000..cf35f1607a9c5daa4915a9b9bf282c8ad1419500 --- /dev/null +++ b/doc/examples/components/types/foaf:Person/queries/personalDetails.query @@ -0,0 +1,12 @@ +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. + } +}