The Devel class¶
- class ferenda.Devel(**kwargs)¶
This module acts as a docrepo (and as such is easily callable from ferenda-manager.py), 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-build.py ferenda.Devel enable
And then run individual tools like:
./ferenda-build.py 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.
./ferenda-build.py 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()).
./ferenda-build.py 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.
- 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().
./ferenda-build.py 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.
This is not implemented yet
./ferenda-build.py devel parsestring \ "According to direktiv 2007/42/EU, ..." \ ferenda.citationpatterns.eulaw