Skip to content

w3c-turtle-grammar.fbl

Example document w3c-turtle-grammar.fbl

Views generated from the file

This view is drawn by this site from w3c-turtle-grammar.fbl itself. It shows the data in the document, not the notation the diagram draws.

Bindings of w3c-turtle-grammar.fbl. Flowchart of the bindings in w3c-turtle-grammar.fbl: 1 binding(s) (turtle) as boxes with the files they claim and their body's format family, and 2 element rule(s) and 0 relation rule(s) as rounded boxes with the type each produces.
Generated from w3c-turtle-grammar.fbl at 52bec21
Diagram as text (Mermaid)
flowchart LR
  accTitle: Bindings of w3c-turtle-grammar.fbl
  accDescr: Flowchart of the bindings in w3c-turtle-grammar.fbl: 1 binding(s) (turtle) as boxes with the files they claim and their body's format family, and 2 element rule(s) and 0 relation rule(s) as rounded boxes with the type each produces.
  b_turtle["RDF in Turtle, read by its grammar<br/>turtle<br/>.ttl, grammar family"]
  e_turtle_prefix("prefix<br/>Prefix")
  b_turtle -->|element| e_turtle_prefix
  e_turtle_resource("resource<br/>Resource")
  b_turtle -->|element| e_turtle_resource

The file

Download w3c-turtle-grammar.fbl (2,766 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/fbl/schema/0.1/fbl.schema.json#/$defs/Document",
  "fbl": "0.9",
  "doc": "FBL 0.9's grammar family (section 4.9): Turtle read by the grammar w3c-turtle.lark beside this document instead of by a persistence plugin, for the prefixes and the labelled resources of a W3C RDF graph (definitions/diagrams/w3c-rdf.dis). A statement whose subject is a resource, an IRI or a prefixed name, is a Resource, its id the subject as written and its label the first rdfs:label written in it; a prefix directive is a Prefix. Every other statement, and every other triple, is kept and binds nothing. A statement that does not parse is skipped to its '.' and reported at its line, and the rest is read (recover). w3c-turtle.fbl, the plugin binding the four W3C tool types run, stays as it is; spec 035 binds the W3C RDF type's Turtle with this family in its tool description.",
  "bindings": {
    "turtle": {
      "title": "RDF in Turtle, read by its grammar",
      "claims": {
        "extensions": [".ttl"],
        "origins": ["w3c/rdf"]
      },
      "body": {
        "kind": "file",
        "family": "grammar",
        "grammar": { "file": "w3c-turtle.lark" },
        "start": "turtle_doc",
        "recover": { "unit": "statement", "sync": ["."] }
      },
      "reader": "declared",
      "text": { "newline": "crlf", "indent": 4, "finalNewline": true },
      "elements": [
        {
          "name": "prefix",
          "type": "Prefix",
          "doc": "`@prefix ex: <http://example.org/> .`: the name without its colon, the IRI without its angle brackets. Prefixes are read, and written only by a set.",
          "at": "/statement/prefix_id",
          "id": { "from": { "node": "PNAME_NS" } },
          "attributes": {
            "name": { "node": "PNAME_NS", "match": "(?<value>[^:]*):" },
            "iri": { "node": "IRIREF", "match": "<(?<value>[^>]*)>" }
          }
        },
        {
          "name": "resource",
          "type": "Resource",
          "at": "/triples_statement",
          "when": "entry.children[0].children[0].children[0].type == 'iri'",
          "id": { "from": { "node": "triples/subject" } },
          "attributes": {
            "label": {
              "node": "triples/predicate_object_list/predicate_object[verb='rdfs:label']/object_list/object/rdf_literal/string",
              "match": "\"(?<value>(?:[^\"\\\\]|\\\\.)*)\""
            }
          },
          "insert": { "place": "after-last", "emit": "{id} rdfs:label \"{label}\" ." },
          "remove": {}
        }
      ],
      "template": {
        "text": "@prefix ex: <http://example.org/> .\r\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r\n\r\nex:{key} rdfs:label \"{base}\" .\r\n"
      }
    }
  }
}

In an IDE

No IDE host runs this example yet.