diff --git a/rdd-technical-reference.md b/rdd-technical-reference.md index 80bd8a28e5ad948d72281b65c21d2ea863d82275..e4ee04281d3582693f7c6bfa9fe7c30945d8988c 100644 --- a/rdd-technical-reference.md +++ b/rdd-technical-reference.md @@ -39,45 +39,12 @@ For the more prominent programming languages we have formatting and general styl - use four spaces for a TAB (because eXide switching the preferences in eXide's setting isn't permanent) - **XSLT**: Since there is no official style guide for XSLT, we decided to write -[our own](https://github.com/subugoe/rdd-technical-reference/tree/master/style-guides/FE-XSLT.pdf), resulting from common best practices and own experiences within +[our own](https://github.com/subugoe/rdd-technical-reference/tree/master/style-guides/rdd-xslt.md), resulting from common best practices and own experiences within the department. - **Python**: For Python [PEP 8](https://www.python.org/dev/peps/pep-0008/) should be used, Django has a style guide based on PEP-8 with some exceptions: [Django-Styleguide](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/). There are linters and tools like [flake-8](https://pypi.org/project/flake8/) and [pep-8](https://pypi.org/project/pep8/) available as support. -- **SPARQL**: For SPARQL there is not really any official style guide and there is no possibility to simply include any code style automatically using a code style file. We just collect some advice how to format and use SPARQL code. - - - declaration of variables should start with a **?** (and not with a **$**). - - opening parenthesis **{** should be at the end of the line. Closing parenthesis in a separate line. Example: - -``` -SELECT * WHERE { - ?s ?p ?o . -} LIMIT 10 -``` - -''' - - group concatenations in SELECT command should be in seperate lines. -''' - -``` -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> -PREFIX skos: <http://www.w3.org/2004/02/skos/core#> -PREFIX dct: <http://purl.org/dc/terms/> - -SELECT DISTINCT -(group_concat( distinct ?conceptName;separator="; ") as ?conceptNames) -(group_concat( distinct ?conceptUri;separator="; ") as ?conceptUris) -(group_concat( distinct ?next;separator="; ") as ?nexts) -(group_concat( distinct ?def;separator="; ") as ?defs) - WHERE { - <' + uri + '> skos:narrower ?conceptUri. - ?conceptUri skos:prefLabel ?conceptName. - OPTIONAL {?conceptUri skos:narrower ?next.} - OPTIONAL {?conceptUri skos:definition ?def.} - FILTER(LANG(?conceptName) = "" || LANGMATCHES(LANG(?conceptName), "en")) -} GROUP BY ?conceptUri -``` +- **SPARQL**: For SPARQL there is not really any official style guide and there is no possibility to simply include any code style automatically using a code style file. We just collect some advice how to format and use SPARQL code [here] (https://github.com/subugoe/rdd-technical-reference/tree/master/style-guides/rdd-sparql.md). # Is Your Software Fully Documented? diff --git a/rdd-technical-reference.pdf b/rdd-technical-reference.pdf index 3a5870b21f529508bc67af9534fb3d026f40af4a..0dcb329fe222683a81ada7fa29b619ea8d7a5c61 100644 Binary files a/rdd-technical-reference.pdf and b/rdd-technical-reference.pdf differ diff --git a/style-guides/rdd-sparql.md b/style-guides/rdd-sparql.md new file mode 100644 index 0000000000000000000000000000000000000000..abe0d10e52401114458c6760a8f7f8c495fee2b0 --- /dev/null +++ b/style-guides/rdd-sparql.md @@ -0,0 +1,42 @@ +# The SUB RDD SparQL Style Guide + +## Purpose + +This document serves to establish consistent SparQL code style for all projects (from June 2018 on) in the SUB Research and Development Department. + +The structure of this document is inspired by [Google's HTML and CSS style](https://google.github.io/styleguide/htmlcssguide.html) guide. + +## General Style Rules + +- declaration of variables should start with a **?** (and not with a **$**). +- opening parenthesis **{** should be at the end of the line. Closing parenthesis in a separate line. Example: + +``` +SELECT * WHERE { +?s ?p ?o . +} LIMIT 10 +``` + +''' +- group concatenations in SELECT command should be in seperate lines. +''' + +``` +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX skos: <http://www.w3.org/2004/02/skos/core#> +PREFIX dct: <http://purl.org/dc/terms/> + +SELECT DISTINCT +(group_concat( distinct ?conceptName;separator="; ") as ?conceptNames) +(group_concat( distinct ?conceptUri;separator="; ") as ?conceptUris) +(group_concat( distinct ?next;separator="; ") as ?nexts) +(group_concat( distinct ?def;separator="; ") as ?defs) +WHERE { +<' + uri + '> skos:narrower ?conceptUri. +?conceptUri skos:prefLabel ?conceptName. +OPTIONAL {?conceptUri skos:narrower ?next.} +OPTIONAL {?conceptUri skos:definition ?def.} +FILTER(LANG(?conceptName) = "" || LANGMATCHES(LANG(?conceptName), "en")) +} GROUP BY ?conceptUri +``` diff --git a/style-guides/rdd-sparql.pdf b/style-guides/rdd-sparql.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4b824e218bcfee3d5ff25df29bfb347fddbe6977 Binary files /dev/null and b/style-guides/rdd-sparql.pdf differ diff --git a/style-guides/FE-XSLT.md b/style-guides/rdd-xslt.md similarity index 99% rename from style-guides/FE-XSLT.md rename to style-guides/rdd-xslt.md index dbbe3e0510c72fc649133f689808f43f8714a79a..3b25996bfb09d35068273f80f83e4fc9264a621f 100644 --- a/style-guides/FE-XSLT.md +++ b/style-guides/rdd-xslt.md @@ -1,4 +1,4 @@ -# The SUB-RDD XSLT style guide +# The SUB RDD XSLT Style Guide ## Purpose diff --git a/style-guides/FE-XSLT.pdf b/style-guides/rdd-xslt.pdf similarity index 100% rename from style-guides/FE-XSLT.pdf rename to style-guides/rdd-xslt.pdf