Permalink
Browse files

remove rdflib static from tree

  • Loading branch information...
1 parent dd5ee69 commit cb5afce1dfee896228d6eff6eb1a5e20d82544ef @mjkoster mjkoster committed Dec 8, 2013
Showing with 2 additions and 12,790 deletions.
  1. +0 −77 doc/rdflib3/__init__.py
  2. BIN doc/rdflib3/__init__.pyc
  3. +0 −262 doc/rdflib3/collection.py
  4. BIN doc/rdflib3/collection.pyc
  5. +0 −319 doc/rdflib3/compare.py
  6. +0 −45 doc/rdflib3/compat.py
  7. +0 −92 doc/rdflib3/events.py
  8. BIN doc/rdflib3/events.pyc
  9. +0 −71 doc/rdflib3/exceptions.py
  10. BIN doc/rdflib3/exceptions.pyc
  11. +0 −1,540 doc/rdflib3/graph.py
  12. BIN doc/rdflib3/graph.pyc
  13. +0 −406 doc/rdflib3/namespace.py
  14. BIN doc/rdflib3/namespace.pyc
  15. +0 −183 doc/rdflib3/parser.py
  16. BIN doc/rdflib3/parser.pyc
  17. +0 −167 doc/rdflib3/plugin.py
  18. BIN doc/rdflib3/plugin.pyc
  19. +0 −7 doc/rdflib3/plugins/__init__.py
  20. BIN doc/rdflib3/plugins/__init__.pyc
  21. +0 −570 doc/rdflib3/plugins/memory.py
  22. BIN doc/rdflib3/plugins/memory.pyc
  23. +0 −3 doc/rdflib3/plugins/parsers/__init__.py
  24. +0 −2,427 doc/rdflib3/plugins/parsers/notation3.py
  25. +0 −80 doc/rdflib3/plugins/parsers/nquads.py
  26. +0 −28 doc/rdflib3/plugins/parsers/nt.py
  27. +0 −256 doc/rdflib3/plugins/parsers/ntriples.py
  28. +0 −192 doc/rdflib3/plugins/parsers/rdfa/__init__.py
  29. +0 −36 doc/rdflib3/plugins/parsers/rdfa/embeddedrdf.py
  30. +0 −180 doc/rdflib3/plugins/parsers/rdfa/literal.py
  31. +0 −173 doc/rdflib3/plugins/parsers/rdfa/options.py
  32. +0 −200 doc/rdflib3/plugins/parsers/rdfa/parse.py
  33. +0 −434 doc/rdflib3/plugins/parsers/rdfa/state.py
  34. 0 doc/rdflib3/plugins/parsers/rdfa/transform/__init__.py
  35. +0 −27 doc/rdflib3/plugins/parsers/rdfa/transform/headabout.py
  36. +0 −579 doc/rdflib3/plugins/parsers/rdfxml.py
  37. +0 −289 doc/rdflib3/plugins/parsers/trix.py
  38. 0 doc/rdflib3/plugins/serializers/__init__.py
  39. BIN doc/rdflib3/plugins/serializers/__init__.pyc
  40. +0 −123 doc/rdflib3/plugins/serializers/n3.py
  41. +0 −42 doc/rdflib3/plugins/serializers/nquads.py
  42. +0 −81 doc/rdflib3/plugins/serializers/nt.py
  43. +0 −335 doc/rdflib3/plugins/serializers/rdfxml.py
  44. BIN doc/rdflib3/plugins/serializers/rdfxml.pyc
  45. +0 −87 doc/rdflib3/plugins/serializers/trig.py
  46. +0 −75 doc/rdflib3/plugins/serializers/trix.py
  47. +0 −390 doc/rdflib3/plugins/serializers/turtle.py
  48. +0 −107 doc/rdflib3/plugins/serializers/xmlwriter.py
  49. BIN doc/rdflib3/plugins/serializers/xmlwriter.pyc
  50. +0 −531 doc/rdflib3/plugins/sleepycat.py
  51. +0 −103 doc/rdflib3/py3compat.py
  52. BIN doc/rdflib3/py3compat.pyc
  53. +0 −180 doc/rdflib3/query.py
  54. BIN doc/rdflib3/query.pyc
  55. +0 −408 doc/rdflib3/resource.py
  56. BIN doc/rdflib3/resource.pyc
  57. +0 −31 doc/rdflib3/serializer.py
  58. BIN doc/rdflib3/serializer.pyc
  59. +0 −293 doc/rdflib3/store.py
  60. BIN doc/rdflib3/store.pyc
  61. +0 −1,042 doc/rdflib3/term.py
  62. BIN doc/rdflib3/term.pyc
  63. +0 −317 doc/rdflib3/util.py
  64. BIN doc/rdflib3/util.pyc
  65. +2 −2 iottoolkit/core/Description.py
  66. BIN iottoolkit/core/Description.pyc
View
@@ -1,77 +0,0 @@
-"""\
-A pure Python package providing the core RDF constructs.
-
-The packages is intended to provide the core RDF types and interfaces
-for working with RDF. The package defines a plugin interface for
-parsers, stores, and serializers that other packages can use to
-implement parsers, stores, and serializers that will plug into the
-rdflib package.
-
-The primary interface `rdflib` exposes to work with RDF is
-`rdflib.graph.Graph`.
-
-A tiny example:
-
- >>> import rdflib
-
- >>> g = rdflib.Graph()
- >>> result = g.parse("http://www.w3.org/2000/10/swap/test/meet/white.rdf")
-
- >>> print("graph has %s statements." % len(g))
- graph has 19 statements.
- >>>
- >>> for s, p, o in g:
- ... if (s, p, o) not in g:
- ... raise Exception("It better be!")
-
- >>> s = g.serialize(format='n3')
-
-"""
-__docformat__ = "restructuredtext en"
-
-# The format of the __version__ line is matched by a regex in setup.py
-__version__ = "3.4.0-dev"
-__date__ = "2012/09/25"
-
-__all__ = [
- 'URIRef',
- 'BNode',
- 'Literal',
- 'Variable',
-
- 'Namespace',
-
- 'Graph',
- 'ConjunctiveGraph',
-
- 'RDF',
- 'RDFS',
- 'OWL',
- 'XSD',
-
- 'util',
- ]
-
-import sys
-# generator expressions require 2.4
-assert sys.version_info >= (2, 4, 0), "rdflib requires Python 2.4 or higher"
-del sys
-
-import logging
-_LOGGER = logging.getLogger("rdflib")
-_LOGGER.info("version: %s" % __version__)
-
-
-from rdflib.term import URIRef, BNode, Literal, Variable
-
-from rdflib.namespace import Namespace
-
-from rdflib.graph import Graph, ConjunctiveGraph
-
-from rdflib.namespace import RDF, RDFS, OWL, XSD
-
-from rdflib import plugin
-from rdflib import query
-
-from rdflib import util
-
View
Binary file not shown.
View
@@ -1,262 +0,0 @@
-from rdflib.namespace import RDF
-from rdflib.term import BNode
-from rdflib.term import Literal
-from rdflib.graph import Graph
-from rdflib.py3compat import format_doctest_out
-
-__all__ = ['Collection']
-
-class Collection(object):
- __doc__ = format_doctest_out("""
- See 3.3.5 Emulating container types: http://docs.python.org/ref/sequence-types.html#l2h-232
-
- >>> from rdflib.graph import Graph
- >>> listName = BNode()
- >>> g = Graph('IOMemory')
- >>> listItem1 = BNode()
- >>> listItem2 = BNode()
- >>> g.add((listName,RDF.first,Literal(1)))
- >>> g.add((listName,RDF.rest,listItem1))
- >>> g.add((listItem1,RDF.first,Literal(2)))
- >>> g.add((listItem1,RDF.rest,listItem2))
- >>> g.add((listItem2,RDF.rest,RDF.nil))
- >>> g.add((listItem2,RDF.first,Literal(3)))
- >>> c=Collection(g,listName)
- >>> print(list(c))
- [rdflib.term.Literal(%(u)s'1', datatype=rdflib.term.URIRef(%(u)s'http://www.w3.org/2001/XMLSchema#integer')), rdflib.term.Literal(%(u)s'2', datatype=rdflib.term.URIRef(%(u)s'http://www.w3.org/2001/XMLSchema#integer')), rdflib.term.Literal(%(u)s'3', datatype=rdflib.term.URIRef(%(u)s'http://www.w3.org/2001/XMLSchema#integer'))]
- >>> 1 in c
- True
- >>> len(c)
- 3
- >>> c._get_container(1) == listItem1
- True
- >>> c.index(Literal(2)) == 1
- True
- """)
- def __init__(self, graph, uri, seq=[]):
- self.graph = graph
- self.uri = uri or BNode()
- for item in seq:
- self.append(item)
-
- def n3(self):
- """
- >>> from rdflib.graph import Graph
- >>> listName = BNode()
- >>> g = Graph('IOMemory')
- >>> listItem1 = BNode()
- >>> listItem2 = BNode()
- >>> g.add((listName,RDF.first,Literal(1)))
- >>> g.add((listName,RDF.rest,listItem1))
- >>> g.add((listItem1,RDF.first,Literal(2)))
- >>> g.add((listItem1,RDF.rest,listItem2))
- >>> g.add((listItem2,RDF.rest,RDF.nil))
- >>> g.add((listItem2,RDF.first,Literal(3)))
- >>> c=Collection(g,listName)
- >>> print(c.n3())
- ( "1"^^<http://www.w3.org/2001/XMLSchema#integer> "2"^^<http://www.w3.org/2001/XMLSchema#integer> "3"^^<http://www.w3.org/2001/XMLSchema#integer> )
- """
- return "( %s )"%(' '.join([i.n3() for i in self]))
-
- def _get_container(self, index):
- """Gets the first, rest holding node at index."""
- assert isinstance(index, int)
- graph = self.graph
- container = self.uri
- i = 0
- while i<index:
- i += 1
- container = graph.value(container, RDF.rest)
- if container is None:
- break
- return container
-
- def __len__(self):
- """length of items in collection."""
- count = 0
- links=set()
- for item in self.graph.items(self.uri):
- assert item not in links,"There is a loop in the RDF list! (%s has been processed before)"%item
- links.add(item)
- count += 1
- return count
-
- def index(self, item):
- """
- Returns the 0-based numerical index of the item in the list
- """
- listName = self.uri
- index = 0
- while True:
- if (listName,RDF.first,item) in self.graph:
- return index
- else:
- newLink = list(self.graph.objects(listName,RDF.rest))
- index += 1
- if newLink == [RDF.nil]:
- raise ValueError("%s is not in %s"%(item,self.uri))
- elif not newLink:
- raise Exception("Malformed RDF Collection: %s"%self.uri)
- else:
- assert len(newLink)==1, "Malformed RDF Collection: %s"%self.uri
- listName = newLink[0]
-
- def __getitem__(self, key):
- """TODO"""
- c = self._get_container(key)
- if c:
- v = self.graph.value(c, RDF.first)
- if v:
- return v
- else:
- raise KeyError, key
- else:
- raise IndexError, key
-
- def __setitem__(self, key, value):
- """TODO"""
- c = self._get_container(key)
- if c:
- self.graph.add((c, RDF.first, value))
- else:
- raise IndexError, key
-
-
- def __delitem__(self, key):
- """
- >>> from rdflib.namespace import RDF, RDFS
- >>> from rdflib import Graph
- >>> from pprint import pformat
- >>> g=Graph()
- >>> a=BNode('foo')
- >>> b=BNode('bar')
- >>> c=BNode('baz')
- >>> g.add((a,RDF.first,RDF.type))
- >>> g.add((a,RDF.rest,b))
- >>> g.add((b,RDF.first,RDFS.label))
- >>> g.add((b,RDF.rest,c))
- >>> g.add((c,RDF.first,RDFS.comment))
- >>> g.add((c,RDF.rest,RDF.nil))
- >>> len(g)
- 6
- >>> def listAncestry(node,graph):
- ... for i in graph.subjects(RDF.rest,node):
- ... yield i
- >>> [str(node.n3()) for node in g.transitiveClosure(listAncestry,RDF.nil)]
- ['_:baz', '_:bar', '_:foo']
- >>> lst=Collection(g,a)
- >>> len(lst)
- 3
- >>> b==lst._get_container(1)
- True
- >>> c==lst._get_container(2)
- True
- >>> del lst[1]
- >>> len(lst)
- 2
- >>> len(g)
- 4
-
- """
- self[key] # to raise any potential key exceptions
- graph = self.graph
- current = self._get_container(key)
- assert current
- if len(self)==1 and key>0:
- pass
- elif key==len(self)-1:
- #the tail
- priorLink = self._get_container(key-1)
- self.graph.set((priorLink,RDF.rest,RDF.nil))
- graph.remove((current, None, None))
- else:
- next = self._get_container(key+1)
- prior = self._get_container(key-1)
- assert next and prior
- graph.remove((current, None, None))
- graph.set((prior, RDF.rest, next))
-
- def __iter__(self):
- """Iterator over items in Collections"""
- return self.graph.items(self.uri)
-
- def append(self, item):
- """
- >>> from rdflib.graph import Graph
- >>> listName = BNode()
- >>> g = Graph()
- >>> c=Collection(g,listName,[Literal(1),Literal(2)])
- >>> links = [list(g.subjects(object=i,predicate=RDF.first))[0] for i in c]
- >>> len([i for i in links if (i,RDF.rest,RDF.nil) in g])
- 1
-
- """
- container = self.uri
- graph = self.graph
- #iterate to the end of the linked list
- rest = graph.value(container, RDF.rest)
- while rest:
- if rest == RDF.nil:
- #the end, append to the end of the linked list
- node = BNode()
- graph.set((container, RDF.rest, node))
- container=node
- break
- else:
- #move down one link
- if container != self.uri:
- rest = graph.value(rest, RDF.rest)
- if not rest == RDF.nil:
- container=rest
- graph.add((container, RDF.first, item))
- graph.add((container, RDF.rest, RDF.nil))
-
- def clear(self):
- container = self.uri
- graph = self.graph
- while container:
- rest = graph.value(container, RDF.rest)
- graph.remove((container, RDF.first, None))
- graph.remove((container, RDF.rest, None))
- container = rest
-def test():
- import doctest
- doctest.testmod()
-
-if __name__=="__main__":
- test()
-
- g = Graph()
-
- c = Collection(g, BNode())
-
- assert len(c)==0
-
- c = Collection(g, BNode(), [Literal("1"), Literal("2"), Literal("3"), Literal("4")])
-
- assert len(c)==4
-
- assert c[1]==Literal("2"), c[1]
-
- del c[1]
-
- assert list(c)==[Literal("1"), Literal("3"), Literal("4")], list(c)
-
- try:
- del c[500]
- except IndexError, i:
- pass
-
- c.append(Literal("5"))
-
- print(list(c))
-
- for i in c:
- print(i)
-
- del c[3]
-
- c.clear()
-
- assert len(c)==0
-
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit cb5afce

Please sign in to comment.