source: orga_csv2rdf.py @ 13:55a5c0189778

Revision 13:55a5c0189778, 1.7 KB checked in by andre.hagenbruch@rub.de, 9 years ago (diff)

Started work for previewing PDFs as PNG slideshows and converting organisation structure from CSV to RDF.

Line 
1from platform import readlines
2#!/usr/bin/env python
3# encoding: utf-8
4
5#  The MIT License
6#
7#  Copyright 2010 Andre Hagenbruch <andre.hagenbruch@ruhr-uni-bochum.de>.
8#
9#  Permission is hereby granted, free of charge, to any person obtaining a copy
10#  of this software and associated documentation files (the "Software"), to deal
11#  in the Software without restriction, including without limitation the rights
12#  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13#  copies of the Software, and to permit persons to whom the Software is
14#  furnished to do so, subject to the following conditions:
15#
16#  The above copyright notice and this permission notice shall be included in
17#  all copies or substantial portions of the Software.
18#
19#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25#  THE SOFTWARE.
26
27__author__="Andre Hagenbruch <andre.hagenbruch@ruhr-uni-bochum.de>"
28__date__ ="$04.02.2010 20:15:22$"
29
30
31def parse_csv(filename):
32    data = open(filename, 'r').readlines()
33
34    for line in data:
35        fields = line.split('|')
36        orga_id = fields[0]
37        orga_label = fields[1]
38        fak_id = fields[6]
39        fak_label = ''
40        if fak_id is not None:
41            fak_labels = fields[8].split('; ')
42            fak_label = fak_labels[1]
43
44
45def main():
46    pass
47
48if __name__ == '__main__':
49    main()
Note: See TracBrowser for help on using the repository browser.