[librecat-dev] unable to import departments using documented methods
Jonathan NORRIS
jnorris at ist.ac.at
Wed Jan 31 16:19:42 CET 2018
Yes this was the issue. Thanks, everything imported correctly.
Jonathan
On 01/31/2018 02:53 PM, Patrick Hochstenbach wrote:
> Hi Jonathan
>
> The syntax is correct. The “# Tree.yml” on top of your YAML file is too much and shouldn’t be there (I deleted this line in the Wiki page).
> With this file you can:
>
> $ bin/librecat department tree /tmp/your.file.yml
> $ make generate
>
> and look at the results at: http://localhost:5001/department
>
> Cheers
> Patrick
>
>> On 31 Jan 2018, at 14:10, Jonathan NORRIS <jnorris at ist.ac.at> wrote:
>>
>> Hello,
>>
>> I am trying to import departments into librecat using the methods documented here: https://github.com/LibreCat/LibreCat/wiki/Import-Departments
>>
>> First I tried using the 'tree' method but it did not work. My yaml syntax looks good and I even tried to do an import of the example in the documentation:
>>
>> # Tree.yml
>> ---
>> tree:
>> GUK:
>> name: Global Campus Korea
>> display: Global Campus Korea (GUK)
>> tree:
>> KR01:
>> name: Department of Environmental Technology, Food Technology and Molecular Biotechnology
>> display: Department of Environmental Technology, Food Technology and Molecular Biotechnology (KR01)
>> KR71:
>> name: Admissions and enrollment office
>> display: Admissions and enrollment office (KR71)
>> KR73:
>> name: Recruitment office
>> display: Recruitment office (KR73)
>> ...
>>
>>
>>
>> I added the above to a file called test_import.yml and ran 'bin/librecat department tree /path/to/test_import.yml', but nothing was imported.
>>
>> Looking into the code, in 'LibreCat/Cmd/department.pm':
>>
>> from line 150, in sub _tree_parse:
>>
>> my $importer = Catmandu->importer('YAML', file => $file);
>> my $HASH = $importer->first;
>> my $helper = LibreCat::App::Helper::Helpers->new;
>>
>> print "$HASH \n";
>>
>> My print statement gives the error: Use of uninitialized value $HASH in concatenation (.) or string
>>
>> So the problem seems to be in the Catmandu importer, but I don't know were to begin looking for the problem in there.
>>
>>
>> Second I tried importing using the other format:
>>
>> ---
>> _id: KR73
>> name: Recruitment office
>> display: Recruitment office (KR73)
>> layer: 2
>> tree:
>> - _id: GUK
>> ...
>>
>>
>> I tried this:
>>
>> ---
>> _id: IST
>> name: IST Austria
>> display: IST Austria
>> layer: 1
>> ---
>> _id: Barton
>> name: Barton
>> display: Barton Group
>> layer: 2
>> tree:
>> - _id: IST
>> ...
>>
>> But only the Barton group is inserted and I get this message:
>>
>> IST
>> ERROR: not a valid department
>> /tree: Missing property.
>> added Barton
>>
>> And in the interface Barton is under a node named '0'.
>>
>> I've tried a lot of different variations of the format above trying to have IST as my root node with Barton underneath it but could not achieve this, I could only get them to exist at the same level or to both exist under two separate nodes called '0'.
>>
>> I would have thought you would need no 'tree' attribute when defining a root note but I get the 'missing property' error whenever it is left out.
>>
>>
>> Can anyone give me some advice on what to do here? It would be great if the 'tree' import worked as I already have a full representation of our organization in this format.
>>
>> Thanks,
>> Jonathan Norris,
>> IST Austria
>>
>>
>> _______________________________________________
>> librecat-dev mailing list
>> - send list mails to librecat-dev at lists.uni-bielefeld.de
>> - to unsubscribe or change options, visit https://lists.uni-bielefeld.de/mailman2/cgi/unibi/listinfo/librecat-dev
>> - project website: http://librecat.org/
More information about the librecat-dev
mailing list