| author | cavaliet |
| Tue, 17 Jun 2014 10:25:33 +0200 | |
| changeset 271 | 8f77cf71ab02 |
| parent 240 | web/hdalab/models/dataviz.py@c8627191f2d7 |
| child 272 | 1c774f7a0341 |
| permissions | -rw-r--r-- |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
# -*- coding: utf-8 -*- |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
''' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
Created on Jan 27, 2012 |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
@author: ymh |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
''' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
from django.db import models |
| 123 | 8 |
from hdabo.models import Tag, Datasheet |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
class TagYears(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
tag = models.ForeignKey(Tag, related_name="years", blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
start_year = models.IntegerField(blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
end_year = models.IntegerField(blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
class TagLinks(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
subject = models.ForeignKey(Tag, blank=False, null=False, db_index=True, related_name="taglinks_subjects") |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
object = models.ForeignKey(Tag, blank=False, null=False, db_index=True, related_name="taglinks_objects") |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
|
|
122
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
29 |
class Country(models.Model): |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
30 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
31 |
dbpedia_uri = models.URLField(verify_exists=False, max_length=255, blank=False, null=False, db_index=True, unique=True) |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
32 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
33 |
class Meta: |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
34 |
app_label = 'hdalab' |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
35 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
36 |
class GeoInclusion(models.Model): |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
37 |
|
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
38 |
tag = models.OneToOneField(Tag, related_name="locatedin", db_index=True) |
|
fde8335a037c
Added Geographic Inclusion in the Django version (server only)
veltr
parents:
119
diff
changeset
|
39 |
country = models.ForeignKey(Country, blank=False, null=False, related_name="includes", db_index=True) |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
class DbpediaFields(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
dbpedia_uri = models.URLField(verify_exists=False, max_length=2048, blank=False, null=False, db_index=True, unique=False) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
tag = models.OneToOneField(Tag, blank=True, null=True, db_index=True, related_name="dbpedia_fields") |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
abstract = models.TextField(blank=True, null=True) |
| 135 | 49 |
thumbnail = models.URLField(verify_exists=False, max_length=2048, blank=True, null=True, db_index=False) |
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
label = models.CharField(max_length=2048, unique=False, blank=True, null=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
app_label = 'hdalab' |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
|
| 135 | 55 |
|
56 |
class DbpediaFieldsTranslation(models.Model): |
|
57 |
||
58 |
master = models.ForeignKey(DbpediaFields, blank=False, null=False, db_index=True, related_name="translations") |
|
59 |
language_code = models.CharField(max_length=15, blank=False, null=False, db_index=True) |
|
60 |
label = models.CharField(max_length=2048, unique=False, blank=True, null=False) |
|
61 |
abstract = models.TextField(blank=True, null=True) |
|
|
240
c8627191f2d7
add indication that the labels has been translated, and use sparql requests instead of full n3 download
ymh <ymh.work@gmail.com>
parents:
135
diff
changeset
|
62 |
is_label_translated = models.BooleanField(default=True) |
|
c8627191f2d7
add indication that the labels has been translated, and use sparql requests instead of full n3 download
ymh <ymh.work@gmail.com>
parents:
135
diff
changeset
|
63 |
is_abstract_translated = models.BooleanField(default=True) |
| 135 | 64 |
class Meta: |
65 |
app_label = 'hdalab' |
|
66 |
unique_together = ('master', 'language_code') |
|
67 |
||
68 |
||
|
119
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
69 |
class HdaSession(models.Model): |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
70 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
sessionid = models.CharField(max_length=36, unique=True, blank=False, null=False, db_index=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
data = models.TextField(blank=True, null=True) |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
|
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
class Meta: |
|
e3ebe3545f72
first implementation of django version.
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
app_label = 'hdalab' |
| 123 | 76 |
|
77 |
class InseeCoords(models.Model): |
|
78 |
||
79 |
insee = models.IntegerField(primary_key=True) |
|
80 |
city_name = models.CharField(max_length=255, blank=False, null=False) |
|
81 |
latitude = models.FloatField(blank=False, null=False) |
|
82 |
longitude = models.FloatField(blank=False, null=False) |
|
83 |
||
84 |
class Meta: |
|
85 |
app_label = 'hdalab' |
|
86 |
||
87 |
class DatasheetExtras(models.Model): |
|
88 |
||
89 |
datasheet = models.OneToOneField(Datasheet, related_name="extras", db_index=True) |
|
90 |
insee = models.ForeignKey(InseeCoords, blank=True, null=True, db_index=True) |
|
91 |
||
92 |
class Meta: |
|
93 |
app_label = 'hdalab' |