Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DBRepo
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FAIR Data Austria DB Repository
DBRepo
Commits
3c55b0e9
Commit
3c55b0e9
authored
3 years ago
by
Cornelia Michlits
Browse files
Options
Downloads
Patches
Plain Diff
104 ontology - adjust rdflib version
parent
a3fa8eca
No related branches found
No related tags found
4 merge requests
!81
New stable release
,
!43
Merge dev to master
,
!33
Draft: merge dev to master
,
!32
Add units-service to dev
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
fda-units-service/list.py
+25
-6
25 additions, 6 deletions
fda-units-service/list.py
fda-units-service/requirements.txt
+1
-1
1 addition, 1 deletion
fda-units-service/requirements.txt
with
26 additions
and
7 deletions
fda-units-service/list.py
+
25
−
6
View file @
3c55b0e9
...
@@ -15,7 +15,9 @@ g.parse('onto/om-2.ttl', format='turtle')
...
@@ -15,7 +15,9 @@ g.parse('onto/om-2.ttl', format='turtle')
om
=
rdflib
.
Namespace
(
'
http://www.ontology-of-units-of-measure.org/resource/om-2/
'
)
om
=
rdflib
.
Namespace
(
'
http://www.ontology-of-units-of-measure.org/resource/om-2/
'
)
rdf_schema
=
rdflib
.
Namespace
(
'
http://www.w3.org/2000/01/rdf-schema#
'
)
rdf_schema
=
rdflib
.
Namespace
(
'
http://www.w3.org/2000/01/rdf-schema#
'
)
def
list_units
(
string
):
r
=
{}
def
list_units
(
string
,
offset
=
0
):
if
bool
(
re
.
match
(
'
^[a-zA-Z0-9]+$
'
,
string
)):
if
bool
(
re
.
match
(
'
^[a-zA-Z0-9]+$
'
,
string
)):
l_query
=
"""
l_query
=
"""
SELECT ?symbol ?name ?comment
SELECT ?symbol ?name ?comment
...
@@ -24,9 +26,26 @@ def list_units(string):
...
@@ -24,9 +26,26 @@ def list_units(string):
?unit <http://www.w3.org/2000/01/rdf-schema#label> ?name .
?unit <http://www.w3.org/2000/01/rdf-schema#label> ?name .
?unit <http://www.w3.org/2000/01/rdf-schema#comment> ?comment .
?unit <http://www.w3.org/2000/01/rdf-schema#comment> ?comment .
FILTER regex(str(?unit),
\"
"""
+
string
+
"""
\"
,
"
i
"
)
FILTER regex(str(?unit),
\"
"""
+
string
+
"""
\"
,
"
i
"
)
} LIMIT 10
"""
} LIMIT 10
OFFSET
"""
+
str
(
offset
)
qres
=
g
.
query
(
l_query
)
qres
=
g
.
query
(
l_query
)
units
=
list
()
for
row
in
qres
:
units
.
append
({
"
symbol
"
:
str
(
row
.
symbol
),
"
name
"
:
str
(
row
.
name
),
"
comment
"
:
str
(
row
.
comment
)})
return
units
else
:
return
None
def
get_uri
(
name
):
if
bool
(
re
.
match
(
'
^[a-zA-Z0-9]+$
'
,
name
)):
uri_query
=
"""
SELECT ?uri
WHERE {
?uri <http://www.w3.org/2000/01/rdf-schema#label> ?o .
FILTER (str(?o)=
\"
"""
+
name
+
"""
\"
)
} LIMIT 1
"""
qres
=
g
.
query
(
uri_query
)
for
row
in
qres
:
for
row
in
qres
:
print
(
f
"
{
row
.
symbol
}
|
{
row
.
name
}
|
{
row
.
comment
}
"
)
return
{
"
URI
"
:
row
.
uri
}
else
:
else
:
return
'
not alphanumeric
'
return
None
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fda-units-service/requirements.txt
+
1
−
1
View file @
3c55b0e9
...
@@ -3,4 +3,4 @@ flasgger==0.9.5
...
@@ -3,4 +3,4 @@ flasgger==0.9.5
py-eureka-client==0.9.1
py-eureka-client==0.9.1
docker==5.0.0
docker==5.0.0
gevent==21.8.0
gevent==21.8.0
rdflib==6.0.
1
rdflib==6.0.
2
This diff is collapsed.
Click to expand it.
Cornelia Michlits
@cornelia.michlits
mentioned in commit
e42af082
·
3 years ago
mentioned in commit
e42af082
mentioned in commit e42af0829f92e17cfd5ce65394e726a779f65461
Toggle commit list
Preview
0%
Loading
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