[rfc-i] An RFC database in Prolog

Marc Petit-Huguenin marc at petit-huguenin.org
Fri Aug 27 04:32:53 PDT 2021


On 8/27/21 4:14 AM, Michael Richardson wrote:
> Marc Petit-Huguenin <marc at petit-huguenin.org> wrote:
>      > I have been working on a Prolog database that would permit to do
>      > various queries on RFC metadata and on Errata.
> 
> Can you give us some examples to wet our appetite?

Here's one that exports the errata database as a CSV file:

[source,prolog]
----
:- import format/2 from format.
:- [errata].
:- [rfcs].

month(1, 'January').
month(2, 'February').
month(3, 'March').
month(4, 'April').
month(5, 'May').
month(6, 'June').
month(7, 'July').
month(8, 'August').
month(9, 'September').
month(10, 'October').
month(11, 'November').
month(12, 'December').

:- erratum(Id, Formats, Rfc, Reporter, Date, Type, Status),
    rfc(Rfc, Title, _, _, _, date(Y, M), Wg, Area, _),
    month(M, MM),
    functor(Status, S, _),
    format("\"RFC~d\", \"~a\", \"~a ~d\", \"~a\"~n", [Rfc, Title, MM, Y, S]),
    fail.
----

Another that lists all the RFCs that changed status:

[source,prolog]
----
:- import format/2 from format.
:- [metadata].
:- [rfcs].

:- rfc(Rfc, Title, _, Status, _, _, _, _, _),
    metadatum(Rfc, Status2), Status \= Status2,
    format("RFC~d ~a from ~a to ~a~n", [Rfc, Title, Status, Status2]),
    fail.
----

Just copy the one of the content above (between the "----") in a file with the ".P" extension, then you just have to `xsb <file>` (without the .P extension) to run it.

This is code, so the possibilities are endless.

> 
> Does this system know why RFC8990 took 4.5 years to publish, for instance?

Not with the current database, as that would require to add the content of the datatracker database in it.

The table I am currently preparing is the reference table, which looks like this:

:- auto_table.

[source,prolog]
----
reference(9047, 'Normative', rfc(2119)).
reference(9047, 'Normative', rfc(4861)).
reference(9047, 'Normative', rfc(7432)).
reference(9047, 'Normative', rfc(8174)).
reference(9047, 'Informative', i-d('draft-rbickhart-evpn-ip-mac-proxy-adv-01')).
reference(9047, 'Informative', i-d('draft-ietf-bess-evpn-irb-extended-mobility-05')).
reference(9047, 'Informative', iana('bgp-extended-communities')).
reference(9047, 'Informative', rfc(8126)).
...
----

After that I was thinking of adding a table for IPR declarations but, time permitting, I can work on other content.

-- 
Marc Petit-Huguenin
Email: marc at petit-huguenin.org
Blog: https://marc.petit-huguenin.org
Profile: https://www.linkedin.com/in/petithug


More information about the rfc-interest mailing list