Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Rodolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
Rodolf
Merge requests
!36
Upload ontology file
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Upload ontology file
topic/default/upload_ontology
into
branch/default
Overview
7
Commits
3
Pipelines
9
Changes
7
Merged
Fabien Amarger
requested to merge
topic/default/upload_ontology
into
branch/default
1 year ago
Overview
7
Commits
3
Pipelines
9
Changes
7
Expand
see
#52 (closed)
0
0
Merge request reports
Compare
branch/default
version 9
c721fa85
1 year ago
version 8
65142491
1 year ago
version 7
ea9c08a8
1 year ago
version 6
6884eab2
1 year ago
version 5
34607660
1 year ago
version 4
f4f7817a
1 year ago
version 3
8ac449eb
1 year ago
version 2
f8221ddd
1 year ago
version 1
671ee3ee
1 year ago
branch/default (base)
and
version 9
latest version
c721fa85
3 commits,
1 year ago
version 9
c721fa85
3 commits,
1 year ago
version 8
65142491
3 commits,
1 year ago
version 7
ea9c08a8
3 commits,
1 year ago
version 6
6884eab2
2 commits,
1 year ago
version 5
34607660
2 commits,
1 year ago
version 4
f4f7817a
2 commits,
1 year ago
version 3
8ac449eb
2 commits,
1 year ago
version 2
f8221ddd
2 commits,
1 year ago
version 1
671ee3ee
1 commit,
1 year ago
7 files
+
60
−
18
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
cubicweb_rodolf/hooks.py
+
24
−
1
Options
@@ -20,7 +20,7 @@
from
datetime
import
datetime
,
timedelta
import
logging
from
cubicweb.server.hook
import
Hook
from
cubicweb.server.hook
import
Hook
,
match_rtype
from
cubicweb.predicates
import
is_instance
from
cubicweb_s3storage.storages
import
S3Storage
@@ -24,5 +24,6 @@
from
cubicweb.predicates
import
is_instance
from
cubicweb_s3storage.storages
import
S3Storage
from
rdflib
import
Graph
from
cubicweb_rodolf.import_data
import
import_data
,
launch_import_procedure
@@ -27,5 +28,6 @@
from
cubicweb_rodolf.import_data
import
import_data
,
launch_import_procedure
from
cubicweb_rodolf.process_helpers
import
upload_graph_to_virtuoso_endpoint
RODOLF_IMPORT_DELTA
=
timedelta
(
@@ -92,3 +94,24 @@
import_data
,
import_process_eid
=
self
.
entity
.
eid
)
self
.
_cw
.
commit
()
class
UploadOntologyHook
(
Hook
):
__regid__
=
"
rodolf.upload-ontology-hook
"
__select__
=
Hook
.
__select__
&
match_rtype
(
"
ontology_file
"
)
events
=
(
"
after_add_relation
"
,)
def
__call__
(
self
):
ontology_graph
=
Graph
()
file
=
self
.
_cw
.
entity_from_eid
(
self
.
eidto
)
procedure
=
self
.
_cw
.
entity_from_eid
(
self
.
eidfrom
)
ontology_graph
.
parse
(
data
=
file
.
data
.
read
(),
format
=
file
.
data_format
,
)
upload_graph_to_virtuoso_endpoint
(
procedure
,
ontology_graph
,
f
"
urn:rodolf:
{
procedure
.
eid
}
:ontology
"
,
file
.
download_file_name
(),
)
Loading