Skip to content

Commit

Permalink
Merge pull request #83 from semanticarts/virtuoso-is-stupid
Browse files Browse the repository at this point in the history
Draft: Query changes for Virtuoso
  • Loading branch information
pwin committed Oct 18, 2021
2 parents 9c44408 + a280954 commit ee9957c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,5 +1,6 @@
# Python virtual env
venv/
test_env/
__pycache__/

# PyLint
Expand All @@ -11,3 +12,4 @@ __pycache__/
.coverage
.idea/
dist/
onto_tool.egg-info/
20 changes: 12 additions & 8 deletions onto_tool/ontograph.py
Expand Up @@ -339,8 +339,12 @@ def gather_instance_info(self):
prefix skos: <http://www.w3.org/2004/02/skos/core#>
select distinct ?predicate ?label ?type where {
?s ?predicate ?o
FILTER(?predicate NOT IN (rdf:type, skos:prefLabel, skos:definition))
{
select distinct ?predicate where {
?s ?predicate ?o
FILTER(?predicate NOT IN (rdf:type, rdfs:label, skos:prefLabel, skos:altLabel, skos:definition))
}
}
FILTER (!STRSTARTS(STR(?predicate), 'http://www.w3.org/2002/07/owl#'))
FILTER (!STRSTARTS(STR(?predicate), 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'))
FILTER (!STRSTARTS(STR(?predicate), 'http://www.w3.org/2000/01/rdf-schema#'))
Expand Down Expand Up @@ -416,7 +420,7 @@ def build_class_hierarchy(self):
select distinct ?class ?c_label ?parent ?p_label where {
{
?class rdfs:subClassOf+ ?parent .
?class rdfs:subClassOf ?parent .
}
UNION
{
Expand Down Expand Up @@ -557,7 +561,7 @@ def create_class_count_query(self, limit):
select ?src (COUNT(?src) as ?num) where {
{
select (group_concat(?o) as ?src) where {
select (group_concat(?o;separator=' ') as ?src) where {
$pattern
FILTER(!ISBLANK(?s))
FILTER (!STRSTARTS(STR(?o), 'http://www.w3.org/2002/07/owl#'))
Expand All @@ -582,7 +586,7 @@ def create_predicate_query(self, predicate, predicate_type, limit):
select ?src ?tgt (COUNT(?src) as ?num) where {
{
select (group_concat(?src_c) as ?src) (group_concat(?tgt_c) as ?tgt) where {
select (group_concat(?src_c;separator=' ') as ?src) (group_concat(?tgt_c;separator=' ') as ?tgt) where {
$pattern
FILTER(!ISBLANK(?s))
?s a ?src_c .
Expand All @@ -603,7 +607,7 @@ def create_predicate_query(self, predicate, predicate_type, limit):
select ?src ?dt (COUNT(?src) as ?num) where {
{
select (group_concat(?src_c) as ?src) (SAMPLE(?dtype) as ?dt) where {
select (group_concat(?src_c;separator=' ') as ?src) (SAMPLE(?dtype) as ?dt) where {
$pattern
FILTER(!ISBLANK(?s) && ISLITERAL(?o))
?s a ?src_c .
Expand Down Expand Up @@ -631,7 +635,7 @@ def create_predicate_query(self, predicate, predicate_type, limit):
{
select ?src ?tgt (COUNT(?src) as ?num) where {
{
select (group_concat(?src_c) as ?src) (group_concat(?tgt_c) as ?tgt) where {
select (group_concat(?src_c;separator=' ') as ?src) (group_concat(?tgt_c;separator=' ') as ?tgt) where {
$pattern
FILTER(!ISBLANK(?s))
?s a ?src_c .
Expand All @@ -647,7 +651,7 @@ def create_predicate_query(self, predicate, predicate_type, limit):
{
select ?src ?dt (COUNT(?src) as ?num) where {
{
select (group_concat(?src_c) as ?src) (SAMPLE(?dtype) as ?dt) where {
select (group_concat(?src_c;separator=' ') as ?src) (SAMPLE(?dtype) as ?dt) where {
$pattern
FILTER(!ISBLANK(?s) && ISLITERAL(?o))
?s a ?src_c .
Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -18,7 +18,6 @@
install_requires=[
'pyparsing==2.4.7',
'rdflib~=6.0.0',
'pyshacl',
'pydot',
'jinja2',
'markdown',
Expand Down

0 comments on commit ee9957c

Please sign in to comment.