| author | ymh <ymh.work@gmail.com> |
| Fri, 30 Aug 2013 17:58:35 +0200 | |
| changeset 13 | 6296aa12fd71 |
| parent 10 | c4e7d66b7dc2 |
| child 14 | 52fa6990e0bb |
| 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): |
|
21 |
label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) |
|
22 |
acronym = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:acronym |
|
23 |
class Meta(P4lModel.Meta): |
|
24 |
unique_together = ['label', 'acronym'] |
|
25 |
||
26 |
||
27 |
class CorporateAuthor(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="corporateAuthors", db_index=True) |
| 0 | 29 |
label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) |
30 |
acronym = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:acronym |
|
31 |
||
32 |
||
33 |
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
|
34 |
record = models.ForeignKey('p4l.Record', related_name="urls", db_index=True) |
| 0 | 35 |
address = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:address |
36 |
display = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:display |
|
37 |
accessLevel = models.CharField(max_length=512, blank=True, null=True, db_index=True) #iiep:accessLevel |
|
38 |
||
39 |
||
40 |
class Subject(P4lModel): |
|
41 |
subject = models.URLField(max_length=2048, unique=True, db_index=True) |
|
| 9 | 42 |
label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 43 |
|
44 |
class Theme(P4lModel): |
|
45 |
theme = models.URLField(max_length=2048, unique=True, db_index=True) |
|
| 9 | 46 |
label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 47 |
|
48 |
||
49 |
class Country(P4lModel): |
|
50 |
country = models.URLField(max_length=2048, unique=True, db_index=True) |
|
|
10
c4e7d66b7dc2
add sparql request for languages and countries labels
cavaliet
parents:
9
diff
changeset
|
51 |
label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 52 |
|
53 |
||
54 |
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
|
55 |
record = models.ForeignKey('p4l.Record', related_name="isbns", db_index=True) |
| 0 | 56 |
isbn = models.CharField(max_length=128) #iiep:isbn |
57 |
||
58 |
||
59 |
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
|
60 |
record = models.ForeignKey('p4l.Record', related_name="issns", db_index=True) |
| 0 | 61 |
issn = models.CharField(max_length=128) #iiep:issn |
62 |
||
63 |
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
|
64 |
record = models.ForeignKey('p4l.Record', related_name="documentCodes", db_index=True) |
| 0 | 65 |
documentCode = models.CharField(max_length=128) #iiep:issn |
66 |
||
67 |
class Language(P4lModel): |
|
68 |
language = models.URLField(max_length=2048, unique=True, db_index=True) |
|
|
10
c4e7d66b7dc2
add sparql request for languages and countries labels
cavaliet
parents:
9
diff
changeset
|
69 |
label = models.CharField(max_length=2048, blank=True, null=True, db_index=True) # filled from sparql request after import |
| 0 | 70 |
|
71 |
||
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 CorporateBody(P4lModel): |
|
141 |
label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #rdfs:label |
|
142 |
acronym = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:acronym |
|
143 |
class Meta(P4lModel.Meta): |
|
144 |
unique_together = ['label','acronym'] |
|
145 |
||
146 |
class Record(P4lModel): |
|
147 |
uri = models.URLField(max_length=2048, unique=True, db_index=True) #subject |
|
| 4 | 148 |
subjects = models.ManyToManyField('p4l.Subject') #dct:subject # Thesaurus with no country |
149 |
themes = models.ManyToManyField('p4l.Theme') #iiep:theme # Theme |
|
150 |
countries = models.ManyToManyField('p4l.Country') #iiep:country # Thesaurus filtered with country only |
|
| 0 | 151 |
identifier = models.CharField(max_length=128, unique=True, db_index=True) #dct:identifier |
152 |
notes = models.TextField(blank=True, null=True) #iiep:notes |
|
153 |
#issns foreign key from Isbn #iiep:issn |
|
154 |
#isbns foreign key from Isbn #iiep:isbn |
|
155 |
#documentCodes foreign key from Isbn #iiep:documentCode |
|
| 4 | 156 |
language = models.ForeignKey('p4l.Language', blank=True, null=True) #dct:language # Language |
157 |
otherLanguages = models.ManyToManyField('p4l.Language', related_name='otherLanguage_record') #iiep:otherLanguage # Language |
|
| 0 | 158 |
#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
|
159 |
#abstracts foreign Key from Abstract #dct:abstract |
| 0 | 160 |
#addedTitles foreign Key from AddedTitle #iiep:addedTitle |
161 |
#titlesMainDocument foreign Key from TitleMainDocument #iiep:titleMainDocument |
|
162 |
editionStatement = models.CharField(max_length=1024, blank=True, null=True) #iiep:editionStatement |
|
163 |
#imprints foreign Key from Imprint #iiep:imprint |
|
164 |
#collations = foreign Key from Collation #iiep:collation |
|
165 |
#volumeIssues = foreign Key from VolumeIssue #iiep:volumeIssue |
|
166 |
projectNames = models.ManyToManyField('p4l.ProjectName') #iiep:projectName |
|
|
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 |
#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
|
168 |
#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
|
169 |
#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
|
170 |
#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
|
171 |
#subjectPersons = foreign key from 'p4l.SubjectPerson' #iiep:subjectPerson |
| 4 | 172 |
subjectCorporateBodies = models.ManyToManyField('p4l.CorporateBody') #iiep:subjectCorporateBody # Organisation ? |
|
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
|
173 |
#subjectMeetings = foreign key from 'p4l.SubjectMeeting' #iiep:subjectMeeting |
|
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
|
174 |
#corporateAuthors = foreign key from 'p4l.CorporateAuthor' #iiep:corporateAuthor # Organisation ? |
| 0 | 175 |
#urls foreign Key from Url #iiep:url |
176 |
recordType = models.URLField(max_length=2048) #dct:type |
|
177 |
isDocumentPart = models.BooleanField() #iiep:isDocumentPart |
|
178 |
||
179 |
def __unicode__(self): |
|
180 |
return "Record id %s { identifier: %s, uri: %s, editionStatement: %s, recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \ |
|
181 |
% ( |
|
182 |
self.id, |
|
183 |
self.identifier, |
|
184 |
self.uri, |
|
185 |
self.editionStatement, |
|
186 |
self.recordType, |
|
187 |
self.isDocumentPart, |
|
188 |
self.notes[:100] if self.notes else None, |
|
189 |
self.language.id if self.language else None |
|
190 |
) |
|
191 |
||
192 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}issn', 3) |
|
193 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}documentCode', 3) |
|
194 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}country', 44) |
|
195 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}imprint', 5) |
|
196 |
#('{http://purl.org/dc/terms/}title', 4) |
|
197 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isDocumentPart', 1) |
|
198 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}notes', 1) |
|
199 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isbn', 8) |
|
200 |
#('{http://purl.org/dc/terms/}identifier', 1) |
|
201 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}meeting', 4) |
|
202 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}projectName', 10) |
|
203 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}addedTitle', 18) |
|
204 |
#('{http://purl.org/dc/terms/}subject', 29) |
|
205 |
#('{http://purl.org/dc/terms/}language', 1) |
|
206 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}serie', 4) |
|
207 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}volumeIssue', 3) |
|
208 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}url', 20) |
|
209 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}titleMainDocument', 3) |
|
210 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}otherLanguage', 13) |
|
211 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}periodical', 3) |
|
212 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}editionStatement', 1) |
|
213 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}collation', 4) |
|
214 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectMeeting', 6) |
|
215 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}corporateAuthor', 7) |
|
216 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}author', 26) |
|
217 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectPerson', 2) |
|
218 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectCorporateBody', 8) |
|
219 |
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}theme', 6) |
|
220 |
#('{http://purl.org/dc/terms/}abstract', 3) |
|
221 |
#('{http://purl.org/dc/terms/}type', 1) |