forked from RDFLib/rdflib
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on RDFLib#955 Parsing passes, now into the algebra
- Loading branch information
1 parent
d09193b
commit 47e2930
Showing
3 changed files
with
48 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,40 @@ | ||
from rdflib import Graph | ||
from rdflib.plugins.sparql.parser import VarOrBlankNodeOrIriOrLitOrEmbTP | ||
import pyparsing | ||
import unittest | ||
|
||
class SparqlStarTests(unittest.TestCase): | ||
|
||
def test_basic_sparql_star_subject(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { | ||
<< ?s ?p ?o >> ?p2 ?o2 . | ||
}''') | ||
@staticmethod | ||
def test_basic_sparql_star_subject(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { | ||
<< ?s ?p ?o >> ?p2 ?o2 . | ||
}''') | ||
|
||
@staticmethod | ||
def test_basic_sparql_star_object(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { | ||
?s ?p << ?s2 ?p2 ?o2 >> . | ||
}''') | ||
|
||
@staticmethod | ||
def test_basic_sparql(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { | ||
?s ?p ?o . | ||
}''') | ||
|
||
def test_basic_sparql_star_object(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { | ||
?s ?p << ?s2 ?p2 ?o2 >> . | ||
}''') | ||
@staticmethod | ||
def test_bind_sparql_star(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { BIND(<< ?s2 ?p2 ?o2 >> AS ?b) }''') | ||
|
||
def test_basic_sparql(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { | ||
?s ?p ?o . | ||
}''') | ||
@staticmethod | ||
def test_parser(): | ||
assert VarOrBlankNodeOrIriOrLitOrEmbTP.matches("<<?s ?p ?o>>") | ||
|
||
|
||
def test_bind_sparql_star(): | ||
g = Graph() | ||
res = g.query('''SELECT * WHERE { BIND(<< ?s2 ?p2 ?o2 >> AS ?b) }''') | ||
if __name__ == '__main__': | ||
unittest.main() |