@prefix browser: . @prefix wdab: . @prefix dct: . @prefix owl: . @prefix rdfs: . @prefix void: . @prefix l: . @prefix a: . ##################################### # Configurations # # Configuration is the entry point which defines the behavior of the visual browser. # It consists of one or more view sets. ##################################### a browser:Configuration ; dct:title "Taxonomy of animals and plants"@en ; dct:description "Classification of all organisms, plants and animals, into taxa."@en ; browser:hasVisualStyleSheet ; browser:startingNode , ; browser:resourceIriPattern "^http://www\\.wikidata\\.org/entity/Q[1-9][0-9]*$"; browser:hasViewSet . ##################################### # ViewSets # # A view set is a set of views which can be applied on a node which satisfies a condition defined for the view set. # For example, the view set below can be applied on any node which satisfies: # ?node wdt:P31 ?type . FILTER(?type IN (wd:Q16521, wd:Q713623)) # Each view then defines how a node satisfying the condition is visualized. # It is expected that the client calls the server operation /view-sets which takes an IRI of a node as a parameter and returns views from the view sets whose condition is satisfied by the node. ##################################### a browser:ViewSet ; dct:title "Views of taxons"@en ; browser:hasView , ; browser:hasDefaultView ; browser:hasCondition """PREFIX wd: PREFIX wdt: ASK { ?node wdt:P31 ?type . FILTER(?type IN (wd:Q16521, wd:Q713623)) }""" ; browser:hasDataset . ##################################### # Views # # A view defines how a node satisfying the condition is visualized. It consists of three parts: # - expansion defines the neighbourhood of the node which is shown when the user wants to expand the node; expansion is requested by the client by calling the /expand operation with the IRI of the expanded node as a parameter # - preview defines data used to show the body of the node in the visualization (typically its label); preview is requested by the client by calling the /preview operation with the IRI of the previewed node as a parameter # - detail defines data used to show the detail information about the node; detail is requested by the client by calling the /detail operation with the IRI of the detailed node as a parameter ##################################### a browser:View ; dct:title "Parent taxons"@en ; browser:hasExpansion ; browser:hasPreview ; browser:hasDetail . a browser:View ; dct:title "Child taxons"@en ; browser:hasExpansion ; browser:hasPreview ; browser:hasDetail . ##################################### # Queries ##################################### ##################################### # Expansion example # # Expansion of the node is defined by the query and dataset on which the query is executed. The expansion query is a SPARQL query which returns the neighbourhood of the node which shall be visualized after the expansion. It shall return all informaton necessary to display visually the nodes in the neighbourhood so that the client does not need to request the preview operation for each node in the neighbourhood. ##################################### a browser:ExpansionQuery ; dct:title "Parent taxons"@en ; browser:hasDataset ; browser:query """PREFIX wd: PREFIX wdt: PREFIX skos: PREFIX rdfs: PREFIX wdab: PREFIX browser: CONSTRUCT { ?parentTaxon a wdab:taxon ; rdfs:label ?parentTaxonLabel ; browser:class "taxon", ?parentTaxonClass . ?node wdab:broader ?parentTaxon . wdab:broader browser:class "broader" . } WHERE { ?node wdt:P171 ?parentTaxon . OPTIONAL { ?parentTaxon wdt:P105 ?parentTaxonRank . ?parentTaxonRank rdfs:label ?parentTaxonRankLabel . FILTER(lang(?parentTaxonRankLabel) = "en") BIND(IF(?parentTaxonRank IN (wd:Q7432, wd:Q34740, wd:Q35409, wd:Q36602, wd:Q37517, wd:Q38348, wd:Q36732, wd:Q146481), ?parentTaxonRankLabel, "unsupportedTaxon") AS ?parentTaxonClass) } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }""" . a browser:ExpansionQuery ; dct:title "Child taxons"@en ; browser:hasDataset ; browser:query """PREFIX wd: PREFIX wdt: PREFIX skos: PREFIX rdfs: PREFIX wdab: PREFIX browser: CONSTRUCT { ?childTaxon a wdab:taxon ; rdfs:label ?childTaxonLabel ; wdab:broader ?node ; browser:class "taxon", ?childTaxonClass . wdab:broader browser:class "broader" . } WHERE { ?childTaxon wdt:P171 ?node . OPTIONAL { ?childTaxon wdt:P105 ?childTaxonRank . ?childTaxonRank rdfs:label ?childTaxonRankLabel . FILTER(lang(?childTaxonRankLabel) = "en") BIND(IF(?childTaxonRank IN (wd:Q7432, wd:Q34740, wd:Q35409, wd:Q36602, wd:Q37517, wd:Q38348, wd:Q36732, wd:Q146481), ?childTaxonRankLabel, "unsupportedTaxon") AS ?childTaxonClass) } #FILTER(?childTaxonRank IN (wd:Q7432, wd:Q34740, wd:Q35409, wd:Q36602, wd:Q37517, wd:Q38348, wd:Q36732, wd:Q146481)) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }""" . ##################################### # Preview example # # Preview of the node is defined by the query and dataset on which the query is executed. The preview query is a SPARQL query which returns basic information which is necessary to display the node visually. ##################################### a browser:PreviewQuery ; dct:title "Taxon basic overview"@en ; browser:hasDataset ; browser:query """PREFIX wd: PREFIX wdt: PREFIX skos: PREFIX rdfs: PREFIX wdab: PREFIX browser: CONSTRUCT { ?node a wdab:taxon ; rdfs:label ?nodeLabel ; browser:class "taxon", ?taxonClass . } WHERE { ?node wdt:P105 ?taxonRank . ?taxonRank rdfs:label ?taxonRankLabel . FILTER(lang(?taxonRankLabel) = "en") BIND(IF(?taxonRank IN (wd:Q7432, wd:Q34740, wd:Q35409, wd:Q36602, wd:Q37517, wd:Q38348, wd:Q36732, wd:Q146481), ?taxonRankLabel, "unsupportedTaxon") AS ?taxonClass) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }""" . ##################################### # Detail example # # Detail of the node is defined by the query and dataset on which the query is executed. The detail query is a SPARQL query which returns properties of the node which are displayed in the detail section for that node. Currently, we support only properties with primitive string values. ##################################### a browser:DetailQuery ; dct:title "Taxon basic detail"@en ; browser:hasDataset ; browser:query """PREFIX wd: PREFIX wdt: PREFIX skos: PREFIX rdfs: PREFIX wdab: PREFIX browser: CONSTRUCT { ?node rdfs:label ?nodeLabel ; wdt:P225 ?p225 ; wdt:P181 ?p181 ; wdt:P18 ?p18 . } WHERE { ?node wdt:P31 wd:Q16521 . { ?node wdt:P225 ?p225 . } UNION { ?node wdt:P181 ?p181 . } UNION { ?node wdt:P18 ?p18 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }""" . ##################################### # Datasets # # This defines a SPARQL endpoint on which queries from the configuration are executed. There may be more datasets in a single configuration. ##################################### a void:Dataset ; dct:title "Wikidata SPARQL endpoint"@en ; void:sparqlEndpoint ; browser:accept "application/sparql-results+json" . ##################################### # View vocabularies ##################################### a owl:Class ; rdfs:label "taxon"@en . a owl:ObjectProperty ; rdfs:label "parent taxon"@en ; rdfs:domain wdab:taxon ; rdfs:range wdab:taxon . ##################################### # Visual styles # # Style sheet is the entry point which defines the visual look. Individual styles define how nodes and edges in the graph matching a given selector should look like. The power of Cytoscape.js styles is used here. ##################################### a browser:VisualStyleSheet ; browser:hasVisualStyle , , , , , , , , , , , , . a browser:VisualStyle ; browser:border-width "2px" ; browser:shape "octagon" ; browser:label "data(label)" ; browser:width "20px" ; browser:height "20px" ; browser:padding "2px" ; browser:text-halign "center" ; browser:text-valign "bottom" ; browser:text-margin-y "2px" ; browser:hasSelector ".taxon" . a browser:VisualStyle ; browser:background-color "#ff8000" ; browser:hasSelector ".species" . a browser:VisualStyle ; browser:background-color "#ffbf00" ; browser:hasSelector ".genus" . a browser:VisualStyle ; browser:background-color "#bfff00" ; browser:hasSelector ".family" . a browser:VisualStyle ; browser:background-color "#00ff40" ; browser:hasSelector ".order" . a browser:VisualStyle ; browser:background-color "#00ffbf" ; browser:hasSelector ".class" . a browser:VisualStyle ; browser:background-color "#00bfff" ; browser:hasSelector ".phylum" . a browser:VisualStyle ; browser:background-color "#8000ff" ; browser:hasSelector ".kingdom" . a browser:VisualStyle ; browser:background-color "#ff00bf" ; browser:hasSelector ".domain" . a browser:VisualStyle ; browser:background-color "#444444" ; browser:hasSelector ".unsupportedTaxon" . a browser:VisualStyle ; browser:width "1"; browser:curve-style "straight" ; browser:line-color "#7dd181" ; browser:line-style "solid" ; browser:label "data(label)" ; browser:font-size "6px" ; browser:target-arrow-shape "triangle" ; browser:curve-style "straight" ; browser:hasSelector ".broader" . a browser:VisualStyle ; browser:background-color "#A9A5A7" ; browser:border-color "#544B50" ; browser:border-width "2px" ; browser:color "black" ; browser:shape "rectangle" ; browser:label 'data(label)' ; browser:text-valign "center" ; browser:text-halign "left" ; browser:width "16" ; browser:height "16" ; browser:hasSelector "node" . a browser:VisualStyle ; browser:width "1"; browser:line-color "red"; browser:hasSelector "edge" . #https://linked.opendata.cz/resource/knowledge-graph-browser/configuration/wikidata/animals #https://linked.opendata.cz/resource/knowledge-graph-browser/wikidata/animals/style-sheet #http://www.wikidata.org/entity/Q135022