| author | cavaliet |
| Mon, 02 Sep 2013 16:40:28 +0200 | |
| changeset 19 | 6b45fd23e4a0 |
| parent 17 | b31a67614f76 |
| child 62 | 8433e12362e0 |
| permissions | -rw-r--r-- |
| 0 | 1 |
# -*- coding: utf-8 -*- |
2 |
||
3 |
from django.db import models |
|
4 |
from p4l.models.common import P4lModel, P4lModelLang |
|
5 |
||
6 |
||
7 |
class Imprint(P4lModelLang): |
|
8 |
record = models.ForeignKey('p4l.Record', related_name="imprints") |
|
9 |
imprintCity = models.CharField(max_length=512, blank=True, null=True, db_index=True) |
|
10 |
publisher = models.CharField(max_length=512, blank=True, null=True, db_index=True) |
|
11 |
imprintDate = models.CharField(max_length=512, blank=True, null=True, db_index=True) |
|
12 |
||
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 | 16 |
title = models.CharField(max_length=2048, blank=False, null=False, db_index=True) |
17 |
volume = models.CharField(max_length=2048, blank=True, null=True, db_index=True) |
|
18 |
||
19 |
||
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) |
| 19 | 22 |
# label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) |
23 |
# acronym = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:acronym # |
|
24 |
# class Meta(P4lModel.Meta): |
|
25 |
# unique_together = ['label', 'acronym'] |
|
| 0 | 26 |
|
27 |
||
28 |
class CorporateAuthor(P4lModel): |
|
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
29 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) |
| 19 | 30 |
# label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) |
31 |
# acronym = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:acronym |
|
32 |
# class Meta(P4lModel.Meta): |
|
33 |
# unique_together = ['label','acronym'] |
|
| 0 | 34 |
|
35 |
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
|
36 |
record = models.ForeignKey('p4l.Record', related_name="urls", db_index=True) |
| 0 | 37 |
address = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:address |
38 |
display = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:display |
|
39 |
accessLevel = models.CharField(max_length=512, blank=True, null=True, db_index=True) #iiep:accessLevel |
|
40 |
||
41 |
||
42 |
class Subject(P4lModel): |
|
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
43 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) |
| 19 | 44 |
#label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 45 |
|
46 |
class Theme(P4lModel): |
|
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
47 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) |
| 19 | 48 |
#label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 49 |
|
50 |
||
51 |
class Country(P4lModel): |
|
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
52 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) |
| 19 | 53 |
#label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 54 |
|
55 |
||
56 |
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
|
57 |
record = models.ForeignKey('p4l.Record', related_name="isbns", db_index=True) |
| 0 | 58 |
isbn = models.CharField(max_length=128) #iiep:isbn |
59 |
||
60 |
||
61 |
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
|
62 |
record = models.ForeignKey('p4l.Record', related_name="issns", db_index=True) |
| 0 | 63 |
issn = models.CharField(max_length=128) #iiep:issn |
64 |
||
65 |
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
|
66 |
record = models.ForeignKey('p4l.Record', related_name="documentCodes", db_index=True) |
| 0 | 67 |
documentCode = models.CharField(max_length=128) #iiep:issn |
68 |
||
69 |
class Language(P4lModel): |
|
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
70 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) |
| 19 | 71 |
#label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 72 |
|
73 |
class BaseTitle(P4lModelLang): |
|
74 |
title = models.CharField(max_length=2048, blank=False, null=False, db_index=True) |
|
75 |
class Meta(P4lModelLang.Meta): |
|
76 |
abstract = True |
|
77 |
||
78 |
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
|
79 |
record = models.ForeignKey('p4l.Record', related_name="titles", db_index=True) |
| 0 | 80 |
|
81 |
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
|
82 |
record = models.ForeignKey('p4l.Record', related_name="addedTitles", db_index=True) |
| 0 | 83 |
|
84 |
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
|
85 |
record = models.ForeignKey('p4l.Record', related_name="titlesMainDocument", db_index=True) |
| 0 | 86 |
|
87 |
||
88 |
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
|
89 |
record = models.ForeignKey('p4l.Record', related_name="abstracts", db_index=True) |
| 0 | 90 |
abstract = models.TextField(blank=True, null=True) |
91 |
||
92 |
||
93 |
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
|
94 |
record = models.ForeignKey('p4l.Record', related_name="collations", db_index=True) |
| 0 | 95 |
collation = models.CharField(max_length=1024, blank=False, null=False, db_index=True) |
96 |
||
97 |
||
98 |
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
|
99 |
record = models.ForeignKey('p4l.Record', related_name="volumeIssues", db_index=True) |
| 0 | 100 |
volume = models.CharField(max_length=1024, blank=True, null=True, db_index=True) #iiep:volume |
101 |
number = models.CharField(max_length=1024, blank=True, null=True, db_index=True) #iiep:number |
|
102 |
||
103 |
||
104 |
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
|
105 |
name = models.CharField(max_length=2048, blank=False, null=False, db_index=True) |
| 0 | 106 |
class Meta(P4lModel.Meta): |
107 |
abstract = True |
|
108 |
||
109 |
||
110 |
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
|
111 |
record = models.ForeignKey('p4l.Record', related_name="authors", db_index=True) |
| 0 | 112 |
|
113 |
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
|
114 |
record = models.ForeignKey('p4l.Record', related_name="subjectPersons", db_index=True) |
| 0 | 115 |
|
|
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
|
116 |
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
|
117 |
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
|
118 |
label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:periodical |
| 0 | 119 |
|
120 |
||
121 |
class BaseMeeting(P4lModel): |
|
122 |
label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #rdfs:label |
|
123 |
meetingNumber = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingNumber |
|
124 |
meetingPlace = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingPlace |
|
125 |
meetingDate = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingDate |
|
126 |
meetingYear = models.PositiveSmallIntegerField(blank=True, null=True, db_index=True) #iiep:meetingYear |
|
127 |
class Meta(P4lModel.Meta): |
|
128 |
abstract = True |
|
129 |
||
130 |
||
131 |
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
|
132 |
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
|
133 |
record = models.ForeignKey('p4l.Record', related_name="meetings") |
| 0 | 134 |
|
135 |
||
136 |
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
|
137 |
record = models.ForeignKey('p4l.Record', related_name="subjectMeetings", db_index=True) |
| 0 | 138 |
|
139 |
||
140 |
class Record(P4lModel): |
|
141 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) #subject |
|
| 17 | 142 |
subjects = models.ManyToManyField('p4l.Subject') #dct:subject # <Thesaurus> with no country |
143 |
themes = models.ManyToManyField('p4l.Theme') #iiep:theme # <Themes> |
|
144 |
countries = models.ManyToManyField('p4l.Country') #iiep:country # <Thesaurus> filtered with country only |
|
| 0 | 145 |
identifier = models.CharField(max_length=128, unique=True, db_index=True) #dct:identifier |
146 |
notes = models.TextField(blank=True, null=True) #iiep:notes |
|
147 |
#issns foreign key from Isbn #iiep:issn |
|
148 |
#isbns foreign key from Isbn #iiep:isbn |
|
149 |
#documentCodes foreign key from Isbn #iiep:documentCode |
|
| 17 | 150 |
language = models.ForeignKey('p4l.Language', blank=True, null=True) #dct:language # <Languages> |
151 |
otherLanguages = models.ManyToManyField('p4l.Language', related_name='otherLanguage_record') #iiep:otherLanguage # <Languages> |
|
| 0 | 152 |
#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
|
153 |
#abstracts foreign Key from Abstract #dct:abstract |
| 0 | 154 |
#addedTitles foreign Key from AddedTitle #iiep:addedTitle |
155 |
#titlesMainDocument foreign Key from TitleMainDocument #iiep:titleMainDocument |
|
156 |
editionStatement = models.CharField(max_length=1024, blank=True, null=True) #iiep:editionStatement |
|
157 |
#imprints foreign Key from Imprint #iiep:imprint |
|
158 |
#collations = foreign Key from Collation #iiep:collation |
|
159 |
#volumeIssues = foreign Key from VolumeIssue #iiep:volumeIssue |
|
| 17 | 160 |
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
|
161 |
#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
|
162 |
#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
|
163 |
#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
|
164 |
#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
|
165 |
#subjectPersons = foreign key from 'p4l.SubjectPerson' #iiep:subjectPerson |
| 17 | 166 |
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
|
167 |
#subjectMeetings = foreign key from 'p4l.SubjectMeeting' #iiep:subjectMeeting |
| 17 | 168 |
corporateAuthors = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsCorporateAuthor') #iiep:subjectCorporateBody # <Organizations> |
| 0 | 169 |
#urls foreign Key from Url #iiep:url |
170 |
recordType = models.URLField(max_length=2048) #dct:type |
|
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
171 |
|
| 0 | 172 |
isDocumentPart = models.BooleanField() #iiep:isDocumentPart |
|
14
52fa6990e0bb
adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents:
13
diff
changeset
|
173 |
isMultilingual = models.BooleanField() #iiep:isMultilingual |
| 0 | 174 |
|
175 |
def __unicode__(self): |
|
176 |
return "Record id %s { identifier: %s, uri: %s, editionStatement: %s, recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \ |
|
177 |
% ( |
|
178 |
self.id, |
|
179 |
self.identifier, |
|
180 |
self.uri, |
|
181 |
self.editionStatement, |
|
182 |
self.recordType, |
|
183 |
self.isDocumentPart, |
|
184 |
self.notes[:100] if self.notes else None, |
|
185 |
self.language.id if self.language else None |
|
186 |
) |
|
187 |
||
188 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}issn', 3) |
|
189 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}documentCode', 3) |
|
190 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}country', 44) |
|
191 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}imprint', 5) |
|
192 |
#('{http://purl.org/dc/terms/}title', 4) |
|
193 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isDocumentPart', 1) |
|
194 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}notes', 1) |
|
195 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isbn', 8) |
|
196 |
#('{http://purl.org/dc/terms/}identifier', 1) |
|
197 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}meeting', 4) |
|
198 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}projectName', 10) |
|
199 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}addedTitle', 18) |
|
200 |
#('{http://purl.org/dc/terms/}subject', 29) |
|
201 |
#('{http://purl.org/dc/terms/}language', 1) |
|
202 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}serie', 4) |
|
203 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}volumeIssue', 3) |
|
204 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}url', 20) |
|
205 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}titleMainDocument', 3) |
|
206 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}otherLanguage', 13) |
|
207 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}periodical', 3) |
|
208 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}editionStatement', 1) |
|
209 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}collation', 4) |
|
210 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectMeeting', 6) |
|
211 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}corporateAuthor', 7) |
|
212 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}author', 26) |
|
213 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectPerson', 2) |
|
214 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectCorporateBody', 8) |
|
215 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}theme', 6) |
|
216 |
#('{http://purl.org/dc/terms/}abstract', 3) |
|
217 |
#('{http://purl.org/dc/terms/}type', 1) |