Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ValUnifer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IPIPAN
ValUnifer
Commits
9251999b
Commit
9251999b
authored
2 years ago
by
dcz
Browse files
Options
Downloads
Patches
Plain Diff
unifier first models
parent
e785df5b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
unifier/__init__.py
+0
-0
0 additions, 0 deletions
unifier/__init__.py
unifier/models.py
+104
-0
104 additions, 0 deletions
unifier/models.py
with
104 additions
and
0 deletions
unifier/__init__.py
0 → 100644
+
0
−
0
View file @
9251999b
This diff is collapsed.
Click to expand it.
unifier/models.py
0 → 100644
+
104
−
0
View file @
9251999b
from
django.db
import
models
from
meanings.models
import
LexicalUnit
,
Synset
class
UnifiedLexicalUnitCluster
(
models
.
Model
):
lexical_units
=
models
.
ManyToManyField
(
LexicalUnit
,
related_name
=
'
UnifiedLexicalUnitCluster
'
)
def
__str__
(
self
):
return
'
%s: %s
'
%
(
self
.
opinion
,
'
+
'
.
join
([
str
(
arg
)
for
arg
in
self
.
sorted_arguments
()]))
class
UnifiedFrameStatus
(
models
.
Model
):
status
=
models
.
CharField
(
max_length
=
20
)
def
__str__
(
self
):
return
self
.
status
class
UnifiedFrame
(
models
.
Model
):
unified_lexical_unit_cluster
=
models
.
ForeignKey
(
UnifiedLexicalUnitCluster
,
on_delete
=
models
.
PROTECT
)
status
=
models
.
ForeignKey
(
UnifiedFrameStatus
,
on_delete
=
models
.
PROTECT
)
arguments_count
=
models
.
PositiveIntegerField
(
null
=
False
,
default
=
0
)
def
sorted_arguments
(
self
):
# TODO: zaimplementowac wlasciwe sortowanie
return
Argument
.
objects
.
filter
(
frame
=
self
)
def
__str__
(
self
):
return
'
%s: %s
'
%
(
self
.
opinion
,
'
+
'
.
join
([
str
(
arg
)
for
arg
in
self
.
sorted_arguments
()]))
class
Argument
(
models
.
Model
):
role
=
models
.
ForeignKey
(
'
ArgumentRole
'
,
on_delete
=
models
.
PROTECT
)
predefined
=
models
.
ManyToManyField
(
'
PredefinedSelectionalPreference
'
)
synsets
=
models
.
ManyToManyField
(
Synset
)
relations
=
models
.
ManyToManyField
(
'
RelationalSelectionalPreference
'
)
frame
=
models
.
ForeignKey
(
Frame
,
related_name
=
'
arguments
'
,
on_delete
=
models
.
PROTECT
)
preferences_count
=
models
.
PositiveIntegerField
(
null
=
False
,
default
=
0
)
def
__str__
(
self
):
return
str
(
self
.
role
)
class
ArgumentRole
(
models
.
Model
):
role
=
models
.
ForeignKey
(
'
SemanticRole
'
,
on_delete
=
models
.
PROTECT
)
attribute
=
models
.
ForeignKey
(
'
RoleAttribute
'
,
null
=
True
,
on_delete
=
models
.
PROTECT
)
def
__str__
(
self
):
if
self
.
attribute
is
None
:
return
str
(
self
.
role
)
else
:
return
'
{}, {}
'
.
format
(
str
(
self
.
role
),
str
(
self
.
attribute
))
class
SemanticRole
(
models
.
Model
):
role
=
models
.
CharField
(
max_length
=
20
)
color
=
models
.
CharField
(
max_length
=
11
,
null
=
True
)
priority
=
models
.
PositiveIntegerField
()
class
Meta
:
ordering
=
[
'
priority
'
]
def
__str__
(
self
):
return
self
.
role
class
RoleAttribute
(
models
.
Model
):
attribute
=
models
.
CharField
(
max_length
=
20
)
gradient
=
models
.
CharField
(
max_length
=
10
,
null
=
True
)
priority
=
models
.
PositiveIntegerField
()
class
Meta
:
ordering
=
[
'
priority
'
]
def
__str__
(
self
):
return
self
.
attribute
class
PredefinedSelectionalPreference
(
models
.
Model
):
key
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
)
# name = TODO: wymaga lokalizacji
def
__str__
(
self
):
return
self
.
key
class
RelationalSelectionalPreference
(
models
.
Model
):
relation
=
models
.
ForeignKey
(
'
SelectionalPreferenceRelation
'
,
on_delete
=
models
.
PROTECT
)
to
=
models
.
ForeignKey
(
'
Argument
'
,
on_delete
=
models
.
PROTECT
)
def
__str__
(
self
):
return
'
%s -> %s
'
%
(
self
.
relation
,
self
.
to
)
class
SelectionalPreferenceRelation
(
models
.
Model
):
key
=
models
.
CharField
(
max_length
=
40
,
unique
=
True
)
# name = TODO: wymaga lokalizacji
plwn_id
=
models
.
IntegerField
(
null
=
True
)
class
Meta
:
ordering
=
[
'
key
'
]
def
__str__
(
self
):
return
self
.
key
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment