Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
Jupyter-RDFify
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
DBIS
Teaching
Jupyter-RDFify
Commits
7e799689
Commit
7e799689
authored
2 months ago
by
Laurenz Alexander Neumann
Browse files
Options
Downloads
Patches
Plain Diff
removed unused cgi package, removed shex module
parent
decf1ea9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
jupyter-rdfify/__init__.py
+1
-3
1 addition, 3 deletions
jupyter-rdfify/__init__.py
jupyter-rdfify/shex.py
+0
-65
0 additions, 65 deletions
jupyter-rdfify/shex.py
jupyter-rdfify/sparql.py
+0
-1
0 additions, 1 deletion
jupyter-rdfify/sparql.py
with
1 addition
and
69 deletions
jupyter-rdfify/__init__.py
+
1
−
3
View file @
7e799689
...
@@ -4,7 +4,6 @@ from IPython.display import display_javascript
...
@@ -4,7 +4,6 @@ from IPython.display import display_javascript
from
.jupyter_rdf
import
JupyterRDF
from
.jupyter_rdf
import
JupyterRDF
from
.serialization
import
SerializationModule
from
.serialization
import
SerializationModule
from
.sparql
import
SPARQLModule
from
.sparql
import
SPARQLModule
from
.shex
import
ShexModule
from
.graph_manager
import
GraphManagerModule
from
.graph_manager
import
GraphManagerModule
...
@@ -15,7 +14,7 @@ def load_ipython_extension(ipython):
...
@@ -15,7 +14,7 @@ def load_ipython_extension(ipython):
js_highlight
=
"""
js_highlight
=
"""
if (typeof IPython !==
"
undefined
"
) {
if (typeof IPython !==
"
undefined
"
) {
IPython.CodeCell.options_default.highlight_modes[
'
application/sparql-query
'
] = {
'
reg
'
:[/^%%rdf sparql/]};
IPython.CodeCell.options_default.highlight_modes[
'
application/sparql-query
'
] = {
'
reg
'
:[/^%%rdf sparql/]};
IPython.CodeCell.options_default.highlight_modes[
'
text/turtle
'
] = {
'
reg
'
:[/^%%rdf turtle/
, /^%%rdf shex/
]};
IPython.CodeCell.options_default.highlight_modes[
'
text/turtle
'
] = {
'
reg
'
:[/^%%rdf turtle/]};
IPython.CodeCell.options_default.highlight_modes[
'
application/ld+json
'
] = {
'
reg
'
:[/^%%rdf json-ld/]};
IPython.CodeCell.options_default.highlight_modes[
'
application/ld+json
'
] = {
'
reg
'
:[/^%%rdf json-ld/]};
IPython.notebook.get_cells().map(function(cell){ if (cell.cell_type ==
'
code
'
){ cell.auto_highlight(); } });
IPython.notebook.get_cells().map(function(cell){ if (cell.cell_type ==
'
code
'
){ cell.auto_highlight(); } });
}
}
...
@@ -39,7 +38,6 @@ def load_ipython_extension(ipython):
...
@@ -39,7 +38,6 @@ def load_ipython_extension(ipython):
SerializationModule
,
"
xml
"
,
"
XML+RDF module
"
,
"
XML+RDF
"
)
SerializationModule
,
"
xml
"
,
"
XML+RDF module
"
,
"
XML+RDF
"
)
jupyter_rdf
.
register_module
(
jupyter_rdf
.
register_module
(
SPARQLModule
,
"
sparql
"
,
"
SPARQL module
"
,
"
SPARQL
"
)
SPARQLModule
,
"
sparql
"
,
"
SPARQL module
"
,
"
SPARQL
"
)
jupyter_rdf
.
register_module
(
ShexModule
,
"
shex
"
,
"
ShEx module
"
,
"
ShEx
"
)
jupyter_rdf
.
register_module
(
jupyter_rdf
.
register_module
(
GraphManagerModule
,
"
graph
"
,
"
Graph management module
"
,
"
Graphman
"
)
GraphManagerModule
,
"
graph
"
,
"
Graph management module
"
,
"
Graphman
"
)
ipython
.
register_magics
(
jupyter_rdf
)
ipython
.
register_magics
(
jupyter_rdf
)
This diff is collapsed.
Click to expand it.
jupyter-rdfify/shex.py
deleted
100644 → 0
+
0
−
65
View file @
decf1ea9
from
pyshex.utils.schema_loader
import
SchemaLoader
from
pyshex
import
ShExEvaluator
from
.rdf_module
import
RDFModule
class
ShexModule
(
RDFModule
):
def
__init__
(
self
,
name
,
parser
,
logger
,
description
,
displayname
):
super
().
__init__
(
name
,
parser
,
logger
,
description
,
displayname
)
self
.
parser
.
add_argument
(
"
action
"
,
choices
=
[
"
parse
"
,
"
validate
"
,
"
prefix
"
],
help
=
"
Action to perform
"
)
self
.
parser
.
add_argument
(
"
--label
"
,
"
-l
"
,
help
=
"
Shape label for referencing
"
)
self
.
parser
.
add_argument
(
"
--graph
"
,
"
-g
"
,
help
=
"
Graph label for validation
"
)
self
.
parser
.
add_argument
(
"
--focus
"
,
"
-f
"
,
help
=
"
URI of node to focus on
"
)
self
.
parser
.
add_argument
(
"
--start
"
,
"
-s
"
,
help
=
"
Starting shape
"
)
self
.
loader
=
SchemaLoader
()
self
.
evaluator
=
ShExEvaluator
()
self
.
prefix
=
""
def
print_result
(
self
,
result
):
self
.
log
(
f
"
Evaluating shape
'
{
result
.
start
}
'
on node
'
{
result
.
focus
}
'"
)
if
result
.
result
:
self
.
logger
.
print
(
"
PASSED!
"
)
else
:
self
.
logger
.
print
(
f
"
FAILED! Reason:
\n
{
result
.
reason
}
\n
"
)
def
handle
(
self
,
params
,
store
):
if
params
.
action
==
"
prefix
"
:
self
.
prefix
=
params
.
cell
+
"
\n
"
self
.
log
(
"
Stored Prefix.
"
)
elif
params
.
action
==
"
parse
"
:
if
params
.
cell
is
not
None
:
try
:
schema
=
self
.
loader
.
loads
(
self
.
prefix
+
params
.
cell
)
if
params
.
label
is
not
None
and
schema
is
not
None
:
store
[
"
rdfshapes
"
][
params
.
label
]
=
schema
self
.
log
(
"
Shape successfully parsed.
"
)
except
Exception
as
e
:
self
.
log
(
f
"
Error during shape parse:
\n
{
str
(
e
)
}
"
)
else
:
self
.
log
(
"
No cell content to parse.
"
)
elif
params
.
action
==
"
validate
"
:
if
params
.
label
is
not
None
and
params
.
graph
is
not
None
:
if
params
.
label
in
store
[
"
rdfshapes
"
]:
if
params
.
graph
in
store
[
"
rdfgraphs
"
]:
result
=
self
.
evaluator
.
evaluate
(
store
[
"
rdfgraphs
"
][
params
.
graph
],
store
[
"
rdfshapes
"
][
params
.
label
],
start
=
params
.
start
,
focus
=
params
.
focus
)
for
r
in
result
:
self
.
print_result
(
r
)
else
:
self
.
log
(
f
"
Found no graph with label
'
{
params
.
graph
}
'
.
"
)
else
:
self
.
log
(
f
"
Found no shape with label
'
{
params
.
label
}
'
.
"
)
else
:
self
.
log
(
"
A shape and a graph label are required for validation.
"
)
This diff is collapsed.
Click to expand it.
jupyter-rdfify/sparql.py
+
0
−
1
View file @
7e799689
from
IPython.display
import
display
,
display_pretty
from
IPython.display
import
display
,
display_pretty
from
SPARQLWrapper
import
SPARQLWrapper
from
SPARQLWrapper
import
SPARQLWrapper
from
cgi
import
parse_header
from
.rdf_module
import
RDFModule
from
.rdf_module
import
RDFModule
from
.graph
import
parse_graph
,
draw_graph
from
.graph
import
parse_graph
,
draw_graph
...
...
This diff is collapsed.
Click to expand it.
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