The Devel class

class ferenda.Devel(**kwargs)

This module acts as a docrepo (and as such is easily callable from, but instead of download, parse, generate et al, contains various tool commands that is useful for developing and debugging your own docrepo classes.

Use it by first enabling it:

./ ferenda.Devel enable

And then run individual tools like:

./ devel dumprdf path/to/xhtml/rdfa.xhtml

Create an inventory of documents, as a CSV file. Only documents that have been parsed and yielded some minimum amount of RDF metadata will be included.

Parameters:alias (str) – Docrepo alias
dumprdf(filename, format=u'turtle')

Extract all RDF data from a parsed file and dump it to stdout.



./ devel dumprdf path/to/xhtml/rdfa.xhtml nt

Extract all RDF data from the system triplestore and dump it to stdout using the specified format.

Parameters:format (str) – The serialization format for RDF data (same as for ferenda.TripleStore.get_serialized()).


./ devel dumpstore nt > alltriples.nt
fsmparse(functionname, source)

Parse a list of text chunks using a named fsm parser and output the parse tree and final result to stdout.

  • functionname (str) – A function that returns a configured FSMParser
  • source (str) – A file containing the text chunks, separated by double newlines
mkpatch(alias, basefile, description)

Create a patch file from downloaded or intermediate files. Before running this tool, you should hand-edit the intermediate file. If your docrepo doesn’t use intermediate files, you should hand-edit the downloaded file instead. The tool will first stash away the intermediate (or downloaded) file, then re-run parse() (or download_single()) in order to get a new intermediate (or downloaded) file. It will then calculate the diff between these two versions and save it as a patch file in it’s proper place (as determined by config.patchdir), where it will be picked up automatically by patch_if_needed().

  • alias (str) – Docrepo alias
  • basefile (str) – The basefile for the document to patch


./ devel mkpatch myrepo basefile1 "Removed sensitive personal information"
parsestring(string, citationpattern, uriformatter=None)

Parse a string using a named citationpattern and print parse tree and optionally formatted uri(s) on stdout.

  • string (str) – The text to parse
  • citationpattern (str) – The fully qualified name of a citationpattern
  • uriformatter (str) – The fully qualified name of a uriformatter


This is not implemented yet


./ devel parsestring \
    "According to direktiv 2007/42/EU, ..." \

Query the system fulltext index and return the IDs/URIs for matching documents.

Parameters:querystring (str) – The query