Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: projects / idan / manual / 03-statements /

04-ff-blocks.mdwn

[[!meta title=“3.4 | Free-Form Blocks”]]

Free-Form Blocks

Free-form blocks or FFBlocks or FFBs are one kind of blocks in Idan. Blocks allow to group related statements in a hierarchy form while avoiding repetition. Statements are then grouped by subject, somewhat like rules in Prolog can be grouped by relation (although Idan also adds “refactoring” of common parts to the grouping).

The only difference between the two kinds of blocks is syntax - the semantics are exactly the same. The second kind of blocks is introduced in the next section.

The general structure of a statement block is as follows. It begins with a subject. Then comes a list of predicate sections. Each section begins with a predicate, followed by a list of subject-identifier pairs. As usual, the identifier is optional.

All the statements expressed by the block have the same subject. Each section block expresses a set of statements which all share the same predicate. Instead of writing the same subjects predicates multiple times, they are written just once.

In free-form blocks, and syntactic tool used for separating the parts of a blocks is punctuation marks. Semicolons separate the predicate sections. Commas separate the subject-identifier pairs. And a free-form block must end with a period.

In free-form blocks, the use of whitespace and indentation has no semantic significance. The example below contains some indentation for clarity, but it isn’t required by the syntax. First, consider the following statements, which aren’t a block:

<%> myns:has_name       "John Doe"
#^  myns:uses_gnu_linux true
#^  myns:uses_gnu_hurd  true
#^  myns:uses_distro    myns:trisquel
#^  myns:uses_distro    myns:parabola
#^  myns:uses_distro    myns:gnewsense
#^  myns:uses_losedows  false

These statements can be written as a single block:

<%> myns:has_name "John Doe" ;
    myns:uses_gnu_linux true ;
    myns:uses_gnu_hurd true ;
    myns:uses_distro myns:trisquel, myns:parabola, myns:gnewsense ;
    myns:uses_losedows false .
[See repo JSON]