Blame view

semantics/management/commands/import_relations.py 1.22 KB
Bartłomiej Nitoń authored
1
2
3
4
5
6
7
8
#! /usr/bin/python
# -*- coding: utf-8 -*-

from django.core.management.base import BaseCommand
from settings import PROJECT_PATH

from semantics.models import SelectivePreferenceRelations
Tomasz Bartosiak authored
9
RELATIONS = [(-1, 'RELAT'), (14, 'meronimia'), (15, 'holonimia'), (20, 'meronimia (typu część)'), (21, 'meronimia (typu porcja)'), (22, 'meronimia (typu miejsce)'), (23, 'meronimia (typu element)'), (24, 'meronimia (typu materiał)'), (25, 'holonimia (typu część)'), (26, 'holonimia (typu porcja)'), (27, 'holonimia (typu miejsce)'), (28, 'holonimia (typu element)'), (29, 'holonimia (typu materiał)'), (51, 'nosiciel stanu/cechy'), (52, 'stan/cecha'), (61, 'synonimia międzyparadygmatyczna'), (64, 'meronimia (typu element taksonomiczny)'), (65, 'holonimia (typu element taksonomiczny)'), (108, 'fuzzynimia synsetów')]
Bartłomiej Nitoń authored
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

#==========================================================#
class Command(BaseCommand):
    args = 'none'
    help = ''

    def handle(self, **options):
        import_relations()

def import_relations():
    relations = []
    for pid, name in RELATIONS:
        r = SelectivePreferenceRelations(plwn_id=pid, name=name)
        relations.append(r)

    SelectivePreferenceRelations.objects.bulk_create(relations)