summaryrefslogtreecommitdiff
path: root/rdflib/paths.py
diff options
context:
space:
mode:
Diffstat (limited to 'rdflib/paths.py')
-rw-r--r--rdflib/paths.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/rdflib/paths.py b/rdflib/paths.py
index 1862c98c..02a2ce7f 100644
--- a/rdflib/paths.py
+++ b/rdflib/paths.py
@@ -217,6 +217,9 @@ class InvPath(Path):
def __repr__(self):
return "Path(~%s)" % (self.arg,)
+ def n3(self):
+ return '^%s'%self.arg.n3()
+
class SequencePath(Path):
def __init__(self, *args):
@@ -258,6 +261,9 @@ class SequencePath(Path):
def __repr__(self):
return "Path(%s)" % " / ".join(str(x) for x in self.args)
+ def n3(self):
+ return '/'.join(a.n3() for a in self.args)
+
class AlternativePath(Path):
def __init__(self, *args):
@@ -276,6 +282,10 @@ class AlternativePath(Path):
def __repr__(self):
return "Path(%s)" % " | ".join(str(x) for x in self.args)
+ def n3(self):
+ return '|'.join(a.n3() for a in self.args)
+
+
class MulPath(Path):
def __init__(self, path, mod):
@@ -375,6 +385,10 @@ class MulPath(Path):
def __repr__(self):
return "Path(%s%s)" % (self.path, self.mod)
+ def n3(self):
+ return '%s%s'%(self.path, self.mod)
+
+
class NegatedPath(Path):
def __init__(self, arg):
@@ -404,6 +418,9 @@ class NegatedPath(Path):
def __repr__(self):
return "Path(! %s)" % ",".join(str(x) for x in self.args)
+ def n3(self):
+ return '!(%s)'%('|'.join(self.args))
+
class PathList(list):
pass