src/p4l/models/data.py
author ymh <ymh.work@gmail.com>
Fri, 20 Sep 2013 00:03:31 +0200
changeset 101 71532a54d1c4
parent 77 15b34232100d
child 102 53c9233a7684
permissions -rw-r--r--
update virtualenv + implement record serialization
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
from django.db import models
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
from p4l.models.common import P4lModel, P4lModelLang
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
class Imprint(P4lModelLang):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
    record = models.ForeignKey('p4l.Record', related_name="imprints")
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
    imprintCity = models.CharField(max_length=512, blank=True, null=True, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    publisher = models.CharField(max_length=512, blank=True, null=True, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    imprintDate = models.CharField(max_length=512, blank=True, null=True, db_index=True)    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    14
class Serie(P4lModelLang):
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    15
    record = models.ForeignKey('p4l.Record', related_name="series")
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    title = models.CharField(max_length=2048, blank=False, null=False, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    volume = models.CharField(max_length=2048, blank=True, null=True, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
class ProjectName(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    21
    uri = models.URLField(max_length=2048, unique=True, db_index=True) 
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
class CorporateAuthor(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    25
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
class Url(P4lModel):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    28
    record = models.ForeignKey('p4l.Record', related_name="urls", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
    address = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:address
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
    display = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:display
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    accessLevel = models.CharField(max_length=512, blank=True, null=True, db_index=True) #iiep:accessLevel
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
class Subject(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    35
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
class Theme(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    38
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
class Country(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    42
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
class Isbn(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    46
    record = models.ForeignKey('p4l.Record', related_name="isbns", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
    isbn = models.CharField(max_length=128) #iiep:isbn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
class Issn(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    51
    record = models.ForeignKey('p4l.Record', related_name="issns", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
    issn = models.CharField(max_length=128) #iiep:issn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
class DocumentCode(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    55
    record = models.ForeignKey('p4l.Record', related_name="documentCodes", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
    documentCode = models.CharField(max_length=128) #iiep:issn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
class Language(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    59
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
class BaseTitle(P4lModelLang):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
    title = models.CharField(max_length=2048, blank=False, null=False, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
    class Meta(P4lModelLang.Meta):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
        abstract = True
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
class Title(BaseTitle):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    67
    record = models.ForeignKey('p4l.Record', related_name="titles", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
class AddedTitle(BaseTitle):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    70
    record = models.ForeignKey('p4l.Record', related_name="addedTitles", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
class TitleMainDocument(BaseTitle):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    73
    record = models.ForeignKey('p4l.Record', related_name="titlesMainDocument", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
class Abstract(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    77
    record = models.ForeignKey('p4l.Record', related_name="abstracts", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
    abstract = models.TextField(blank=True, null=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
class Collation(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    82
    record = models.ForeignKey('p4l.Record', related_name="collations", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
    collation = models.CharField(max_length=1024, blank=False, null=False, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
class VolumeIssue(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    87
    record = models.ForeignKey('p4l.Record', related_name="volumeIssues", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
    volume = models.CharField(max_length=1024, blank=True, null=True, db_index=True) #iiep:volume
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
    number = models.CharField(max_length=1024, blank=True, null=True, db_index=True) #iiep:number
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
class P4lPerson(P4lModel):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    93
    name = models.CharField(max_length=2048, blank=False, null=False, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
    class Meta(P4lModel.Meta):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
        abstract = True
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
class Author(P4lPerson):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    99
    record = models.ForeignKey('p4l.Record', related_name="authors", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
class SubjectPerson(P4lPerson):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   102
    record = models.ForeignKey('p4l.Record', related_name="subjectPersons", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   104
class Periodical(P4lModelLang):
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   105
    record = models.ForeignKey('p4l.Record', related_name="periodicals", db_index=True)
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   106
    label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:periodical
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
class BaseMeeting(P4lModel):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
    label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #rdfs:label
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
    meetingNumber = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingNumber
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
    meetingPlace = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingPlace
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
    meetingDate = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingDate
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
    meetingYear = models.PositiveSmallIntegerField(blank=True, null=True, db_index=True) #iiep:meetingYear
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
    class Meta(P4lModel.Meta):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
        abstract = True
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
class Meeting(BaseMeeting):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   120
    lang = models.CharField(max_length=15, blank=True, null=True, db_index=True) #@xml:lang
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   121
    record = models.ForeignKey('p4l.Record', related_name="meetings")
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
class SubjectMeeting(BaseMeeting):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   125
    record = models.ForeignKey('p4l.Record', related_name="subjectMeetings", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
class Record(P4lModel):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
    uri = models.URLField(max_length=2048, unique=True, db_index=True) #subject
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   130
    subjects = models.ManyToManyField('p4l.Subject') #dct:subject                                                       # <Thesaurus> with no country
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   131
    themes = models.ManyToManyField('p4l.Theme') #iiep:theme                                                            # <Themes>
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   132
    countries = models.ManyToManyField('p4l.Country') #iiep:country                                                     # <Thesaurus> filtered with country only
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
    identifier = models.CharField(max_length=128, unique=True, db_index=True) #dct:identifier    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
    notes = models.TextField(blank=True, null=True) #iiep:notes    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
    #issns foreign key from Isbn #iiep:issn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
    #isbns foreign key from Isbn #iiep:isbn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
    #documentCodes foreign key from Isbn #iiep:documentCode
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   138
    language = models.ForeignKey('p4l.Language', blank=True, null=True) #dct:language                                    # <Languages>
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   139
    otherLanguages = models.ManyToManyField('p4l.Language', related_name='otherLanguage_record') #iiep:otherLanguage     # <Languages>
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
    #titles foreign Key from Title #dct:title
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   141
    #abstracts foreign Key from Abstract #dct:abstract
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
    #addedTitles foreign Key from AddedTitle #iiep:addedTitle
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
    #titlesMainDocument foreign Key from TitleMainDocument #iiep:titleMainDocument
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
    editionStatement = models.CharField(max_length=1024, blank=True, null=True) #iiep:editionStatement
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
    #imprints foreign Key from Imprint #iiep:imprint
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
    #collations = foreign Key from Collation #iiep:collation
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
    #volumeIssues = foreign Key from VolumeIssue #iiep:volumeIssue
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   148
    projectNames = models.ManyToManyField('p4l.ProjectName') #iiep:projectName                                            # <Projects>
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   149
    #periodicals = foreign key from 'p4l.Periodical' #iiep:periodical
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   150
    #meetings = foreign key from 'p4l.Meeting' #iiep:meeting
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   151
    #series = foreign key from 'p4l.Serie'  #iiep:serie
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   152
    #authors = foreign key from 'p4l.Author' #iiep:author
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   153
    #subjectPersons = foreign key from 'p4l.SubjectPerson' #iiep:subjectPerson
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   154
    subjectCorporateBodies = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsSubjectCorporateBody') #iiep:subjectCorporateBody # <Organizations>
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   155
    #subjectMeetings = foreign key from 'p4l.SubjectMeeting' #iiep:subjectMeeting
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   156
    corporateAuthors = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsCorporateAuthor') #iiep:subjectCorporateBody # <Organizations>
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
    #urls foreign Key from Url #iiep:url
62
8433e12362e0 angular for simple sparql and checkbox. Languages updated
cavaliet
parents: 19
diff changeset
   158
    recordType = models.URLField(max_length=2048) #dct:type                                                                # <DocumentType>
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
   159
    
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
    isDocumentPart = models.BooleanField() #iiep:isDocumentPart
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
   161
    isMultilingual = models.BooleanField() #iiep:isMultilingual
75
eb6530b77b0e Add years in list view
ymh <ymh.work@gmail.com>
parents: 62
diff changeset
   162
    
eb6530b77b0e Add years in list view
ymh <ymh.work@gmail.com>
parents: 62
diff changeset
   163
    def get_imprints_years(self):
77
15b34232100d Make sure we do not takes null or empty values
ymh <ymh.work@gmail.com>
parents: 76
diff changeset
   164
        return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
    def __unicode__(self):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
        return "Record id %s { identifier: %s, uri: %s, editionStatement: %s,  recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
            % (
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
                self.id,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
                self.identifier,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
                self.uri,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
                self.editionStatement,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
                self.recordType,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
                self.isDocumentPart,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
                self.notes[:100] if self.notes else None,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
                self.language.id if self.language else None
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
            )
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}issn', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}documentCode', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}country', 44)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}imprint', 5)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
#('{http://purl.org/dc/terms/}title', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isDocumentPart', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}notes', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isbn', 8)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
#('{http://purl.org/dc/terms/}identifier', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}meeting', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}projectName', 10)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}addedTitle', 18)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
#('{http://purl.org/dc/terms/}subject', 29)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
#('{http://purl.org/dc/terms/}language', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}serie', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}volumeIssue', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}url', 20)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}titleMainDocument', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}otherLanguage', 13)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}periodical', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}editionStatement', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}collation', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectMeeting', 6)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}corporateAuthor', 7)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}author', 26)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectPerson', 2)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectCorporateBody', 8)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}theme', 6)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
#('{http://purl.org/dc/terms/}abstract', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
#('{http://purl.org/dc/terms/}type', 1)