[med-svn] [python-rdflib-jsonld] 01/02: Imported Upstream version 0.3

Michael Crusoe misterc-guest at moszumanska.debian.org
Fri Feb 5 16:51:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

misterc-guest pushed a commit to branch master
in repository python-rdflib-jsonld.

commit 7e0685614601c996cddcfd824d9c1d99a8f993be
Author: Michael R. Crusoe <crusoe at ucdavis.edu>
Date:   Fri Feb 5 03:07:00 2016 -0800

    Imported Upstream version 0.3
---
 MANIFEST.in                                   |   5 +
 PKG-INFO                                      |  32 +
 README.md                                     |  65 +++
 docs/Makefile                                 | 153 +++++
 docs/conf.py                                  | 244 ++++++++
 docs/index.rst                                |  60 ++
 docs/jsonld-parser.rst                        |  54 ++
 docs/jsonld-serializer.rst                    |  53 ++
 docs/make.bat                                 | 190 ++++++
 rdflib_jsonld.egg-info/PKG-INFO               |  32 +
 rdflib_jsonld.egg-info/SOURCES.txt            | 308 ++++++++++
 rdflib_jsonld.egg-info/dependency_links.txt   |   1 +
 rdflib_jsonld.egg-info/entry_points.txt       |   6 +
 rdflib_jsonld.egg-info/requires.txt           |   1 +
 rdflib_jsonld.egg-info/top_level.txt          |   1 +
 rdflib_jsonld/__init__.py                     |   3 +
 rdflib_jsonld/context.py                      | 269 +++++++++
 rdflib_jsonld/keys.py                         |  13 +
 rdflib_jsonld/parser.py                       | 316 ++++++++++
 rdflib_jsonld/serializer.py                   | 358 ++++++++++++
 rdflib_jsonld/util.py                         |  68 +++
 setup.cfg                                     |  10 +
 setup.py                                      | 119 ++++
 test/.DS_Store                                | Bin 0 -> 6148 bytes
 test/README.md                                |   9 +
 test/__init__.py                              |  15 +
 test/__init__.pyc                             | Bin 0 -> 597 bytes
 test/earl-context.jsonld                      |  24 +
 test/test-suite/.DS_Store                     | Bin 0 -> 6148 bytes
 test/test-suite/README                        |  62 ++
 test/test-suite/context.jsonld                |  31 +
 test/test-suite/manifest.jsonld               |  18 +
 test/test-suite/tests/fromRdf-0001-in.nq      |   5 +
 test/test-suite/tests/fromRdf-0001-out.jsonld |  12 +
 test/test-suite/tests/fromRdf-0002-in.nq      |   5 +
 test/test-suite/tests/fromRdf-0002-out.jsonld |  27 +
 test/test-suite/tests/fromRdf-0003-in.nq      |   6 +
 test/test-suite/tests/fromRdf-0003-out.jsonld |  19 +
 test/test-suite/tests/fromRdf-0004-in.nq      |  10 +
 test/test-suite/tests/fromRdf-0004-out.jsonld |  18 +
 test/test-suite/tests/fromRdf-0005-in.nq      |   9 +
 test/test-suite/tests/fromRdf-0005-out.jsonld |  20 +
 test/test-suite/tests/fromRdf-0006-in.nq      |  14 +
 test/test-suite/tests/fromRdf-0006-out.jsonld |  34 ++
 test/test-suite/tests/fromRdf-0007-in.nq      |   5 +
 test/test-suite/tests/fromRdf-0007-out.jsonld |  27 +
 test/test-suite/tests/fromRdf-0008-in.nq      |  28 +
 test/test-suite/tests/fromRdf-0008-out.jsonld |  50 ++
 test/test-suite/tests/fromRdf-0009-in.nq      |   7 +
 test/test-suite/tests/fromRdf-0009-out.jsonld |  18 +
 test/test-suite/tests/fromRdf-0010-in.nq      |   6 +
 test/test-suite/tests/fromRdf-0010-out.jsonld |  20 +
 test/test-suite/tests/fromRdf-0011-in.nq      |   8 +
 test/test-suite/tests/fromRdf-0011-out.jsonld |  25 +
 test/test-suite/tests/fromRdf-0012-in.nq      |   7 +
 test/test-suite/tests/fromRdf-0012-out.jsonld |  21 +
 test/test-suite/tests/fromRdf-0013-in.nq      |   8 +
 test/test-suite/tests/fromRdf-0013-out.jsonld |  27 +
 test/test-suite/tests/fromRdf-0014-in.nq      |  10 +
 test/test-suite/tests/fromRdf-0014-out.jsonld |  19 +
 test/test-suite/tests/fromRdf-0015-in.nq      |   3 +
 test/test-suite/tests/fromRdf-0015-out.jsonld |  11 +
 test/test-suite/tests/fromRdf-0016-in.nq      |  11 +
 test/test-suite/tests/fromRdf-0016-out.jsonld |  20 +
 test/test-suite/tests/fromRdf-0017-in.nq      |   9 +
 test/test-suite/tests/fromRdf-0017-out.jsonld |  14 +
 test/test-suite/tests/fromRdf-0018-in.nq      |   5 +
 test/test-suite/tests/fromRdf-0018-out.jsonld |  12 +
 test/test-suite/tests/fromRdf-0019-in.nq      |   5 +
 test/test-suite/tests/fromRdf-0019-out.jsonld |  14 +
 test/test-suite/tests/fromRdf-manifest.jsonld | 150 +++++
 test/test-suite/tests/toRdf-0001-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0001-out.nq       |   1 +
 test/test-suite/tests/toRdf-0002-in.jsonld    |   5 +
 test/test-suite/tests/toRdf-0002-out.nq       |   1 +
 test/test-suite/tests/toRdf-0003-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0003-out.nq       |   1 +
 test/test-suite/tests/toRdf-0004-in.jsonld    |   6 +
 test/test-suite/tests/toRdf-0004-out.nq       |   1 +
 test/test-suite/tests/toRdf-0005-in.jsonld    |   6 +
 test/test-suite/tests/toRdf-0005-out.nq       |   2 +
 test/test-suite/tests/toRdf-0006-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0006-out.nq       |   1 +
 test/test-suite/tests/toRdf-0007-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0007-out.nq       |   1 +
 test/test-suite/tests/toRdf-0008-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0008-out.nq       |   1 +
 test/test-suite/tests/toRdf-0009-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0009-out.nq       |   1 +
 test/test-suite/tests/toRdf-0010-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0010-out.nq       |   2 +
 test/test-suite/tests/toRdf-0011-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0011-out.nq       |   2 +
 test/test-suite/tests/toRdf-0012-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0012-out.nq       |   2 +
 test/test-suite/tests/toRdf-0013-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0013-out.nq       |   1 +
 test/test-suite/tests/toRdf-0014-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0014-out.nq       |   3 +
 test/test-suite/tests/toRdf-0015-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0015-out.nq       |   5 +
 test/test-suite/tests/toRdf-0016-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0016-out.nq       |   1 +
 test/test-suite/tests/toRdf-0017-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0017-out.nq       |   1 +
 test/test-suite/tests/toRdf-0018-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0018-out.nq       |   1 +
 test/test-suite/tests/toRdf-0019-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0019-out.nq       |   1 +
 test/test-suite/tests/toRdf-0020-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0020-out.nq       |   1 +
 test/test-suite/tests/toRdf-0022-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0022-out.nq       |   1 +
 test/test-suite/tests/toRdf-0023-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0023-out.nq       |   1 +
 test/test-suite/tests/toRdf-0024-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0024-out.nq       |   1 +
 test/test-suite/tests/toRdf-0025-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0025-out.nq       |   3 +
 test/test-suite/tests/toRdf-0026-in.jsonld    |   4 +
 test/test-suite/tests/toRdf-0026-out.nq       |   2 +
 test/test-suite/tests/toRdf-0027-in.jsonld    |  30 +
 test/test-suite/tests/toRdf-0027-out.nq       |   8 +
 test/test-suite/tests/toRdf-0028-in.jsonld    |  19 +
 test/test-suite/tests/toRdf-0028-out.nq       |   6 +
 test/test-suite/tests/toRdf-0029-in.jsonld    |  18 +
 test/test-suite/tests/toRdf-0029-out.nq       |   4 +
 test/test-suite/tests/toRdf-0030-in.jsonld    |  28 +
 test/test-suite/tests/toRdf-0030-out.nq       |   7 +
 test/test-suite/tests/toRdf-0031-in.jsonld    |  15 +
 test/test-suite/tests/toRdf-0031-out.nq       |   3 +
 test/test-suite/tests/toRdf-0032-in.jsonld    |  16 +
 test/test-suite/tests/toRdf-0032-out.nq       |   3 +
 test/test-suite/tests/toRdf-0033-in.jsonld    |  19 +
 test/test-suite/tests/toRdf-0033-out.nq       |   3 +
 test/test-suite/tests/toRdf-0034-in.jsonld    |  16 +
 test/test-suite/tests/toRdf-0034-out.nq       |   3 +
 test/test-suite/tests/toRdf-0035-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0035-out.nq       |   4 +
 test/test-suite/tests/toRdf-0036-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0036-out.nq       |   6 +
 test/test-suite/tests/toRdf-0041-in.jsonld    |   1 +
 test/test-suite/tests/toRdf-0041-out.nq       |   0
 test/test-suite/tests/toRdf-0042-in.jsonld    |  18 +
 test/test-suite/tests/toRdf-0042-out.nq       |   7 +
 test/test-suite/tests/toRdf-0043-in.jsonld    |  12 +
 test/test-suite/tests/toRdf-0043-out.nq       |   0
 test/test-suite/tests/toRdf-0044-in.jsonld    |  21 +
 test/test-suite/tests/toRdf-0044-out.nq       |  11 +
 test/test-suite/tests/toRdf-0045-in.jsonld    |  23 +
 test/test-suite/tests/toRdf-0045-out.nq       |   6 +
 test/test-suite/tests/toRdf-0046-in.jsonld    |  20 +
 test/test-suite/tests/toRdf-0046-out.nq       |   4 +
 test/test-suite/tests/toRdf-0047-in.jsonld    |  18 +
 test/test-suite/tests/toRdf-0047-out.nq       |   3 +
 test/test-suite/tests/toRdf-0048-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0048-out.nq       |   2 +
 test/test-suite/tests/toRdf-0049-in.jsonld    |  43 ++
 test/test-suite/tests/toRdf-0049-out.nq       |   9 +
 test/test-suite/tests/toRdf-0050-in.jsonld    |  11 +
 test/test-suite/tests/toRdf-0050-out.nq       |   2 +
 test/test-suite/tests/toRdf-0051-in.jsonld    |  13 +
 test/test-suite/tests/toRdf-0051-out.nq       |   2 +
 test/test-suite/tests/toRdf-0052-in.jsonld    |  39 ++
 test/test-suite/tests/toRdf-0052-out.nq       |   9 +
 test/test-suite/tests/toRdf-0053-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0053-out.nq       |   7 +
 test/test-suite/tests/toRdf-0054-in.jsonld    |  50 ++
 test/test-suite/tests/toRdf-0054-out.nq       |   6 +
 test/test-suite/tests/toRdf-0055-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0055-out.nq       |   6 +
 test/test-suite/tests/toRdf-0056-in.jsonld    |  30 +
 test/test-suite/tests/toRdf-0056-out.nq       |   9 +
 test/test-suite/tests/toRdf-0057-in.jsonld    |  45 ++
 test/test-suite/tests/toRdf-0057-out.nq       |   9 +
 test/test-suite/tests/toRdf-0058-in.jsonld    |  24 +
 test/test-suite/tests/toRdf-0058-out.nq       |   9 +
 test/test-suite/tests/toRdf-0059-in.jsonld    |   6 +
 test/test-suite/tests/toRdf-0059-out.nq       |   0
 test/test-suite/tests/toRdf-0060-in.jsonld    |  51 ++
 test/test-suite/tests/toRdf-0060-out.nq       |  11 +
 test/test-suite/tests/toRdf-0061-in.jsonld    |  56 ++
 test/test-suite/tests/toRdf-0061-out.nq       |  13 +
 test/test-suite/tests/toRdf-0062-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0062-out.nq       |   1 +
 test/test-suite/tests/toRdf-0063-in.jsonld    |  21 +
 test/test-suite/tests/toRdf-0063-out.nq       |  16 +
 test/test-suite/tests/toRdf-0064-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0064-out.nq       |   4 +
 test/test-suite/tests/toRdf-0065-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0065-out.nq       |   3 +
 test/test-suite/tests/toRdf-0066-in.jsonld    |  20 +
 test/test-suite/tests/toRdf-0066-out.nq       |   4 +
 test/test-suite/tests/toRdf-0067-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0067-out.nq       |  12 +
 test/test-suite/tests/toRdf-0068-in.jsonld    |  13 +
 test/test-suite/tests/toRdf-0068-out.nq       |   4 +
 test/test-suite/tests/toRdf-0069-in.jsonld    |  32 +
 test/test-suite/tests/toRdf-0069-out.nq       |  34 ++
 test/test-suite/tests/toRdf-0070-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0070-out.nq       |   3 +
 test/test-suite/tests/toRdf-0071-in.jsonld    |  13 +
 test/test-suite/tests/toRdf-0071-out.nq       |   3 +
 test/test-suite/tests/toRdf-0072-in.jsonld    |  11 +
 test/test-suite/tests/toRdf-0072-out.nq       |   1 +
 test/test-suite/tests/toRdf-0073-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0073-out.nq       |   3 +
 test/test-suite/tests/toRdf-0074-in.jsonld    |  16 +
 test/test-suite/tests/toRdf-0074-out.nq       |   5 +
 test/test-suite/tests/toRdf-0075-in.jsonld    |  18 +
 test/test-suite/tests/toRdf-0075-out.nq       |   5 +
 test/test-suite/tests/toRdf-0076-in.jsonld    |  90 +++
 test/test-suite/tests/toRdf-0076-out.nq       |  25 +
 test/test-suite/tests/toRdf-0077-in.jsonld    |  13 +
 test/test-suite/tests/toRdf-0077-out.nq       |   3 +
 test/test-suite/tests/toRdf-0078-in.jsonld    |  38 ++
 test/test-suite/tests/toRdf-0078-out.nq       |   1 +
 test/test-suite/tests/toRdf-0079-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0079-out.nq       |   3 +
 test/test-suite/tests/toRdf-0080-in.jsonld    |  23 +
 test/test-suite/tests/toRdf-0080-out.nq       |   4 +
 test/test-suite/tests/toRdf-0081-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0081-out.nq       |   3 +
 test/test-suite/tests/toRdf-0082-in.jsonld    |  12 +
 test/test-suite/tests/toRdf-0082-out.nq       |   3 +
 test/test-suite/tests/toRdf-0083-in.jsonld    |  20 +
 test/test-suite/tests/toRdf-0083-out.nq       |   5 +
 test/test-suite/tests/toRdf-0084-in.jsonld    |  16 +
 test/test-suite/tests/toRdf-0084-out.nq       |   3 +
 test/test-suite/tests/toRdf-0085-in.jsonld    |   3 +
 test/test-suite/tests/toRdf-0085-out.nq       |   0
 test/test-suite/tests/toRdf-0086-in.jsonld    |  14 +
 test/test-suite/tests/toRdf-0086-out.nq       |   0
 test/test-suite/tests/toRdf-0087-in.jsonld    |  28 +
 test/test-suite/tests/toRdf-0087-out.nq       |   1 +
 test/test-suite/tests/toRdf-0088-in.jsonld    |  19 +
 test/test-suite/tests/toRdf-0088-out.nq       |   4 +
 test/test-suite/tests/toRdf-0089-in.jsonld    |  12 +
 test/test-suite/tests/toRdf-0089-out.nq       |   3 +
 test/test-suite/tests/toRdf-0090-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0090-out.nq       |   2 +
 test/test-suite/tests/toRdf-0091-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0091-out.nq       |   1 +
 test/test-suite/tests/toRdf-0092-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0092-out.nq       |   2 +
 test/test-suite/tests/toRdf-0093-in.jsonld    |   6 +
 test/test-suite/tests/toRdf-0093-out.nq       |   1 +
 test/test-suite/tests/toRdf-0094-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0094-out.nq       |   1 +
 test/test-suite/tests/toRdf-0095-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0095-out.nq       |   1 +
 test/test-suite/tests/toRdf-0096-in.jsonld    |  13 +
 test/test-suite/tests/toRdf-0096-out.nq       |   3 +
 test/test-suite/tests/toRdf-0097-in.jsonld    |   6 +
 test/test-suite/tests/toRdf-0097-out.nq       |   1 +
 test/test-suite/tests/toRdf-0098-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0098-out.nq       |   1 +
 test/test-suite/tests/toRdf-0099-in.jsonld    |  16 +
 test/test-suite/tests/toRdf-0099-out.nq       |   4 +
 test/test-suite/tests/toRdf-0100-in.jsonld    |  30 +
 test/test-suite/tests/toRdf-0100-out.nq       |   4 +
 test/test-suite/tests/toRdf-0101-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0101-out.nq       |   4 +
 test/test-suite/tests/toRdf-0102-in.jsonld    |  35 ++
 test/test-suite/tests/toRdf-0102-out.nq       |  38 ++
 test/test-suite/tests/toRdf-0103-in.jsonld    |  18 +
 test/test-suite/tests/toRdf-0103-out.nq       |   5 +
 test/test-suite/tests/toRdf-0104-in.jsonld    |  16 +
 test/test-suite/tests/toRdf-0104-out.nq       |   5 +
 test/test-suite/tests/toRdf-0105-in.jsonld    |  18 +
 test/test-suite/tests/toRdf-0105-out.nq       |   3 +
 test/test-suite/tests/toRdf-0106-in.jsonld    |  19 +
 test/test-suite/tests/toRdf-0106-out.nq       |   5 +
 test/test-suite/tests/toRdf-0107-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0107-out.nq       |   2 +
 test/test-suite/tests/toRdf-0108-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0108-out.nq       |   1 +
 test/test-suite/tests/toRdf-0109-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0109-out.nq       |   2 +
 test/test-suite/tests/toRdf-0110-in.jsonld    |   9 +
 test/test-suite/tests/toRdf-0110-out.nq       |   2 +
 test/test-suite/tests/toRdf-0111-in.jsonld    |  15 +
 test/test-suite/tests/toRdf-0111-out.nq       |   2 +
 test/test-suite/tests/toRdf-0112-in.jsonld    |  13 +
 test/test-suite/tests/toRdf-0112-out.nq       |   1 +
 test/test-suite/tests/toRdf-0113-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0113-out.nq       |   1 +
 test/test-suite/tests/toRdf-0114-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0114-out.nq       |   1 +
 test/test-suite/tests/toRdf-0115-in.jsonld    |  20 +
 test/test-suite/tests/toRdf-0115-out.nq       |   3 +
 test/test-suite/tests/toRdf-0116-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0116-out.nq       |   2 +
 test/test-suite/tests/toRdf-0117-in.jsonld    |   7 +
 test/test-suite/tests/toRdf-0117-out.nq       |   2 +
 test/test-suite/tests/toRdf-0118-in.jsonld    |  38 ++
 test/test-suite/tests/toRdf-0118-out.nq       |   9 +
 test/test-suite/tests/toRdf-0119-in.jsonld    |   8 +
 test/test-suite/tests/toRdf-0119-out.nq       |   3 +
 test/test-suite/tests/toRdf-manifest.jsonld   | 812 ++++++++++++++++++++++++++
 test/test-suite/vocab.jsonld                  | 231 ++++++++
 test/test-suite/vocab_context.jsonld          |  15 +
 test/test_api.py                              |  26 +
 test/test_api.pyc                             | Bin 0 -> 1434 bytes
 test/test_compaction.py                       | 196 +++++++
 test/test_compaction.pyc                      | Bin 0 -> 1718 bytes
 test/test_context.rst                         | 116 ++++
 test/test_testsuite.py                        | 251 ++++++++
 test/test_testsuite.pyc                       | Bin 0 -> 11331 bytes
 309 files changed, 7114 insertions(+)

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..98370f0
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,5 @@
+include *.md
+recursive-include rdflib_jsonld *.py
+include setup.*
+graft docs
+graft test
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..604c956
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,32 @@
+Metadata-Version: 1.1
+Name: rdflib-jsonld
+Version: 0.3
+Summary: rdflib extension adding JSON-LD parser and serializer
+Home-page: https://github.com/RDFLib/rdflib-jsonld
+Author: RDFLib Team
+Author-email: http://groups.google.com/group/rdflib-dev
+License: BSD
+Download-URL: https://github.com/RDFLib/rdflib-jsonld/zipball/master
+Description: 
+            This parser/serialiser will
+        
+            * read in an JSON-LD formatted document and create an RDF graph
+            * serialize an RDF graph to JSON-LD formatted output
+        
+            See:
+        
+                http://json-ld.org/
+            
+Platform: any
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.5
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Operating System :: OS Independent
+Classifier: Natural Language :: English
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..570f6dc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,65 @@
+RDFLib plugin providing JSON-LD parsing and serialization
+=========================================================
+
+This is an implementation of [JSON-LD](http://www.w3.org/TR/json-ld/) for [RDFLib](https://github.com/RDFLib/rdflib). For more information about this technology, see the [JSON-LD website](http://json-ld.org/).
+
+This implementation will:
+
+* read in an JSON-LD formatted document and create an RDF graph
+* serialize an RDF graph to JSON-LD formatted output
+
+
+Using the plug-in JSONLD serializer/parser with RDFLib
+------------------------------------------------------
+
+The plugin parser and serializer are automatically registered if installed by
+setuptools.
+
+    >>> from rdflib import Graph, plugin
+    >>> from rdflib.serializer import Serializer
+
+    >>> testrdf = '''
+    ... @prefix dc: <http://purl.org/dc/terms/> .
+    ... <http://example.org/about>
+    ...     dc:title "Someone's Homepage"@en .
+    ... '''
+
+    >>> g = Graph().parse(data=testrdf, format='n3')
+
+    >>> print(g.serialize(format='json-ld', indent=4))
+    {
+        "@id": "http://example.org/about",
+        "http://purl.org/dc/terms/title": [
+            {
+                "@language": "en",
+                "@value": "Someone's Homepage"
+            }
+        ]
+    }
+
+    >>> context = {"@vocab": "http://purl.org/dc/terms/", "@language": "en"}
+    >>> print(g.serialize(format='json-ld', context=context, indent=4))
+    {
+        "@context": {
+            "@language": "en",
+            "@vocab": "http://purl.org/dc/terms/"
+        },
+        "@id": "http://example.org/about",
+        "title": "Someone's Homepage"
+    }
+
+
+Building the Sphinx documentation
+---------------------------------
+
+If Sphinx is installed, Sphinx documentation can be generated with::
+
+    $ python setup.py build_sphinx
+
+The documentation will be created in ./build/sphinx.
+
+
+Continuous integration tests
+----------------------------
+
+[![Build Status](https://travis-ci.org/RDFLib/rdflib-jsonld.png?branch=master)](https://travis-ci.org/RDFLib/rdflib-jsonld)
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..401e8a2
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/rdflib_jsonld.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/rdflib_jsonld.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/rdflib_jsonld"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/rdflib_jsonld"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..73add20
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,244 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# rdflib_jsonld documentation build configuration file, created by
+# sphinx-quickstart on Fri Jun 15 15:37:07 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'rdflib_jsonld'
+copyright = '2012, RDFLib Team'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'pyramid'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'rdflib_jsonlddoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'rdflib_jsonld.tex', 'rdflib\\_jsonld Documentation',
+   'RDFLib Team', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'rdflib_jsonld', 'rdflib_jsonld Documentation',
+     ['RDFLib Team'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'rdflib_jsonld', 'rdflib_jsonld Documentation', 'RDFLib Team',
+   'rdflib_jsonld', 'One line description of project.', 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..9a1fbb3
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,60 @@
+.. rdflib_jsonld documentation master file
+
+Welcome to rdflib_jsonld's documentation!
+=========================================
+
+RDFLib plugin providing JSON-LD parsing and serialization.
+
+This parser/serialiser will 
+
+* read in an JSON-LD formatted document and create an RDF graph 
+* serialize an RDF graph to JSON-LD formatted output 
+
+JSON-LD is described on the `JSON-LD <http://json-ld.org/>`_ web site as:
+
+    JSON-LD (JavaScript Object Notation for Linking Data) is a lightweight
+    Linked Data format that gives your data context. It is easy for humans
+    to read and write. It is easy for machines to parse and generate. It is
+    based on the already successful JSON format and provides a way to help
+    JSON data interoperate at Web-scale. If you are already familiar with
+    JSON, writing JSON-LD is very easy. These properties make JSON-LD an
+    ideal Linked Data interchange language for JavaScript environments, Web
+    service, and unstructured databases such as CouchDB and MongoDB.
+
+    A simple example of a JSON object expressing Linked Data:
+    
+    .. code-block:: js
+        
+        { 
+          "@context": "http://json-ld.org/contexts/person",
+          "@id": "http://dbpedia.org/resource/John_Lennon",
+          "name": "John Lennon",
+          "birthday": "10-09",
+          "member": "http://dbpedia.org/resource/The_Beatles"
+        }
+    
+    The example above describes a person whose name is John Lennon. The
+    difference between regular JSON and JSON-LD is that the JSON-LD object
+    above uniquely identifies itself on the Web and can be used, without
+    introducing ambiguity, across every Web site, Web service and
+    JSON-based database in operation today. The secret lies in the ``@context``
+    which instructs Linked Data-aware processors on how to interpret
+    the JSON object.
+
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   jsonld-serializer
+   jsonld-parser
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/docs/jsonld-parser.rst b/docs/jsonld-parser.rst
new file mode 100644
index 0000000..d7e1384
--- /dev/null
+++ b/docs/jsonld-parser.rst
@@ -0,0 +1,54 @@
+.. _rdflib_jsonld.jsonld_parser: an RDFLib plugin JSONLD parser
+
+===================================
+JSONLD parser plug-in for RDFLib
+===================================
+
+Using the plug-in JSONLD parser with RDFLib
+---------------------------------------------
+
+The plugin serializer is automatically registered if installed by
+setuptools, otherwise call ``rdfextras.registerplugins()`` after
+importing, as shown below.
+
+Identify a source of JSON-LD, pass the source to the parser,
+manipulate the resulting graph.
+
+.. code-block:: python
+
+    >>> from rdflib import Graph, URIRef, Literal
+    >>> from rdflib.parser import Parser
+    >>> import rdfextras
+    >>> rdfextras.registerplugins() # if no setuptools
+    >>> test_json = '''
+    ... {
+    ...     "@context": {
+    ...         "dc": "http://purl.org/dc/terms/",
+    ...         "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    ...         "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+    ...     },
+    ...     "@id": "http://example.org/about",
+    ...     "dc:title": {
+    ...         "@language": "en",
+    ...         "@literal": "Someone's Homepage"
+    ...     }
+    ... }
+    ... '''
+    >>> g = Graph().parse(data=test_json, format='json-ld')
+    >>> list(g) == [(URIRef('http://example.org/about'),
+    ...     URIRef('http://purl.org/dc/terms/title'),
+    ...     Literal(%(u)s"Someone's Homepage", lang=%(u)s'en'))]
+    True
+
+
+Module contents
+---------------
+
+.. currentmodule:: rdflib_jsonld.jsonld_parser
+
+.. automodule:: rdflib_jsonld.jsonld_parser
+
+.. autoclass:: JsonLDParser
+   :members: parse
+
+.. autofunction:: to_rdf
diff --git a/docs/jsonld-serializer.rst b/docs/jsonld-serializer.rst
new file mode 100644
index 0000000..441a360
--- /dev/null
+++ b/docs/jsonld-serializer.rst
@@ -0,0 +1,53 @@
+.. _rdflib_jsonld.jsonld_serializer: an RDFLib plugin JSONLD serializer
+
+=======================================
+JSONLD serializer plug-in for RDFLib
+=======================================
+
+Using the plug-in JSONLD serializer with RDFLib
+------------------------------------------------
+
+The plugin serializer is automatically registered if installed by
+setuptools, otherwise call ``rdfextras.registerplugins()`` after
+importing, as shown below.
+
+Read in an RDFLib Graph and serialize it, specifying ``format='json-ld'``.
+
+.. code-block:: python
+
+    >>> from rdflib import Graph, plugin
+    >>> from rdflib.serializer import Serializer
+    >>> import rdfextras
+    >>> rdfextras.registerplugins()
+
+    >>> testrdf = '''
+    ... @prefix dc: <http://purl.org/dc/terms/> .
+    ... <http://example.org/about>
+    ...     dc:title "Someone's Homepage"@en .
+    ... '''
+
+    >>> g = Graph().parse(data=testrdf, format='n3')
+
+    >>> print(g.serialize(format='json-ld', indent=4))
+    {
+        "@context": {
+            "dc": "http://purl.org/dc/terms/",
+            "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+            "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+        },
+        "@id": "http://example.org/about",
+        "dc:title": {
+            "@language": "en",
+            "@literal": "Someone's Homepage"
+        }
+    }
+
+Module contents
+---------------
+
+.. currentmodule:: rdflib_jsonld.jsonld_serializer
+
+.. autoclass:: JsonLDSerializer
+   :members: serialize
+
+.. autofunction:: to_tree
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 0000000..904bfcc
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,190 @@
+ at ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  texinfo    to make Texinfo files
+	echo.  gettext    to make PO message catalogs
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\rdflib_jsonld.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\rdflib_jsonld.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "texinfo" (
+	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+	goto end
+)
+
+if "%1" == "gettext" (
+	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end
diff --git a/rdflib_jsonld.egg-info/PKG-INFO b/rdflib_jsonld.egg-info/PKG-INFO
new file mode 100644
index 0000000..604c956
--- /dev/null
+++ b/rdflib_jsonld.egg-info/PKG-INFO
@@ -0,0 +1,32 @@
+Metadata-Version: 1.1
+Name: rdflib-jsonld
+Version: 0.3
+Summary: rdflib extension adding JSON-LD parser and serializer
+Home-page: https://github.com/RDFLib/rdflib-jsonld
+Author: RDFLib Team
+Author-email: http://groups.google.com/group/rdflib-dev
+License: BSD
+Download-URL: https://github.com/RDFLib/rdflib-jsonld/zipball/master
+Description: 
+            This parser/serialiser will
+        
+            * read in an JSON-LD formatted document and create an RDF graph
+            * serialize an RDF graph to JSON-LD formatted output
+        
+            See:
+        
+                http://json-ld.org/
+            
+Platform: any
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.5
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Operating System :: OS Independent
+Classifier: Natural Language :: English
diff --git a/rdflib_jsonld.egg-info/SOURCES.txt b/rdflib_jsonld.egg-info/SOURCES.txt
new file mode 100644
index 0000000..c06601f
--- /dev/null
+++ b/rdflib_jsonld.egg-info/SOURCES.txt
@@ -0,0 +1,308 @@
+MANIFEST.in
+README.md
+setup.cfg
+setup.py
+docs/Makefile
+docs/conf.py
+docs/index.rst
+docs/jsonld-parser.rst
+docs/jsonld-serializer.rst
+docs/make.bat
+rdflib_jsonld/__init__.py
+rdflib_jsonld/context.py
+rdflib_jsonld/keys.py
+rdflib_jsonld/parser.py
+rdflib_jsonld/serializer.py
+rdflib_jsonld/util.py
+rdflib_jsonld.egg-info/PKG-INFO
+rdflib_jsonld.egg-info/SOURCES.txt
+rdflib_jsonld.egg-info/dependency_links.txt
+rdflib_jsonld.egg-info/entry_points.txt
+rdflib_jsonld.egg-info/requires.txt
+rdflib_jsonld.egg-info/top_level.txt
+test/.DS_Store
+test/README.md
+test/__init__.py
+test/__init__.pyc
+test/earl-context.jsonld
+test/test_api.py
+test/test_api.pyc
+test/test_compaction.py
+test/test_compaction.pyc
+test/test_context.rst
+test/test_testsuite.py
+test/test_testsuite.pyc
+test/test-suite/.DS_Store
+test/test-suite/README
+test/test-suite/context.jsonld
+test/test-suite/manifest.jsonld
+test/test-suite/vocab.jsonld
+test/test-suite/vocab_context.jsonld
+test/test-suite/tests/fromRdf-0001-in.nq
+test/test-suite/tests/fromRdf-0001-out.jsonld
+test/test-suite/tests/fromRdf-0002-in.nq
+test/test-suite/tests/fromRdf-0002-out.jsonld
+test/test-suite/tests/fromRdf-0003-in.nq
+test/test-suite/tests/fromRdf-0003-out.jsonld
+test/test-suite/tests/fromRdf-0004-in.nq
+test/test-suite/tests/fromRdf-0004-out.jsonld
+test/test-suite/tests/fromRdf-0005-in.nq
+test/test-suite/tests/fromRdf-0005-out.jsonld
+test/test-suite/tests/fromRdf-0006-in.nq
+test/test-suite/tests/fromRdf-0006-out.jsonld
+test/test-suite/tests/fromRdf-0007-in.nq
+test/test-suite/tests/fromRdf-0007-out.jsonld
+test/test-suite/tests/fromRdf-0008-in.nq
+test/test-suite/tests/fromRdf-0008-out.jsonld
+test/test-suite/tests/fromRdf-0009-in.nq
+test/test-suite/tests/fromRdf-0009-out.jsonld
+test/test-suite/tests/fromRdf-0010-in.nq
+test/test-suite/tests/fromRdf-0010-out.jsonld
+test/test-suite/tests/fromRdf-0011-in.nq
+test/test-suite/tests/fromRdf-0011-out.jsonld
+test/test-suite/tests/fromRdf-0012-in.nq
+test/test-suite/tests/fromRdf-0012-out.jsonld
+test/test-suite/tests/fromRdf-0013-in.nq
+test/test-suite/tests/fromRdf-0013-out.jsonld
+test/test-suite/tests/fromRdf-0014-in.nq
+test/test-suite/tests/fromRdf-0014-out.jsonld
+test/test-suite/tests/fromRdf-0015-in.nq
+test/test-suite/tests/fromRdf-0015-out.jsonld
+test/test-suite/tests/fromRdf-0016-in.nq
+test/test-suite/tests/fromRdf-0016-out.jsonld
+test/test-suite/tests/fromRdf-0017-in.nq
+test/test-suite/tests/fromRdf-0017-out.jsonld
+test/test-suite/tests/fromRdf-0018-in.nq
+test/test-suite/tests/fromRdf-0018-out.jsonld
+test/test-suite/tests/fromRdf-0019-in.nq
+test/test-suite/tests/fromRdf-0019-out.jsonld
+test/test-suite/tests/fromRdf-manifest.jsonld
+test/test-suite/tests/toRdf-0001-in.jsonld
+test/test-suite/tests/toRdf-0001-out.nq
+test/test-suite/tests/toRdf-0002-in.jsonld
+test/test-suite/tests/toRdf-0002-out.nq
+test/test-suite/tests/toRdf-0003-in.jsonld
+test/test-suite/tests/toRdf-0003-out.nq
+test/test-suite/tests/toRdf-0004-in.jsonld
+test/test-suite/tests/toRdf-0004-out.nq
+test/test-suite/tests/toRdf-0005-in.jsonld
+test/test-suite/tests/toRdf-0005-out.nq
+test/test-suite/tests/toRdf-0006-in.jsonld
+test/test-suite/tests/toRdf-0006-out.nq
+test/test-suite/tests/toRdf-0007-in.jsonld
+test/test-suite/tests/toRdf-0007-out.nq
+test/test-suite/tests/toRdf-0008-in.jsonld
+test/test-suite/tests/toRdf-0008-out.nq
+test/test-suite/tests/toRdf-0009-in.jsonld
+test/test-suite/tests/toRdf-0009-out.nq
+test/test-suite/tests/toRdf-0010-in.jsonld
+test/test-suite/tests/toRdf-0010-out.nq
+test/test-suite/tests/toRdf-0011-in.jsonld
+test/test-suite/tests/toRdf-0011-out.nq
+test/test-suite/tests/toRdf-0012-in.jsonld
+test/test-suite/tests/toRdf-0012-out.nq
+test/test-suite/tests/toRdf-0013-in.jsonld
+test/test-suite/tests/toRdf-0013-out.nq
+test/test-suite/tests/toRdf-0014-in.jsonld
+test/test-suite/tests/toRdf-0014-out.nq
+test/test-suite/tests/toRdf-0015-in.jsonld
+test/test-suite/tests/toRdf-0015-out.nq
+test/test-suite/tests/toRdf-0016-in.jsonld
+test/test-suite/tests/toRdf-0016-out.nq
+test/test-suite/tests/toRdf-0017-in.jsonld
+test/test-suite/tests/toRdf-0017-out.nq
+test/test-suite/tests/toRdf-0018-in.jsonld
+test/test-suite/tests/toRdf-0018-out.nq
+test/test-suite/tests/toRdf-0019-in.jsonld
+test/test-suite/tests/toRdf-0019-out.nq
+test/test-suite/tests/toRdf-0020-in.jsonld
+test/test-suite/tests/toRdf-0020-out.nq
+test/test-suite/tests/toRdf-0022-in.jsonld
+test/test-suite/tests/toRdf-0022-out.nq
+test/test-suite/tests/toRdf-0023-in.jsonld
+test/test-suite/tests/toRdf-0023-out.nq
+test/test-suite/tests/toRdf-0024-in.jsonld
+test/test-suite/tests/toRdf-0024-out.nq
+test/test-suite/tests/toRdf-0025-in.jsonld
+test/test-suite/tests/toRdf-0025-out.nq
+test/test-suite/tests/toRdf-0026-in.jsonld
+test/test-suite/tests/toRdf-0026-out.nq
+test/test-suite/tests/toRdf-0027-in.jsonld
+test/test-suite/tests/toRdf-0027-out.nq
+test/test-suite/tests/toRdf-0028-in.jsonld
+test/test-suite/tests/toRdf-0028-out.nq
+test/test-suite/tests/toRdf-0029-in.jsonld
+test/test-suite/tests/toRdf-0029-out.nq
+test/test-suite/tests/toRdf-0030-in.jsonld
+test/test-suite/tests/toRdf-0030-out.nq
+test/test-suite/tests/toRdf-0031-in.jsonld
+test/test-suite/tests/toRdf-0031-out.nq
+test/test-suite/tests/toRdf-0032-in.jsonld
+test/test-suite/tests/toRdf-0032-out.nq
+test/test-suite/tests/toRdf-0033-in.jsonld
+test/test-suite/tests/toRdf-0033-out.nq
+test/test-suite/tests/toRdf-0034-in.jsonld
+test/test-suite/tests/toRdf-0034-out.nq
+test/test-suite/tests/toRdf-0035-in.jsonld
+test/test-suite/tests/toRdf-0035-out.nq
+test/test-suite/tests/toRdf-0036-in.jsonld
+test/test-suite/tests/toRdf-0036-out.nq
+test/test-suite/tests/toRdf-0041-in.jsonld
+test/test-suite/tests/toRdf-0041-out.nq
+test/test-suite/tests/toRdf-0042-in.jsonld
+test/test-suite/tests/toRdf-0042-out.nq
+test/test-suite/tests/toRdf-0043-in.jsonld
+test/test-suite/tests/toRdf-0043-out.nq
+test/test-suite/tests/toRdf-0044-in.jsonld
+test/test-suite/tests/toRdf-0044-out.nq
+test/test-suite/tests/toRdf-0045-in.jsonld
+test/test-suite/tests/toRdf-0045-out.nq
+test/test-suite/tests/toRdf-0046-in.jsonld
+test/test-suite/tests/toRdf-0046-out.nq
+test/test-suite/tests/toRdf-0047-in.jsonld
+test/test-suite/tests/toRdf-0047-out.nq
+test/test-suite/tests/toRdf-0048-in.jsonld
+test/test-suite/tests/toRdf-0048-out.nq
+test/test-suite/tests/toRdf-0049-in.jsonld
+test/test-suite/tests/toRdf-0049-out.nq
+test/test-suite/tests/toRdf-0050-in.jsonld
+test/test-suite/tests/toRdf-0050-out.nq
+test/test-suite/tests/toRdf-0051-in.jsonld
+test/test-suite/tests/toRdf-0051-out.nq
+test/test-suite/tests/toRdf-0052-in.jsonld
+test/test-suite/tests/toRdf-0052-out.nq
+test/test-suite/tests/toRdf-0053-in.jsonld
+test/test-suite/tests/toRdf-0053-out.nq
+test/test-suite/tests/toRdf-0054-in.jsonld
+test/test-suite/tests/toRdf-0054-out.nq
+test/test-suite/tests/toRdf-0055-in.jsonld
+test/test-suite/tests/toRdf-0055-out.nq
+test/test-suite/tests/toRdf-0056-in.jsonld
+test/test-suite/tests/toRdf-0056-out.nq
+test/test-suite/tests/toRdf-0057-in.jsonld
+test/test-suite/tests/toRdf-0057-out.nq
+test/test-suite/tests/toRdf-0058-in.jsonld
+test/test-suite/tests/toRdf-0058-out.nq
+test/test-suite/tests/toRdf-0059-in.jsonld
+test/test-suite/tests/toRdf-0059-out.nq
+test/test-suite/tests/toRdf-0060-in.jsonld
+test/test-suite/tests/toRdf-0060-out.nq
+test/test-suite/tests/toRdf-0061-in.jsonld
+test/test-suite/tests/toRdf-0061-out.nq
+test/test-suite/tests/toRdf-0062-in.jsonld
+test/test-suite/tests/toRdf-0062-out.nq
+test/test-suite/tests/toRdf-0063-in.jsonld
+test/test-suite/tests/toRdf-0063-out.nq
+test/test-suite/tests/toRdf-0064-in.jsonld
+test/test-suite/tests/toRdf-0064-out.nq
+test/test-suite/tests/toRdf-0065-in.jsonld
+test/test-suite/tests/toRdf-0065-out.nq
+test/test-suite/tests/toRdf-0066-in.jsonld
+test/test-suite/tests/toRdf-0066-out.nq
+test/test-suite/tests/toRdf-0067-in.jsonld
+test/test-suite/tests/toRdf-0067-out.nq
+test/test-suite/tests/toRdf-0068-in.jsonld
+test/test-suite/tests/toRdf-0068-out.nq
+test/test-suite/tests/toRdf-0069-in.jsonld
+test/test-suite/tests/toRdf-0069-out.nq
+test/test-suite/tests/toRdf-0070-in.jsonld
+test/test-suite/tests/toRdf-0070-out.nq
+test/test-suite/tests/toRdf-0071-in.jsonld
+test/test-suite/tests/toRdf-0071-out.nq
+test/test-suite/tests/toRdf-0072-in.jsonld
+test/test-suite/tests/toRdf-0072-out.nq
+test/test-suite/tests/toRdf-0073-in.jsonld
+test/test-suite/tests/toRdf-0073-out.nq
+test/test-suite/tests/toRdf-0074-in.jsonld
+test/test-suite/tests/toRdf-0074-out.nq
+test/test-suite/tests/toRdf-0075-in.jsonld
+test/test-suite/tests/toRdf-0075-out.nq
+test/test-suite/tests/toRdf-0076-in.jsonld
+test/test-suite/tests/toRdf-0076-out.nq
+test/test-suite/tests/toRdf-0077-in.jsonld
+test/test-suite/tests/toRdf-0077-out.nq
+test/test-suite/tests/toRdf-0078-in.jsonld
+test/test-suite/tests/toRdf-0078-out.nq
+test/test-suite/tests/toRdf-0079-in.jsonld
+test/test-suite/tests/toRdf-0079-out.nq
+test/test-suite/tests/toRdf-0080-in.jsonld
+test/test-suite/tests/toRdf-0080-out.nq
+test/test-suite/tests/toRdf-0081-in.jsonld
+test/test-suite/tests/toRdf-0081-out.nq
+test/test-suite/tests/toRdf-0082-in.jsonld
+test/test-suite/tests/toRdf-0082-out.nq
+test/test-suite/tests/toRdf-0083-in.jsonld
+test/test-suite/tests/toRdf-0083-out.nq
+test/test-suite/tests/toRdf-0084-in.jsonld
+test/test-suite/tests/toRdf-0084-out.nq
+test/test-suite/tests/toRdf-0085-in.jsonld
+test/test-suite/tests/toRdf-0085-out.nq
+test/test-suite/tests/toRdf-0086-in.jsonld
+test/test-suite/tests/toRdf-0086-out.nq
+test/test-suite/tests/toRdf-0087-in.jsonld
+test/test-suite/tests/toRdf-0087-out.nq
+test/test-suite/tests/toRdf-0088-in.jsonld
+test/test-suite/tests/toRdf-0088-out.nq
+test/test-suite/tests/toRdf-0089-in.jsonld
+test/test-suite/tests/toRdf-0089-out.nq
+test/test-suite/tests/toRdf-0090-in.jsonld
+test/test-suite/tests/toRdf-0090-out.nq
+test/test-suite/tests/toRdf-0091-in.jsonld
+test/test-suite/tests/toRdf-0091-out.nq
+test/test-suite/tests/toRdf-0092-in.jsonld
+test/test-suite/tests/toRdf-0092-out.nq
+test/test-suite/tests/toRdf-0093-in.jsonld
+test/test-suite/tests/toRdf-0093-out.nq
+test/test-suite/tests/toRdf-0094-in.jsonld
+test/test-suite/tests/toRdf-0094-out.nq
+test/test-suite/tests/toRdf-0095-in.jsonld
+test/test-suite/tests/toRdf-0095-out.nq
+test/test-suite/tests/toRdf-0096-in.jsonld
+test/test-suite/tests/toRdf-0096-out.nq
+test/test-suite/tests/toRdf-0097-in.jsonld
+test/test-suite/tests/toRdf-0097-out.nq
+test/test-suite/tests/toRdf-0098-in.jsonld
+test/test-suite/tests/toRdf-0098-out.nq
+test/test-suite/tests/toRdf-0099-in.jsonld
+test/test-suite/tests/toRdf-0099-out.nq
+test/test-suite/tests/toRdf-0100-in.jsonld
+test/test-suite/tests/toRdf-0100-out.nq
+test/test-suite/tests/toRdf-0101-in.jsonld
+test/test-suite/tests/toRdf-0101-out.nq
+test/test-suite/tests/toRdf-0102-in.jsonld
+test/test-suite/tests/toRdf-0102-out.nq
+test/test-suite/tests/toRdf-0103-in.jsonld
+test/test-suite/tests/toRdf-0103-out.nq
+test/test-suite/tests/toRdf-0104-in.jsonld
+test/test-suite/tests/toRdf-0104-out.nq
+test/test-suite/tests/toRdf-0105-in.jsonld
+test/test-suite/tests/toRdf-0105-out.nq
+test/test-suite/tests/toRdf-0106-in.jsonld
+test/test-suite/tests/toRdf-0106-out.nq
+test/test-suite/tests/toRdf-0107-in.jsonld
+test/test-suite/tests/toRdf-0107-out.nq
+test/test-suite/tests/toRdf-0108-in.jsonld
+test/test-suite/tests/toRdf-0108-out.nq
+test/test-suite/tests/toRdf-0109-in.jsonld
+test/test-suite/tests/toRdf-0109-out.nq
+test/test-suite/tests/toRdf-0110-in.jsonld
+test/test-suite/tests/toRdf-0110-out.nq
+test/test-suite/tests/toRdf-0111-in.jsonld
+test/test-suite/tests/toRdf-0111-out.nq
+test/test-suite/tests/toRdf-0112-in.jsonld
+test/test-suite/tests/toRdf-0112-out.nq
+test/test-suite/tests/toRdf-0113-in.jsonld
+test/test-suite/tests/toRdf-0113-out.nq
+test/test-suite/tests/toRdf-0114-in.jsonld
+test/test-suite/tests/toRdf-0114-out.nq
+test/test-suite/tests/toRdf-0115-in.jsonld
+test/test-suite/tests/toRdf-0115-out.nq
+test/test-suite/tests/toRdf-0116-in.jsonld
+test/test-suite/tests/toRdf-0116-out.nq
+test/test-suite/tests/toRdf-0117-in.jsonld
+test/test-suite/tests/toRdf-0117-out.nq
+test/test-suite/tests/toRdf-0118-in.jsonld
+test/test-suite/tests/toRdf-0118-out.nq
+test/test-suite/tests/toRdf-0119-in.jsonld
+test/test-suite/tests/toRdf-0119-out.nq
+test/test-suite/tests/toRdf-manifest.jsonld
\ No newline at end of file
diff --git a/rdflib_jsonld.egg-info/dependency_links.txt b/rdflib_jsonld.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/rdflib_jsonld.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/rdflib_jsonld.egg-info/entry_points.txt b/rdflib_jsonld.egg-info/entry_points.txt
new file mode 100644
index 0000000..230ae31
--- /dev/null
+++ b/rdflib_jsonld.egg-info/entry_points.txt
@@ -0,0 +1,6 @@
+[rdf.plugins.parser]
+json-ld = rdflib_jsonld.parser:JsonLDParser
+
+[rdf.plugins.serializer]
+json-ld = rdflib_jsonld.serializer:JsonLDSerializer
+
diff --git a/rdflib_jsonld.egg-info/requires.txt b/rdflib_jsonld.egg-info/requires.txt
new file mode 100644
index 0000000..4776c71
--- /dev/null
+++ b/rdflib_jsonld.egg-info/requires.txt
@@ -0,0 +1 @@
+rdflib>=4.2
\ No newline at end of file
diff --git a/rdflib_jsonld.egg-info/top_level.txt b/rdflib_jsonld.egg-info/top_level.txt
new file mode 100644
index 0000000..607dc35
--- /dev/null
+++ b/rdflib_jsonld.egg-info/top_level.txt
@@ -0,0 +1 @@
+rdflib_jsonld
diff --git a/rdflib_jsonld/__init__.py b/rdflib_jsonld/__init__.py
new file mode 100644
index 0000000..1a8f722
--- /dev/null
+++ b/rdflib_jsonld/__init__.py
@@ -0,0 +1,3 @@
+"""
+"""
+__version__ = "0.3"
diff --git a/rdflib_jsonld/context.py b/rdflib_jsonld/context.py
new file mode 100644
index 0000000..80b0ae1
--- /dev/null
+++ b/rdflib_jsonld/context.py
@@ -0,0 +1,269 @@
+# -*- coding: utf-8 -*-
+"""
+Implementation of the JSON-LD Context structure. See:
+
+    http://json-ld.org/
+
+"""
+from rdflib.namespace import RDF
+
+from .util import source_to_json, urljoin, split_iri, norm_url
+from .keys import (BASE, CONTAINER, CONTEXT, GRAPH, ID, INDEX, LANG, LIST,
+        REV, SET, TYPE, VALUE, VOCAB)
+
+
+NODE_KEYS = set([LANG, ID, TYPE, VALUE, LIST, SET, REV, GRAPH])
+
+class Defined(int): pass
+UNDEF = Defined(0)
+
+
+class Context(object):
+
+    def __init__(self, source=None, base=None):
+        self.language = None
+        self.vocab = None
+        self.base = base
+        self.doc_base = base
+        self.terms = {}
+        self._alias = {}
+        self._lookup = {}
+        self._prefixes = {}
+        self.active = False
+        if source:
+            self.load(source)
+
+    def load(self, source, base=None):
+        self.active = True
+        inputs = not isinstance(source, list) and [source] or source
+        sources = []
+        for source in inputs:
+            if isinstance(source, basestring):
+                url = urljoin(base, source)
+                #if url in visited_urls: continue
+                #visited_urls.append(url)
+                source = source_to_json(url)
+            if isinstance(source, dict):
+                if CONTEXT in source:
+                    source = source[CONTEXT]
+            if isinstance(source, list):
+                sources.extend(source)
+            else:
+                sources.append(source)
+        for source in sources:
+            self._read_source(source)
+
+    def subcontext(self, source):
+        # IMPROVE: to optimize, implement SubContext with parent fallback support
+        ctx = Context()
+        ctx.language = self.language
+        ctx.vocab = self.vocab
+        ctx.base = self.base
+        ctx.doc_base = self.doc_base
+        ctx._alias = self._alias.copy()
+        ctx.terms = self.terms.copy()
+        ctx._lookup = self._lookup.copy()
+        ctx._prefixes = self._prefixes.copy()
+        ctx.load(source)
+        return ctx
+
+    def get_id(self, obj):
+        return self._get(obj, ID)
+
+    def get_type(self, obj):
+        return self._get(obj, TYPE)
+
+    def get_language(self, obj):
+        return self._get(obj, LANG)
+
+    def get_value(self, obj):
+        return self._get(obj, VALUE)
+
+    def get_graph(self, obj):
+        return self._get(obj, GRAPH)
+
+    def get_list(self, obj):
+        return self._get(obj, LIST)
+
+    def get_set(self, obj):
+        return self._get(obj, SET)
+
+    def get_rev(self, obj):
+        return self._get(obj, REV)
+
+    def _get(self, obj, key):
+        return obj.get(self._alias.get(key)) or obj.get(key)
+
+    def get_key(self, key):
+        return self._alias.get(key, key)
+
+    lang_key = property(lambda self: self.get_key(LANG))
+    id_key = property(lambda self: self.get_key(ID))
+    type_key = property(lambda self: self.get_key(TYPE))
+    value_key = property(lambda self: self.get_key(VALUE))
+    list_key = property(lambda self: self.get_key(LIST))
+    rev_key = property(lambda self: self.get_key(REV))
+    graph_key = property(lambda self: self.get_key(GRAPH))
+
+    def add_term(self, name, idref, coercion=UNDEF, container=UNDEF,
+            language=UNDEF, reverse=False):
+        term = Term(idref, name, coercion, container, language, reverse)
+        self.terms[name] = term
+        self._lookup[(idref, coercion or language, container, reverse)] = term
+        self._prefixes[idref] = name
+
+    def find_term(self, idref, coercion=None, container=UNDEF,
+            language=None, reverse=False):
+        lu = self._lookup
+        if coercion is None:
+            coercion = language
+        if coercion is not UNDEF and container:
+            found = lu.get((idref, coercion, container, reverse))
+            if found: return found
+        if coercion is not UNDEF:
+            found = lu.get((idref, coercion, UNDEF, reverse))
+            if found: return found
+        if container:
+            found = lu.get((idref, coercion, container, reverse))
+            if found: return found
+        elif language:
+            found = lu.get((idref, UNDEF, LANG, reverse))
+            if found: return found
+        else:
+            found = lu.get((idref, coercion or UNDEF, SET, reverse))
+            if found: return found
+        return lu.get((idref, UNDEF, UNDEF, reverse))
+
+    def resolve(self, curie_or_iri):
+        iri = self.expand(curie_or_iri, False)
+        if iri.startswith('_:'):
+            return iri
+        return self.resolve_iri(iri)
+
+    def resolve_iri(self, iri):
+        return norm_url(self.base, iri)
+
+    def expand(self, term_curie_or_iri, use_vocab=True):
+        if use_vocab:
+            term = self.terms.get(term_curie_or_iri)
+            if term:
+                return term.id
+        is_term, pfx, local = self._prep_expand(term_curie_or_iri)
+        if pfx == '_':
+            return term_curie_or_iri
+        if pfx is not None:
+            ns = self.terms.get(pfx)
+            if ns and ns.id:
+                return ns.id + local
+        elif is_term and use_vocab:
+            if self.vocab:
+                return self.vocab + term_curie_or_iri
+            return None
+        return self.resolve_iri(term_curie_or_iri)
+
+    def shrink_iri(self, iri):
+        ns, name = split_iri(unicode(iri))
+        pfx = self._prefixes.get(ns)
+        if pfx:
+            return u":".join((pfx, name))
+        return iri
+
+    def to_symbol(self, iri):
+        iri = unicode(iri)
+        term = self.find_term(iri)
+        if term:
+            return term.name
+        ns, name = split_iri(iri)
+        if ns == self.vocab:
+            return name
+        pfx = self._prefixes.get(ns)
+        if pfx:
+            return u":".join((pfx, name))
+        return iri
+
+    def _read_source(self, source):
+        self.vocab = source.get(VOCAB, self.vocab)
+        for key, value in source.items():
+            if key == LANG:
+                self.language = value
+            elif key == VOCAB:
+                continue
+            elif key == BASE:
+                # TODO: only base to None if source is embedded
+                #if value is None and remote:
+                #    self.base = self.doc_base
+                #else:
+                self.base = value
+            else:
+                self._read_term(source, key, value)
+
+    def _read_term(self, source, name, dfn):
+        if isinstance(dfn, dict):
+            #term = self._create_term(source, key, value)
+            rev = dfn.get(REV)
+            idref = rev or dfn.get(ID, UNDEF)
+            if idref == TYPE:
+                idref = unicode(RDF.type)
+            elif idref is not UNDEF:
+                idref = self._rec_expand(source, idref)
+            elif ':' in name:
+                idref = self._rec_expand(source, name)
+            elif self.vocab:
+                idref = self.vocab + name
+            coercion = dfn.get(TYPE, UNDEF)
+            if coercion and coercion not in (ID, TYPE, VOCAB):
+                coercion = self._rec_expand(source, coercion)
+            self.add_term(name, idref, coercion,
+                    dfn.get(CONTAINER, UNDEF), dfn.get(LANG, UNDEF), bool(rev))
+        else:
+            idref = self._rec_expand(source, dfn)
+            self.add_term(name, idref)
+        if idref in NODE_KEYS:
+            self._alias[idref] = name
+
+    def _rec_expand(self, source, expr, prev=None):
+        if expr == prev or expr in NODE_KEYS:
+            return expr
+        is_term, pfx, nxt = self._prep_expand(expr)
+        if pfx:
+            iri = self._get_source_id(source, pfx) or self.expand(pfx)
+            if iri is None:
+                nxt = expr
+            else:
+                nxt = iri + nxt
+        else:
+            nxt = self._get_source_id(source, nxt) or nxt
+            if ':' not in nxt and self.vocab:
+                return self.vocab + nxt
+        return self._rec_expand(source, nxt, expr)
+
+    def _prep_expand(self, expr):
+        if ':' not in expr:
+            return True, None, expr
+        pfx, local = expr.split(':', 1)
+        if not local.startswith('//'):
+            return False, pfx, local
+        else:
+            return False, None, expr
+
+    def _get_source_id(self, source, key):
+        # .. from source dict or if already defined
+        term = source.get(key)
+        if term is None:
+            dfn = self.terms.get(key)
+            if dfn:
+                term = dfn.id
+        elif isinstance(term, dict):
+            term = term.get(ID)
+        return term
+
+
+class Term(object):
+    def __init__(self, idref, name, coercion=UNDEF, container=UNDEF,
+            language=UNDEF, reverse=False):
+        self.name = name
+        self.id = idref
+        self.type = coercion
+        self.container = container
+        self.language = language
+        self.reverse = reverse
diff --git a/rdflib_jsonld/keys.py b/rdflib_jsonld/keys.py
new file mode 100644
index 0000000..ac7abfe
--- /dev/null
+++ b/rdflib_jsonld/keys.py
@@ -0,0 +1,13 @@
+BASE = u'@base'
+CONTAINER = u'@container'
+CONTEXT = u'@context'
+GRAPH = u'@graph'
+ID = u'@id'
+INDEX = u'@index'
+LANG = u'@language'
+LIST = u'@list'
+REV = u'@reverse'
+SET = u'@set'
+TYPE = u'@type'
+VALUE = u'@value'
+VOCAB = u'@vocab'
diff --git a/rdflib_jsonld/parser.py b/rdflib_jsonld/parser.py
new file mode 100644
index 0000000..89fb739
--- /dev/null
+++ b/rdflib_jsonld/parser.py
@@ -0,0 +1,316 @@
+# -*- coding: utf-8 -*-
+"""
+This parser will interpret a JSON-LD document as an RDF Graph. See:
+
+    http://json-ld.org/
+
+Example usage::
+
+    >>> from rdflib.plugin import register, Parser
+    >>> register('json-ld', Parser, 'rdflib_jsonld.parser', 'JsonLDParser')
+
+    >>> from rdflib import Graph, URIRef, Literal
+    >>> test_json = '''
+    ... {
+    ...     "@context": {
+    ...         "dc": "http://purl.org/dc/terms/",
+    ...         "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    ...         "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+    ...     },
+    ...     "@id": "http://example.org/about",
+    ...     "dc:title": {
+    ...         "@language": "en",
+    ...         "@value": "Someone's Homepage"
+    ...     }
+    ... }
+    ... '''
+    >>> g = Graph().parse(data=test_json, format='json-ld')
+    >>> list(g) == [(URIRef('http://example.org/about'),
+    ...     URIRef('http://purl.org/dc/terms/title'),
+    ...     Literal("Someone's Homepage", lang='en'))]
+    True
+
+"""
+# NOTE: This code reads the entire JSON object into memory before parsing, but
+# we should consider streaming the input to deal with arbitrarily large graphs.
+
+import warnings
+from rdflib.graph import ConjunctiveGraph
+from rdflib.parser import Parser, URLInputSource
+from rdflib.namespace import RDF, XSD
+from rdflib.term import URIRef, BNode, Literal
+
+from .context import Context, Term, UNDEF
+from .util import source_to_json, VOCAB_DELIMS, context_from_urlinputsource
+from .keys import CONTEXT, GRAPH, ID, INDEX, LANG, LIST, REV, SET, TYPE, VALUE, VOCAB
+
+__all__ = ['JsonLDParser', 'to_rdf']
+
+
+TYPE_TERM = Term(unicode(RDF.type), TYPE, VOCAB)
+
+
+class JsonLDParser(Parser):
+    def __init__(self):
+        super(JsonLDParser, self).__init__()
+
+    def parse(self, source, sink, **kwargs):
+        # TODO: docstring w. args and return value
+        encoding = kwargs.get('encoding') or 'utf-8'
+        if encoding not in ('utf-8', 'utf-16'):
+            warnings.warn("JSON should be encoded as unicode. " +
+                          "Given encoding was: %s" % encoding)
+
+        base = kwargs.get('base') or sink.absolutize(
+            source.getPublicId() or source.getSystemId() or "")
+        context_data = kwargs.get('context')
+        if not context_data and isinstance(source, URLInputSource):
+            context_data = context_from_urlinputsource(source)
+        produce_generalized_rdf = kwargs.get('produce_generalized_rdf', False)
+
+        data = source_to_json(source)
+        conj_sink = ConjunctiveGraph(
+            store=sink.store, identifier=sink.identifier)
+        to_rdf(data, conj_sink, base, context_data)
+
+
+generalized_rdf = False
+def to_rdf(data, graph, base=None, context_data=None, produce_generalized_rdf=False):
+    # TODO: docstring w. args and return value
+    global generalized_rdf # FIXME: not thread-safe and error-prone
+    generalized_rdf = produce_generalized_rdf
+    context = Context(base=base)
+
+    if context_data:
+        context.load(context_data)
+
+    topcontext = False
+
+    if isinstance(data, list):
+        resources = data
+    elif isinstance(data, dict):
+        l_ctx = data.get(CONTEXT)
+        if l_ctx:
+            context.load(l_ctx, base)
+            topcontext = True
+        resources = data
+        if not isinstance(resources, list):
+            resources = [resources]
+
+    if context.vocab:
+        graph.bind(None, context.vocab)
+    for name, term in context.terms.items():
+        if term.id and term.id.endswith(VOCAB_DELIMS):
+            graph.bind(name, term.id)
+
+    for node in resources:
+        _add_to_graph(graph, graph, context, node, topcontext)
+
+    return graph
+
+
+def _add_to_graph(dataset, graph, context, node, topcontext=False):
+    if not isinstance(node, dict) or context.get_value(node):
+        return
+
+    if CONTEXT in node and not topcontext:
+        l_ctx = node.get(CONTEXT)
+        if l_ctx:
+            context = context.subcontext(l_ctx)
+        else:
+            context = Context(base=context.doc_base)
+
+    id_val = context.get_id(node)
+    if isinstance(id_val, basestring):
+        subj = _to_rdf_id(context, id_val)
+    else:
+        subj = BNode()
+
+    if subj is None:
+        return None
+
+    for key, obj in node.items():
+        if key in (CONTEXT, ID, context.get_key(ID)):
+            continue
+        if key in (REV, context.get_key(REV)):
+            for rkey, robj in obj.items():
+                _key_to_graph(dataset, graph, context, subj, rkey, robj, True)
+        else:
+            _key_to_graph(dataset, graph, context, subj, key, obj)
+
+    return subj
+
+
+def _key_to_graph(dataset, graph, context, subj, key, obj, reverse=False):
+
+    if isinstance(obj, list):
+        obj_nodes = obj
+    else:
+        obj_nodes = [obj]
+
+    term = context.terms.get(key)
+    if term:
+        term_id = term.id
+        if term.container == LIST:
+            obj_nodes = [{LIST: obj_nodes}]
+        elif isinstance(obj, dict):
+            if term.container == INDEX:
+                obj_nodes = []
+                for values in obj.values():
+                    if not isinstance(values, list):
+                        obj_nodes.append(values)
+                    else:
+                        obj_nodes += values
+            elif term.container == LANG:
+                obj_nodes = []
+                for lang, values in obj.items():
+                    if not isinstance(values, list):
+                        values = [values]
+                    for v in values:
+                        obj_nodes.append((v, lang))
+    else:
+        term_id = None
+
+    if TYPE in (key, term_id):
+        term = TYPE_TERM
+    elif GRAPH in (key, term_id):
+        #assert graph.context_aware
+        subgraph = dataset.get_context(subj)
+        for onode in obj_nodes:
+            _add_to_graph(dataset, subgraph, context, onode)
+        return
+    elif SET in (key, term_id):
+        for onode in obj_nodes:
+            _add_to_graph(dataset, graph, context, onode)
+        return
+
+    pred_uri = term.id if term else context.expand(key)
+
+    flattened = []
+    for obj in obj_nodes:
+        if isinstance(obj, dict):
+            objs = context.get_set(obj)
+            if objs is not None:
+                obj = objs
+        if isinstance(obj, list):
+            flattened += obj
+            continue
+        flattened.append(obj)
+    obj_nodes = flattened
+
+    if not pred_uri:
+        return
+
+    if term and term.reverse:
+        reverse = not reverse
+
+    bid = _get_bnodeid(pred_uri)
+    if bid:
+        if not generalized_rdf:
+            return
+        pred = BNode(bid)
+    else:
+        pred = URIRef(pred_uri)
+    for obj_node in obj_nodes:
+        obj = _to_object(dataset, graph, context, term, obj_node)
+        if obj is None:
+            continue
+        if reverse:
+            graph.add((obj, pred, subj))
+        else:
+            graph.add((subj, pred, obj))
+
+
+def _to_object(dataset, graph, context, term, node, inlist=False):
+
+    if node is None:
+        return
+
+    if isinstance(node, tuple):
+        value, lang = node
+        if value is None:
+            return
+        return Literal(value, lang=lang)
+
+    if isinstance(node, dict):
+        node_list = context.get_list(node)
+        if node_list is not None:
+            if inlist: # TODO: and NO_LISTS_OF_LISTS
+                return
+            listref = _add_list(dataset, graph, context, term, node_list)
+            if listref:
+                return listref
+
+    else: # expand..
+        if not term or not term.type:
+            if isinstance(node, float):
+                return Literal(node, datatype=XSD.double)
+            if term and term.language is not UNDEF:
+                lang = term.language
+            else:
+                lang = context.language
+            return Literal(node, lang=lang)
+        else:
+            if term.type == ID:
+                node = {ID: context.resolve(node)}
+            elif term.type == VOCAB:
+                node = {ID: context.expand(node) or context.resolve_iri(node)}
+            else:
+                node = {TYPE: term.type,
+                        VALUE: node}
+
+    lang = context.get_language(node)
+    if lang or context.get_key(VALUE) in node or VALUE in node:
+        value = context.get_value(node)
+        if value is None:
+            return None
+        datatype = not lang and context.get_type(node) or None
+        if lang:
+            return Literal(value, lang=lang)
+        elif datatype:
+            return Literal(value, datatype=context.expand(datatype))
+        else:
+            return Literal(value)
+    else:
+        return _add_to_graph(dataset, graph, context, node)
+
+
+def _to_rdf_id(context, id_val):
+    bid = _get_bnodeid(id_val)
+    if bid:
+        return BNode(bid)
+    else:
+        uri = context.resolve(id_val)
+        if not generalized_rdf and ':' not in uri:
+            return None
+        return URIRef(uri)
+
+
+def _get_bnodeid(ref):
+    if not ref.startswith('_:'):
+        return
+    bid = ref.split('_:', 1)[-1]
+    return bid or None
+
+
+def _add_list(dataset, graph, context, term, node_list):
+    if not isinstance(node_list, list):
+        node_list = [node_list]
+    first_subj = BNode()
+    subj, rest = first_subj, None
+    for node in node_list:
+        if node is None:
+            continue
+        if rest:
+            graph.add((subj, RDF.rest, rest))
+            subj = rest
+        obj = _to_object(dataset, graph, context, term, node, inlist=True)
+        if obj is None:
+            continue
+        graph.add((subj, RDF.first, obj))
+        rest = BNode()
+    if rest:
+        graph.add((subj, RDF.rest, RDF.nil))
+        return first_subj
+    else:
+        return RDF.nil
diff --git a/rdflib_jsonld/serializer.py b/rdflib_jsonld/serializer.py
new file mode 100644
index 0000000..a6987df
--- /dev/null
+++ b/rdflib_jsonld/serializer.py
@@ -0,0 +1,358 @@
+# -*- coding: utf-8 -*-
+"""
+This serialiser will output an RDF Graph as a JSON-LD formatted document. See:
+
+    http://json-ld.org/
+
+Example usage::
+
+    >>> from rdflib.plugin import register, Serializer
+    >>> register('json-ld', Serializer, 'rdflib_jsonld.serializer', 'JsonLDSerializer')
+
+    >>> from rdflib import Graph
+
+    >>> testrdf = '''
+    ... @prefix dc: <http://purl.org/dc/terms/> .
+    ... <http://example.org/about>
+    ...     dc:title "Someone's Homepage"@en .
+    ... '''
+
+    >>> g = Graph().parse(data=testrdf, format='n3')
+
+    >>> print(g.serialize(format='json-ld', indent=4).decode())
+    [
+        {
+            "@id": "http://example.org/about",
+            "http://purl.org/dc/terms/title": [
+                {
+                    "@language": "en",
+                    "@value": "Someone's Homepage"
+                }
+            ]
+        }
+    ]
+
+"""
+
+# NOTE: This code writes the entire JSON object into memory before serialising,
+# but we should consider streaming the output to deal with arbitrarily large
+# graphs.
+
+import warnings
+
+from rdflib.serializer import Serializer
+from rdflib.graph import Graph
+from rdflib.term import URIRef, Literal, BNode
+from rdflib.namespace import RDF, XSD
+
+from .context import Context, UNDEF
+from .util import json
+from .keys import CONTEXT, GRAPH, ID, VOCAB, LIST, SET, LANG
+
+__all__ = ['JsonLDSerializer', 'from_rdf']
+
+
+PLAIN_LITERAL_TYPES = set([XSD.boolean, XSD.integer, XSD.double, XSD.string])
+
+
+class JsonLDSerializer(Serializer):
+    def __init__(self, store):
+        super(JsonLDSerializer, self).__init__(store)
+
+    def serialize(self, stream, base=None, encoding=None, **kwargs):
+        # TODO: docstring w. args and return value
+        encoding = encoding or 'utf-8'
+        if encoding not in ('utf-8', 'utf-16'):
+            warnings.warn("JSON should be encoded as unicode. " +
+                          "Given encoding was: %s" % encoding)
+
+        context_data = kwargs.get('context')
+        use_native_types = kwargs.get('use_native_types', False),
+        use_rdf_type = kwargs.get('use_rdf_type', False)
+        auto_compact = kwargs.get('auto_compact', False)
+
+        indent = kwargs.get('indent', 2)
+        separators = kwargs.get('separators', (',', ': '))
+        sort_keys = kwargs.get('sort_keys', True)
+        ensure_ascii = kwargs.get('ensure_ascii', False)
+
+        obj = from_rdf(self.store, context_data, base,
+                use_native_types, use_rdf_type,
+                auto_compact=auto_compact)
+
+        data = json.dumps(obj, indent=indent, separators=separators,
+                          sort_keys=sort_keys, ensure_ascii=ensure_ascii)
+
+        stream.write(data.encode(encoding, 'replace'))
+
+
+def from_rdf(graph, context_data=None, base=None,
+        use_native_types=False, use_rdf_type=False,
+        auto_compact=False, startnode=None, index=False):
+    # TODO: docstring w. args and return value
+    # TODO: support for index and startnode
+
+    if not context_data and auto_compact:
+        context_data = dict(
+            (pfx, unicode(ns))
+            for (pfx, ns) in graph.namespaces() if pfx and
+            unicode(ns) != u"http://www.w3.org/XML/1998/namespace")
+
+    if isinstance(context_data, Context):
+        context = context_data
+        context_data = context.to_dict()
+    else:
+        context = Context(context_data, base=base)
+
+    converter = Converter(context, use_native_types, use_rdf_type)
+    result = converter.convert(graph)
+
+    if converter.context.active:
+        if isinstance(result, list):
+            result = {context.get_key(GRAPH): result}
+        result[CONTEXT] = context_data
+
+    return result
+
+
+class Converter(object):
+
+    def __init__(self, context, use_native_types, use_rdf_type):
+        self.context = context
+        self.use_native_types = context.active or use_native_types
+        self.use_rdf_type = use_rdf_type
+
+    def convert(self, graph):
+        # TODO: bug in rdflib dataset parsing (nquads et al):
+        # plain triples end up in separate unnamed graphs (rdflib issue #436)
+        if graph.context_aware:
+            default_graph = Graph()
+            graphs = [default_graph]
+            for g in graph.contexts():
+                if isinstance(g.identifier, URIRef):
+                    graphs.append(g)
+                else:
+                    default_graph += g
+        else:
+            graphs = [graph]
+
+        context = self.context
+
+        objs = []
+        for g in graphs:
+            obj = {}
+            graphname = None
+
+            if isinstance(g.identifier, URIRef):
+                graphname = context.shrink_iri(g.identifier)
+                obj[context.id_key] = graphname
+
+            nodes = self.from_graph(g)
+
+            if not graphname and len(nodes) == 1:
+                obj.update(nodes[0])
+            else:
+                if not nodes:
+                    continue
+                obj[context.graph_key] = nodes
+
+            if objs and objs[0].get(context.get_key(ID)) == graphname:
+                objs[0].update(obj)
+            else:
+                objs.append(obj)
+
+        if len(graphs) == 1 and len(objs) == 1 and not self.context.active:
+            default = objs[0]
+            items = default.get(context.graph_key)
+            if len(default) == 1 and items:
+                objs = items
+        elif len(objs) == 1 and self.context.active:
+            objs = objs[0]
+
+        return objs
+
+    def from_graph(self, graph):
+        nodemap = {}
+
+        for s in set(graph.subjects()):
+            ## only iri:s and unreferenced (rest will be promoted to top if needed)
+            if isinstance(s, URIRef) or (isinstance(s, BNode)
+                    and not any(graph.subjects(None, s))):
+                self.process_subject(graph, s, nodemap)
+
+        return nodemap.values()
+
+    def process_subject(self, graph, s, nodemap):
+        if isinstance(s, URIRef):
+            node_id = self.context.shrink_iri(s)
+        elif isinstance(s, BNode):
+            node_id = s.n3()
+        else:
+            node_id = None
+
+        #used_as_object = any(graph.subjects(None, s))
+        if node_id in nodemap:
+            return None
+
+        node = {}
+        node[self.context.id_key] = node_id
+        nodemap[node_id] = node
+
+        for p, o in graph.predicate_objects(s):
+            self.add_to_node(graph, s, p, o, node, nodemap)
+
+        return node
+
+    def add_to_node(self, graph, s, p, o, s_node, nodemap):
+        context = self.context
+
+        if isinstance(o, Literal):
+            datatype = unicode(o.datatype) if o.datatype else None
+            language = o.language
+            term = context.find_term(unicode(p), datatype, language=language)
+        else:
+            containers = [LIST, None] if graph.value(o, RDF.first) else [None]
+            for container in containers:
+                for coercion in (ID, VOCAB, UNDEF):
+                    term = context.find_term(unicode(p), coercion, container)
+                    if term:
+                        break
+                if term:
+                    break
+
+        node = None
+        use_set = not context.active
+
+        if term:
+            p_key = term.name
+
+            if term.type:
+                node = self.type_coerce(o, term.type)
+            elif term.language and o.language == term.language:
+                node = unicode(o)
+            elif context.language and (
+                    term.language is None and o.language is None):
+                node = unicode(o)
+
+            if term.container == SET:
+                use_set = True
+            elif term.container == LIST:
+                node = [self.type_coerce(v, term.type) or self.to_raw_value(graph, s, v, nodemap)
+                        for v in self.to_collection(graph, o)]
+            elif term.container == LANG and language:
+                value = s_node.setdefault(p_key, {})
+                values = value.get(language)
+                node = unicode(o)
+                if values:
+                    if not isinstance(values, list):
+                        value[language] = values = [values]
+                    values.append(node)
+                else:
+                    value[language] = node
+                return
+
+        else:
+            p_key = context.to_symbol(p)
+            # TODO: for coercing curies - quite clumsy; unify to_symbol and find_term?
+            key_term = context.terms.get(p_key)
+            if key_term and (key_term.type or key_term.container):
+                p_key = p
+            if not term and p == RDF.type and not self.use_rdf_type:
+                if isinstance(o, URIRef):
+                    node = context.to_symbol(o)
+                p_key = context.type_key
+
+        if node is None:
+            node = self.to_raw_value(graph, s, o, nodemap)
+
+        value = s_node.get(p_key)
+        if value:
+            if not isinstance(value, list):
+                value = [value]
+            value.append(node)
+        elif use_set:
+            value = [node]
+        else:
+            value = node
+        s_node[p_key] = value
+
+    def type_coerce(self, o, coerce_type):
+        if coerce_type == ID:
+            if isinstance(o, URIRef):
+                return self.context.shrink_iri(o)
+            elif isinstance(o, BNode):
+                return o.n3()
+            else:
+                return o
+        elif coerce_type == VOCAB and isinstance(o, URIRef):
+            return self.context.to_symbol(o)
+        elif isinstance(o, Literal) and unicode(o.datatype) == coerce_type:
+            return o
+        else:
+            return None
+
+    def to_raw_value(self, graph, s, o, nodemap):
+        context = self.context
+        coll = self.to_collection(graph, o)
+        if coll is not None:
+            coll = [self.to_raw_value(graph, s, lo, nodemap)
+                    for lo in self.to_collection(graph, o)]
+            return {context.list_key: coll}
+        elif isinstance(o, BNode):
+            embed = False # TODO: self.context.active or using startnode and only one ref
+            onode = self.process_subject(graph, o, nodemap)
+            if onode:
+                if embed and not any(s2 for s2 in graph.subjects(None, o) if s2 != s):
+                    return onode
+                else:
+                    nodemap[onode[context.id_key]] = onode
+            return {context.id_key: o.n3()}
+        elif isinstance(o, URIRef):
+            # TODO: embed if o != startnode (else reverse)
+            return {context.id_key: context.shrink_iri(o)}
+        elif isinstance(o, Literal):
+            # TODO: if compact
+            native = self.use_native_types and o.datatype in PLAIN_LITERAL_TYPES
+            if native:
+                v = o.toPython()
+            else:
+                v = unicode(o)
+            if o.datatype:
+                if native:
+                    if self.context.active:
+                        return v
+                    else:
+                        return {context.value_key: v}
+                return {context.type_key: context.to_symbol(o.datatype),
+                        context.value_key: v}
+            elif o.language and o.language != context.language:
+                return {context.lang_key: o.language,
+                        context.value_key: v}
+            elif not context.active or context.language and not o.language:
+                return {context.value_key: v}
+            else:
+                return v
+
+    def to_collection(self, graph, l):
+        if l != RDF.nil and not graph.value(l, RDF.first):
+            return None
+        list_nodes = []
+        chain = set([l])
+        while l:
+            if l == RDF.nil:
+                return list_nodes
+            if isinstance(l, URIRef):
+                return None
+            first, rest = None, None
+            for p, o in graph.predicate_objects(l):
+                if not first and p == RDF.first:
+                    first = o
+                elif not rest and p == RDF.rest:
+                    rest = o
+                elif p != RDF.type or o != RDF.List:
+                    return None
+            list_nodes.append(first)
+            l = rest
+            if l in chain:
+                return None
+            chain.add(l)
diff --git a/rdflib_jsonld/util.py b/rdflib_jsonld/util.py
new file mode 100644
index 0000000..f9f3581
--- /dev/null
+++ b/rdflib_jsonld/util.py
@@ -0,0 +1,68 @@
+try:
+    import json
+    assert json  # workaround for pyflakes issue #13
+except ImportError:
+    import simplejson as json
+
+from rdflib.py3compat import PY3
+
+from os import sep
+from os.path import normpath
+if PY3:
+    from urllib.parse import urljoin, urlsplit, urlunsplit
+else:
+    from urlparse import urljoin, urlsplit, urlunsplit
+
+from rdflib.parser import create_input_source
+if PY3:
+    from io import StringIO
+
+
+def source_to_json(source):
+    # TODO: conneg for JSON (fix support in rdflib's URLInputSource!)
+    source = create_input_source(source, format='json-ld')
+
+    stream = source.getByteStream()
+    try:
+        if PY3:
+            return json.load(StringIO(stream.read().decode('utf-8')))
+        else:
+            return json.load(stream)
+    finally:
+        stream.close()
+
+
+VOCAB_DELIMS = ('#', '/', ':')
+
+def split_iri(iri):
+    for delim in VOCAB_DELIMS:
+        at = iri.rfind(delim)
+        if at > -1:
+            return iri[:at+1], iri[at+1:]
+    return iri, None
+
+def norm_url(base, url):
+    url = urljoin(base, url)
+    parts = urlsplit(url)
+    path = normpath(parts[2])
+    if sep != '/':
+        path = '/'.join(path.split(sep))
+    if parts[2].endswith('/') and not path.endswith('/'):
+        path += '/'
+    result = urlunsplit(parts[0:2] + (path,) + parts[3:])
+    if url.endswith('#') and not result.endswith('#'):
+        result += '#'
+    return result
+
+def context_from_urlinputsource(source):
+    if source.content_type == 'application/json':
+        # response_info was added to InputSource in rdflib 4.2
+        try:
+            links = source.response_info.getallmatchingheaders('Link')
+        except AttributeError:
+            return
+        for link in links:
+            if ' rel="http://www.w3.org/ns/json-ld#context"' in link:
+                i, j = link.index('<'), link.index('>')
+                if i > -1 and j > -1:
+                    return urljoin(source.url, link[i+1:j])
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..16690c0
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,10 @@
+[nosetests]
+attr = !known_issue
+verbosity = 1
+with-doctest = 1
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..812a3e7
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import sys
+import re
+
+# Ridiculous as it may seem, we need to import multiprocessing and logging here
+# in order to get tests to pass smoothly on python 2.7.
+try:
+    import multiprocessing
+    import logging
+except:
+    pass
+
+
+def setup_python3():
+    # Taken from "distribute" setup.py
+    from distutils.filelist import FileList
+    from distutils import dir_util, file_util, util, log
+    from os.path import join
+
+    tmp_src = join("build", "src")
+    log.set_verbosity(1)
+    fl = FileList()
+    for line in open("MANIFEST.in"):
+        if not line.strip():
+            continue
+        fl.process_template_line(line)
+    dir_util.create_tree(tmp_src, fl.files)
+    outfiles_2to3 = []
+    for f in fl.files:
+        outf, copied = file_util.copy_file(f, join(tmp_src, f), update=1)
+        if copied and outf.endswith(".py"):
+            outfiles_2to3.append(outf)
+
+    util.run_2to3(outfiles_2to3)
+
+    # arrange setup to use the copy
+    sys.path.insert(0, tmp_src)
+
+    return tmp_src
+
+
+# Find version. We have to do this because we can't import it in Python 3 until
+# its been automatically converted in the setup process.
+def find_version(filename):
+    _version_re = re.compile(r'__version__ = "(.*)"')
+    for line in open(filename):
+        version_match = _version_re.match(line)
+        if version_match:
+            return version_match.group(1)
+
+__version__ = find_version('rdflib_jsonld/__init__.py')
+
+install_requires = ["rdflib>=4.0", ] 
+
+if sys.version_info[:2] < (2, 6):
+    install_requires += ["simplejson"]
+
+config = dict(
+    name = 'rdflib-jsonld',
+    description = "rdflib extension adding JSON-LD parser and serializer",
+    maintainer = "RDFLib Team",
+    maintainer_email = "http://groups.google.com/group/rdflib-dev",
+    url = "https://github.com/RDFLib/rdflib-jsonld",
+    version = __version__,
+    download_url = "https://github.com/RDFLib/rdflib-jsonld/zipball/master",
+    license = "BSD",
+    platforms = ["any"],
+    long_description = \
+    """
+    This parser/serialiser will
+
+    * read in an JSON-LD formatted document and create an RDF graph
+    * serialize an RDF graph to JSON-LD formatted output
+
+    See:
+
+        http://json-ld.org/
+    """,
+    classifiers = [
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 2",
+        "Programming Language :: Python :: 2.5",
+        "Programming Language :: Python :: 2.6",
+        "Programming Language :: Python :: 2.7",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.2",
+        "Programming Language :: Python :: 3.3",
+        "License :: OSI Approved :: BSD License",
+        "Topic :: Software Development :: Libraries :: Python Modules",
+        "Operating System :: OS Independent",
+        "Natural Language :: English",
+                   ],
+    packages = ["rdflib_jsonld"],
+    test_suite = "test",
+    install_requires = ["rdflib>=4.2"],
+    entry_points = {
+        'rdf.plugins.parser': [
+            'json-ld = rdflib_jsonld.parser:JsonLDParser',
+        ],
+        'rdf.plugins.serializer': [
+            'json-ld = rdflib_jsonld.serializer:JsonLDSerializer',
+        ],
+    }
+)
+
+if sys.version_info[0] >= 3:
+    from setuptools import setup
+    config.update({'use_2to3': True})
+    config.update({'src_root': setup_python3()})
+else:
+    try:
+        from setuptools import setup
+        config.update({'test_suite' : "nose.collector"})
+    except ImportError:
+        from distutils.core import setup
+
+
+setup(**config)
diff --git a/test/.DS_Store b/test/.DS_Store
new file mode 100644
index 0000000..84a765c
Binary files /dev/null and b/test/.DS_Store differ
diff --git a/test/README.md b/test/README.md
new file mode 100644
index 0000000..69dc9e2
--- /dev/null
+++ b/test/README.md
@@ -0,0 +1,9 @@
+The `test-suite` directory is a partial *copy* of the official test suite available at <http://www.w3.org/2013/json-ld-tests/>. Do *not* add tests directly there, but follow the instructions provided at the preceding location.
+
+To update this copy, first obtain a local copy of the json-ld-tests test-suite. Then copy the relevants parts of that directory into this test directory.
+
+You can do so by first defining a `$JSONLD_TESTSUITE` environment variable set to the local copy of the test-suite directory. Then run:
+
+    $ cp $JSONLD_TESTSUITE/*.jsonld test/test-suite/
+    $ cp $JSONLD_TESTSUITE/tests/{toRdf,fromRdf}-*.* test/test-suite/tests/
+
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..d93da84
--- /dev/null
+++ b/test/__init__.py
@@ -0,0 +1,15 @@
+from rdflib import plugin
+from rdflib import serializer
+from rdflib import parser
+assert plugin
+assert serializer
+assert parser
+try:
+    # This can be replaced by "import json" as soon as
+    # 2to3 stops rewriting it as "from . import json"
+    import imp
+    json = imp.load_module('json', *imp.find_module('json'))
+    assert json
+except ImportError:
+    import simplejson as json
+    assert json
diff --git a/test/__init__.pyc b/test/__init__.pyc
new file mode 100644
index 0000000..21b3cbb
Binary files /dev/null and b/test/__init__.pyc differ
diff --git a/test/earl-context.jsonld b/test/earl-context.jsonld
new file mode 100644
index 0000000..7f00745
--- /dev/null
+++ b/test/earl-context.jsonld
@@ -0,0 +1,24 @@
+{
+  "@context": {
+    "@vocab": "http://www.w3.org/ns/earl#",
+    "dc": "http://purl.org/dc/terms/",
+    "foaf": "http://xmlns.com/foaf/0.1/",
+    "doap": "http://usefulinc.com/ns/doap#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "Project": {"@id": "doap:Project"},
+    "projectpage": {"@id": "doap:homepage", "@type": "@id"},
+    "projectName": {"@id": "doap:name"},
+    "projectTitle": {"@id": "doap:title"},
+    "programmingLanguage": {"@id": "doap:programming-language"},
+    "homepage": {"@id": "foaf:homepage", "@type": "@id"},
+    "name": {"@id": "foaf:name"},
+    "outcome": {"@type": "@id"},
+    "test": {"@type": "@id"},
+    "assertedBy": {"@type": "@id"},
+    "license": {"@id": "doap:license", "@type": "@id"},
+    "creator": {"@id": "dc:creator", "@type": "@id"},
+    "mode": {"@type": "@vocab"},
+    "date": {"@id": "dc:date", "@type": "xsd:dateTime"},
+    "subjectOf": {"@reverse": "earl:subject" }
+  }
+}
diff --git a/test/test-suite/.DS_Store b/test/test-suite/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/test/test-suite/.DS_Store differ
diff --git a/test/test-suite/README b/test/test-suite/README
new file mode 100644
index 0000000..34d2f98
--- /dev/null
+++ b/test/test-suite/README
@@ -0,0 +1,62 @@
+Introduction
+------------
+
+The JSON-LD Test Suite is a set of tests that can
+be used to verify JSON-LD Processor conformance to the set of specifications
+that constitute JSON-LD. The goal of the suite is to provide an easy and
+comprehensive JSON-LD testing solution for developers creating JSON-LD Processors.
+
+Design
+------
+
+Tests are defined into _compact_, _expand_, _frame_, _normalize_, and _rdf_ sections:
+* _compact_ tests have _input_, _expected_ and _context_ documents. The _expected_ results
+  can be compared using JSON object comparison with the processor output.
+* _expand_ tests have _input_ and _expected_ documents. The _expected_ results
+  can be compared using JSON object comparison with the processor output.
+* _frame_ tests have _input_, _frame_ and _expected_ documents. The _expected_ results
+  can be compared using JSON object comparison with the processor output.
+* _normalize_ tests have _input_ and _expected_ documents. The _expected_ results
+  can be compared using string comparison with the processor output.
+* _rdf_ tests have _input_ and _sparql_ documents. The results are tested
+  by performing the RDF conversion and using this as the default document for an `ASK` query
+  contained within the _sparql_ document using a SPARQL endpoint. The end result is a
+  yes/no on whether the expected triples were extracted by the JSON-LD processor.
+
+
+Contributing
+------------
+
+If you would like to contribute a new test or a fix to an existing test,
+please follow these steps:
+
+1. Notify the JSON-LD mailing list, public-linked-json at w3.org,
+   that you will be creating a new test or fix and the purpose of the
+   change.
+2. Clone the git repository: git://github.com/json-ld/json-ld.org.git
+3. Make your changes and submit them via github, or via a 'git format-patch'
+   to the [JSON-LD mailing list](mailto:public-linked-json at w3.org).
+
+Optionally, you can ask for direct access to the repository and may make
+changes directly to the JSON-LD Test Suite source code. All updates to the test
+suite go live on Digital Bazaar's JSON-LD Test Suite site within seconds of
+committing changes to github via a WebHook call.
+
+How to Add a Unit Test
+----------------------
+
+In order to add a unit test, you must follow these steps:
+
+1. Pick a new unit test number. For example - 250. To be consistent, please use
+   the next available unit test number.
+2. Create a markup file in the tests/ directory with a .jsonld extension.
+   For example: tests/rdf-250.jsonld
+3. Create a SPARQL query file in the tests/ directory with a .jsonld or .sparql extension.
+   For example: tests/rdf-250.sparql
+4. Add your test to manifest.jsonld.
+
+The test suite is designed to empower JSON-LD processor maintainers to create
+and add tests as they see fit. This may mean that the test suite may become
+unstable from time to time, but this approach has been taken so that the
+long-term goal of having a comprehensive test suite for JSON-LD can be achieved
+by the JSON-LD community.
diff --git a/test/test-suite/context.jsonld b/test/test-suite/context.jsonld
new file mode 100644
index 0000000..238bbb6
--- /dev/null
+++ b/test/test-suite/context.jsonld
@@ -0,0 +1,31 @@
+{
+  "@context": {
+    "@vocab":   "http://json-ld.org/test-suite/vocab#",
+    "dc":       "http://purl.org/dc/terms/",
+    "jld":      "http://json-ld.org/test-suite/vocab#",
+    "mf":       "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#",
+    "rdfs":     "http://www.w3.org/2000/01/rdf-schema#",
+    "xsd":      "http://www.w3.org/2001/XMLSchema#",
+
+    "context":    { "@id": "input", "@type": "@id" },
+    "expect":     { "@id": "mf:result", "@type": "@id" },
+    "frame":      { "@id": "input", "@type": "@id" },
+    "input":      { "@id": "mf:action", "@type": "@id" },
+    "option":     { "@type": "@id"},
+    "sequence":   { "@id": "mf:entries", "@type": "@id", "@container": "@list" },
+    "redirectTo": { "@type": "@id"},
+
+    "name":                 "mf:name",
+    "purpose":              "rdfs:comment",
+    "description":          "rdfs:comment",
+    "base":                 { "@type": "@id" },
+    "compactArrays":        { "@type": "xsd:boolean" },
+    "documentLoader":       { "@type": "xsd:string" },
+    "expandContext":        { "@type": "xsd:string" },
+    "processingMode":       { "@type": "xsd:string" },
+    "produceGeneralizedRdf":{ "@type": "xsd:boolean" },
+    "useNativeTypes":       { "@type": "xsd:boolean" },
+    "httpStatus":           { "@type": "xsd:integer"},
+    "httpLink":             { "@container": "@set"}
+  }
+}
diff --git a/test/test-suite/manifest.jsonld b/test/test-suite/manifest.jsonld
new file mode 100644
index 0000000..337e45c
--- /dev/null
+++ b/test/test-suite/manifest.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": "http://json-ld.org/test-suite/context.jsonld",
+  "@id": "",
+  "@type": "mf:Manifest",
+  "description": "This manifest loads additional manifests for specific behavior tests",
+  "name": "JSON-LD Test Suite",
+  "sequence": [
+    "tests/compact-manifest.jsonld",
+    "tests/error-manifest.jsonld",
+    "tests/expand-manifest.jsonld",
+    "tests/flatten-manifest.jsonld",
+    "tests/frame-manifest.jsonld",
+    "tests/fromRdf-manifest.jsonld",
+    "tests/normalize-manifest.jsonld",
+    "tests/remote-doc-manifest.jsonld",
+    "tests/toRdf-manifest.jsonld"
+  ]
+}
diff --git a/test/test-suite/tests/fromRdf-0001-in.nq b/test/test-suite/tests/fromRdf-0001-in.nq
new file mode 100644
index 0000000..d2a4a3a
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0001-in.nq
@@ -0,0 +1,5 @@
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
+<http://example.com/Subj1> <http://example.com/prop1> <http://example.com/Obj1> .
+<http://example.com/Subj1> <http://example.com/prop2> "Plain" .
+<http://example.com/Subj1> <http://example.com/prop2> "2012-05-12"^^<http://www.w3.org/2001/XMLSchema#date> .
+<http://example.com/Subj1> <http://example.com/prop2> "English"@en .
diff --git a/test/test-suite/tests/fromRdf-0001-out.jsonld b/test/test-suite/tests/fromRdf-0001-out.jsonld
new file mode 100644
index 0000000..c498d2b
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0001-out.jsonld
@@ -0,0 +1,12 @@
+[
+  {
+    "@id": "http://example.com/Subj1",
+    "@type": ["http://example.com/Type"],
+    "http://example.com/prop1": [{"@id": "http://example.com/Obj1"}],
+    "http://example.com/prop2": [
+      {"@value": "Plain"},
+      {"@value": "2012-05-12", "@type": "http://www.w3.org/2001/XMLSchema#date"},
+      {"@value": "English", "@language": "en"}
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0002-in.nq b/test/test-suite/tests/fromRdf-0002-in.nq
new file mode 100644
index 0000000..9ec666d
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0002-in.nq
@@ -0,0 +1,5 @@
+<http://example.com/Subj1> <http://example.com/prop> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.com/Subj1> <http://example.com/prop> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.com/Subj1> <http://example.com/prop> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/Subj1> <http://example.com/prop> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://example.com/Subj1> <http://example.com/prop> "1.1E-1"^^<http://www.w3.org/2001/XMLSchema#double> .
diff --git a/test/test-suite/tests/fromRdf-0002-out.jsonld b/test/test-suite/tests/fromRdf-0002-out.jsonld
new file mode 100644
index 0000000..5fc2168
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0002-out.jsonld
@@ -0,0 +1,27 @@
+[
+  {
+    "@id": "http://example.com/Subj1",
+    "http://example.com/prop": [
+      {
+        "@value": "true",
+        "@type": "http://www.w3.org/2001/XMLSchema#boolean"
+      },
+      {
+        "@value": "false",
+        "@type": "http://www.w3.org/2001/XMLSchema#boolean"
+      },
+      {
+        "@value": "1",
+        "@type": "http://www.w3.org/2001/XMLSchema#integer"
+      },
+      {
+        "@value": "1.1",
+        "@type": "http://www.w3.org/2001/XMLSchema#decimal"
+      },
+      {
+        "@value": "1.1E-1",
+        "@type": "http://www.w3.org/2001/XMLSchema#double"
+      }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0003-in.nq b/test/test-suite/tests/fromRdf-0003-in.nq
new file mode 100644
index 0000000..90054b2
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0003-in.nq
@@ -0,0 +1,6 @@
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/SubType> .
+<http://example.com/Subj1> <http://example.com/ref> _:a .
+<http://example.com/Subj1> <http://example.com/ref> <http://example.com/Subj2> .
+<http://example.com/Subj2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
+<http://example.com/Subj2> <http://example.com/ref> <http://example.com/Subj1> .
diff --git a/test/test-suite/tests/fromRdf-0003-out.jsonld b/test/test-suite/tests/fromRdf-0003-out.jsonld
new file mode 100644
index 0000000..ce60dae
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0003-out.jsonld
@@ -0,0 +1,19 @@
+[
+  {
+    "@id": "_:a",
+    "@type": ["http://example.com/SubType"]
+  },
+  {
+    "@id": "http://example.com/Subj1",
+    "@type": ["http://example.com/Type"],
+    "http://example.com/ref": [
+      {"@id": "_:a"},
+      {"@id": "http://example.com/Subj2"}
+    ]
+  },
+  {
+    "@id": "http://example.com/Subj2",
+    "@type": ["http://example.com/Type"],
+    "http://example.com/ref": [{"@id": "http://example.com/Subj1"}]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0004-in.nq b/test/test-suite/tests/fromRdf-0004-in.nq
new file mode 100644
index 0000000..6e88e65
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0004-in.nq
@@ -0,0 +1,10 @@
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "apple" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "bananna" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.com/Subj1> <http://example.com/literalList> _:a .
+<http://example.com/Subj1> <http://example.com/emptyList> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/iri> .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.com/Subj1> <http://example.com/iriList> _:c .
diff --git a/test/test-suite/tests/fromRdf-0004-out.jsonld b/test/test-suite/tests/fromRdf-0004-out.jsonld
new file mode 100644
index 0000000..2dd2473
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0004-out.jsonld
@@ -0,0 +1,18 @@
+[
+  {
+    "@id": "http://example.com/Subj1",
+    "@type": ["http://example.com/Type"],
+    "http://example.com/literalList": [{
+      "@list": [
+        {"@value": "apple"},
+        {"@value": "bananna"}
+      ]
+    }],
+    "http://example.com/emptyList": [{
+      "@list": []
+    }],
+    "http://example.com/iriList": [{
+      "@list": [{"@id": "http://example.com/iri"}]
+    }]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0005-in.nq b/test/test-suite/tests/fromRdf-0005-in.nq
new file mode 100644
index 0000000..d99820e
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0005-in.nq
@@ -0,0 +1,9 @@
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> <http://example.com/U> .
+<http://example.com/Subj1> <http://example.com/ref> <http://example.com/U> <http://example.com/U> .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" <http://example.com/U> .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b <http://example.com/U> .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" <http://example.com/U> .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/U> .
+<http://example.com/Subj1> <http://example.com/list> _:a <http://example.com/U> .
+<http://example.com/U> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Graph> .
+<http://example.com/U> <http://example.com/name> "Graph" .
diff --git a/test/test-suite/tests/fromRdf-0005-out.jsonld b/test/test-suite/tests/fromRdf-0005-out.jsonld
new file mode 100644
index 0000000..a87ac2e
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0005-out.jsonld
@@ -0,0 +1,20 @@
+[
+  {
+    "@id": "http://example.com/U",
+    "@graph": [
+      {
+        "@id": "http://example.com/Subj1",
+        "@type": ["http://example.com/Type"],
+        "http://example.com/ref": [{"@id": "http://example.com/U"}],
+        "http://example.com/list": [{
+          "@list": [
+            {"@value": "a"},
+            {"@value": "b"}
+          ]
+        }]
+      }
+    ],
+    "@type": ["http://example.com/Graph"],
+    "http://example.com/name": [{"@value": "Graph"}]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0006-in.nq b/test/test-suite/tests/fromRdf-0006-in.nq
new file mode 100644
index 0000000..0f3f028
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0006-in.nq
@@ -0,0 +1,14 @@
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> <http://example.com/U> .
+<http://example.com/Subj1> <http://example.com/ref> <http://example.com/U> <http://example.com/U> .
+<http://example.com/Subj1> <http://example.com/list> _:a <http://example.com/U> .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" <http://example.com/U> .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b <http://example.com/U> .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" <http://example.com/U> .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/U> .
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type2> <http://example.com/V> .
+<http://example.com/Subj1> <http://example.com/ref> <http://example.com/V> <http://example.com/V> .
+<http://example.com/Subj1> <http://example.com/list> _:c <http://example.com/V> .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" <http://example.com/V> .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:d <http://example.com/V> .
+_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "d" <http://example.com/V> .
+_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.com/V> .
diff --git a/test/test-suite/tests/fromRdf-0006-out.jsonld b/test/test-suite/tests/fromRdf-0006-out.jsonld
new file mode 100644
index 0000000..9bbdbaa
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0006-out.jsonld
@@ -0,0 +1,34 @@
+[
+  {
+    "@id": "http://example.com/U",
+    "@graph": [
+      {
+        "@id": "http://example.com/Subj1",
+        "@type": ["http://example.com/Type"],
+        "http://example.com/ref": [{"@id": "http://example.com/U"}],
+        "http://example.com/list": [{
+          "@list": [
+            {"@value": "a"},
+            {"@value": "b"}
+          ]
+        }]
+      }
+    ]
+  },
+  {
+    "@id": "http://example.com/V",
+    "@graph": [
+      {
+        "@id": "http://example.com/Subj1",
+        "@type": ["http://example.com/Type2"],
+        "http://example.com/ref": [{"@id": "http://example.com/V"}],
+        "http://example.com/list": [{
+          "@list": [
+            {"@value": "c"},
+            {"@value": "d"}
+          ]
+        }]
+      }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0007-in.nq b/test/test-suite/tests/fromRdf-0007-in.nq
new file mode 100644
index 0000000..ad8557a
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0007-in.nq
@@ -0,0 +1,5 @@
+<http://data.wikipedia.org/snaks/Assertions> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#SnakSet> .
+<http://data.wikipedia.org/snaks/Assertions> <http://data.wikipedia.org/vocab#assertedBy> "http://gregkellogg.net/foaf#me" .
+<http://data.wikipedia.org/snaks/BerlinFact> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#Snak> <http://data.wikipedia.org/snaks/Assertions> .
+<http://data.wikipedia.org/snaks/BerlinFact> <http://data.wikipedia.org/vocab#assertedBy> "http://www.statistik-berlin-brandenburg.de/" <http://data.wikipedia.org/snaks/Assertions> .
+<http://en.wikipedia.org/wiki/Berlin> <http://data.wikipedia.org/vocab#population> "3499879"^^<http://www.w3.org/2001/XMLSchema#integer> <http://data.wikipedia.org/snaks/BerlinFact> .
diff --git a/test/test-suite/tests/fromRdf-0007-out.jsonld b/test/test-suite/tests/fromRdf-0007-out.jsonld
new file mode 100644
index 0000000..e837c6d
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0007-out.jsonld
@@ -0,0 +1,27 @@
+[
+  {
+    "@id": "http://data.wikipedia.org/snaks/Assertions",
+    "@type": ["http://data.wikipedia.org/vocab#SnakSet"],
+    "http://data.wikipedia.org/vocab#assertedBy": [{"@value": "http://gregkellogg.net/foaf#me"}
+    ],
+    "@graph": [
+      {
+        "@id": "http://data.wikipedia.org/snaks/BerlinFact",
+        "@type": ["http://data.wikipedia.org/vocab#Snak"],
+        "http://data.wikipedia.org/vocab#assertedBy": [{"@value": "http://www.statistik-berlin-brandenburg.de/"}]
+      }
+    ]
+  },
+  {
+    "@id": "http://data.wikipedia.org/snaks/BerlinFact",
+    "@graph": [
+      {
+        "@id": "http://en.wikipedia.org/wiki/Berlin",
+        "http://data.wikipedia.org/vocab#population": [{
+          "@value": "3499879",
+          "@type": "http://www.w3.org/2001/XMLSchema#integer"
+        }]
+      }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0008-in.nq b/test/test-suite/tests/fromRdf-0008-in.nq
new file mode 100644
index 0000000..878e33e
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0008-in.nq
@@ -0,0 +1,28 @@
+<http://example.com> <http://example.com/property> _:outerlist .
+_:outerlist <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:lista .
+_:outerlist <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b0 .
+
+_:lista <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a1" .
+_:lista <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:a2 .
+_:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a2" .
+_:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:a3 .
+_:a3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a3" .
+_:a3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+
+_:c0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:c1 .
+_:c0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c1" .
+_:c1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c2 .
+_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c2" .
+_:c2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c3 .
+_:c3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c3" .
+_:c3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:b1 .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c0 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b1" .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b2" .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b3" .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/fromRdf-0008-out.jsonld b/test/test-suite/tests/fromRdf-0008-out.jsonld
new file mode 100644
index 0000000..ce6e182
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0008-out.jsonld
@@ -0,0 +1,50 @@
+[
+  {
+    "@id": "_:b1",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b1" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@list": [
+          { "@value": "b2" },
+          { "@value": "b3" }
+        ]
+      }
+    ]
+  },
+  {
+    "@id": "_:c1",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c1" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@list": [
+          { "@value": "c2" },
+          { "@value": "c3" }
+        ]
+      }
+    ]
+  },
+  {
+    "@id": "_:lista",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a1" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@list": [
+          { "@value": "a2" },
+          { "@value": "a3" }
+        ]
+      }
+    ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property": [
+      {
+        "@list": [
+          { "@id": "_:lista" },
+          { "@id": "_:b1" },
+          { "@id": "_:c1" }
+        ]
+      }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0009-in.nq b/test/test-suite/tests/fromRdf-0009-in.nq
new file mode 100644
index 0000000..91fff6b
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0009-in.nq
@@ -0,0 +1,7 @@
+<http://example.com> <http://example.com/property> <http://example.com/list> .
+<http://example.com/list> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+<http://example.com/list> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/fromRdf-0009-out.jsonld b/test/test-suite/tests/fromRdf-0009-out.jsonld
new file mode 100644
index 0000000..e58e756
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0009-out.jsonld
@@ -0,0 +1,18 @@
+[
+  {
+    "@id": "http://example.com",
+    "http://example.com/property": [ { "@id": "http://example.com/list" } ]
+  },
+  {
+    "@id": "http://example.com/list",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@list": [
+          { "@value": "b" },
+          { "@value": "c" }
+        ]
+      }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0010-in.nq b/test/test-suite/tests/fromRdf-0010-in.nq
new file mode 100644
index 0000000..be9e012
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0010-in.nq
@@ -0,0 +1,6 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
diff --git a/test/test-suite/tests/fromRdf-0010-out.jsonld b/test/test-suite/tests/fromRdf-0010-out.jsonld
new file mode 100644
index 0000000..54036dd
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0010-out.jsonld
@@ -0,0 +1,20 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "_:b",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:c" } ]
+  },
+  {
+    "@id": "_:c",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c" } ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property":  [ { "@id": "_:a" } ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0011-in.nq b/test/test-suite/tests/fromRdf-0011-in.nq
new file mode 100644
index 0000000..ef52571
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0011-in.nq
@@ -0,0 +1,8 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
+_:b <http://example.com/other-property> "This list node has also properties other than rdf:first and rdf:rest" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/fromRdf-0011-out.jsonld b/test/test-suite/tests/fromRdf-0011-out.jsonld
new file mode 100644
index 0000000..811e31c
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0011-out.jsonld
@@ -0,0 +1,25 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "_:b",
+    "http://example.com/other-property": [
+      { "@value": "This list node has also properties other than rdf:first and rdf:rest" }
+    ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@list": [
+          { "@value": "c" }
+        ]
+      }
+    ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property": [ { "@id": "_:a" } ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0012-in.nq b/test/test-suite/tests/fromRdf-0012-in.nq
new file mode 100644
index 0000000..d8edbdc
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0012-in.nq
@@ -0,0 +1,7 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
diff --git a/test/test-suite/tests/fromRdf-0012-out.jsonld b/test/test-suite/tests/fromRdf-0012-out.jsonld
new file mode 100644
index 0000000..b33cc8e
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0012-out.jsonld
@@ -0,0 +1,21 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "_:b",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:c" } ]
+  },
+  {
+    "@id": "_:c",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property":  [ { "@id": "_:a" } ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0013-in.nq b/test/test-suite/tests/fromRdf-0013-in.nq
new file mode 100644
index 0000000..45ac1ca
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0013-in.nq
@@ -0,0 +1,8 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b1" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b2" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/fromRdf-0013-out.jsonld b/test/test-suite/tests/fromRdf-0013-out.jsonld
new file mode 100644
index 0000000..dc4874f
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0013-out.jsonld
@@ -0,0 +1,27 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "_:b",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
+      { "@value": "b1" },
+      { "@value": "b2" }
+    ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@list": [
+          {
+            "@value": "c"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property": [ { "@id": "_:a" } ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0014-in.nq b/test/test-suite/tests/fromRdf-0014-in.nq
new file mode 100644
index 0000000..68dfb57
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0014-in.nq
@@ -0,0 +1,10 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:d .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "d" .
+_:d <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/fromRdf-0014-out.jsonld b/test/test-suite/tests/fromRdf-0014-out.jsonld
new file mode 100644
index 0000000..2eb7a47
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0014-out.jsonld
@@ -0,0 +1,19 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "_:b",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      { "@list": [ { "@value": "c" } ] },
+      { "@list": [ { "@value": "d" } ] }
+    ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property": [ { "@id": "_:a" } ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0015-in.nq b/test/test-suite/tests/fromRdf-0015-in.nq
new file mode 100644
index 0000000..f30175e
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0015-in.nq
@@ -0,0 +1,3 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> "b" .
diff --git a/test/test-suite/tests/fromRdf-0015-out.jsonld b/test/test-suite/tests/fromRdf-0015-out.jsonld
new file mode 100644
index 0000000..feb930b
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0015-out.jsonld
@@ -0,0 +1,11 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@value": "b" } ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property":  [ { "@id": "_:a" } ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0016-in.nq b/test/test-suite/tests/fromRdf-0016-in.nq
new file mode 100644
index 0000000..fcccffe
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0016-in.nq
@@ -0,0 +1,11 @@
+<http://example.com/> <http://example.com/list> _:b0 .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "A" .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "B" .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "C" .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/fromRdf-0016-out.jsonld b/test/test-suite/tests/fromRdf-0016-out.jsonld
new file mode 100644
index 0000000..1ecddd1
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0016-out.jsonld
@@ -0,0 +1,20 @@
+[
+  {
+    "@id": "http://example.com/",
+    "http://example.com/list": [
+      {
+        "@list": [
+          {
+            "@value": "A"
+          },
+          {
+            "@value": "B"
+          },
+          {
+            "@value": "C"
+          }
+        ]
+      }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0017-in.nq b/test/test-suite/tests/fromRdf-0017-in.nq
new file mode 100644
index 0000000..8796c62
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0017-in.nq
@@ -0,0 +1,9 @@
+<http://example.com/nodeA> <http://example.com/property> "1" .
+<http://example.com/nodeA> <http://example.com/property> "1" .
+<http://example.com/nodeA> <http://example.com/property> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/nodeA> <http://example.com/property> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/nodeA> <http://example.com/property> <http://example.com/nodeB> .
+<http://example.com/nodeA> <http://example.com/property> <http://example.com/nodeB> .
+<http://example.com/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/TypeA> .
+<http://example.com/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/TypeA> .
+<http://example.com/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/TypeA> .
diff --git a/test/test-suite/tests/fromRdf-0017-out.jsonld b/test/test-suite/tests/fromRdf-0017-out.jsonld
new file mode 100644
index 0000000..5a47d26
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0017-out.jsonld
@@ -0,0 +1,14 @@
+[
+  {
+    "@id": "http://example.com/nodeA",
+    "http://example.com/property": [
+      { "@value": "1" },
+      {
+        "@value": "2",
+        "@type": "http://www.w3.org/2001/XMLSchema#integer"
+      },
+      { "@id": "http://example.com/nodeB" }
+    ],
+    "@type": [ "http://example.com/TypeA" ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0018-in.nq b/test/test-suite/tests/fromRdf-0018-in.nq
new file mode 100644
index 0000000..9ec666d
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0018-in.nq
@@ -0,0 +1,5 @@
+<http://example.com/Subj1> <http://example.com/prop> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.com/Subj1> <http://example.com/prop> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.com/Subj1> <http://example.com/prop> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/Subj1> <http://example.com/prop> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://example.com/Subj1> <http://example.com/prop> "1.1E-1"^^<http://www.w3.org/2001/XMLSchema#double> .
diff --git a/test/test-suite/tests/fromRdf-0018-out.jsonld b/test/test-suite/tests/fromRdf-0018-out.jsonld
new file mode 100644
index 0000000..3412f7a
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0018-out.jsonld
@@ -0,0 +1,12 @@
+[
+  {
+    "@id": "http://example.com/Subj1",
+    "http://example.com/prop": [
+      { "@value": true },
+      { "@value": false },
+      { "@value": 1 },
+      { "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"},
+      { "@value": 0.11 }
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-0019-in.nq b/test/test-suite/tests/fromRdf-0019-in.nq
new file mode 100644
index 0000000..d2a4a3a
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0019-in.nq
@@ -0,0 +1,5 @@
+<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
+<http://example.com/Subj1> <http://example.com/prop1> <http://example.com/Obj1> .
+<http://example.com/Subj1> <http://example.com/prop2> "Plain" .
+<http://example.com/Subj1> <http://example.com/prop2> "2012-05-12"^^<http://www.w3.org/2001/XMLSchema#date> .
+<http://example.com/Subj1> <http://example.com/prop2> "English"@en .
diff --git a/test/test-suite/tests/fromRdf-0019-out.jsonld b/test/test-suite/tests/fromRdf-0019-out.jsonld
new file mode 100644
index 0000000..77ce612
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-0019-out.jsonld
@@ -0,0 +1,14 @@
+[
+  {
+    "@id": "http://example.com/Subj1",
+    "http://example.com/prop1": [{"@id": "http://example.com/Obj1"}],
+    "http://example.com/prop2": [
+      {"@value": "Plain"},
+      {"@value": "2012-05-12", "@type": "http://www.w3.org/2001/XMLSchema#date"},
+      {"@value": "English", "@language": "en"}
+    ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
+      {"@id": "http://example.com/Type"}
+    ]
+  }
+]
diff --git a/test/test-suite/tests/fromRdf-manifest.jsonld b/test/test-suite/tests/fromRdf-manifest.jsonld
new file mode 100644
index 0000000..451791a
--- /dev/null
+++ b/test/test-suite/tests/fromRdf-manifest.jsonld
@@ -0,0 +1,150 @@
+{
+  "@context": "http://json-ld.org/test-suite/context.jsonld",
+  "@id": "",
+  "@type": "mf:Manifest",
+  "name": "Transform RDF to JSON-LD",
+  "description": "Transform RDF to JSON-LD tests take N-Quads input and use object comparison.",
+  "baseIri": "http://json-ld.org/test-suite/tests/",
+  "sequence": [
+    {
+      "@id": "#t0001",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Object Lists",
+      "purpose": "Tests generation using different types of objects.",
+      "input": "fromRdf-0001-in.nq",
+      "expect": "fromRdf-0001-out.jsonld"
+    }, {
+      "@id": "#t0002",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Native Types",
+      "purpose": "Do not use native datatypes for xsd:boolean, xsd:integer, and xsd:double by default.",
+      "input": "fromRdf-0002-in.nq",
+      "expect": "fromRdf-0002-out.jsonld"
+    }, {
+      "@id": "#t0003",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "BNodes and references",
+      "purpose": "BNode name generation and references between resources.",
+      "input": "fromRdf-0003-in.nq",
+      "expect": "fromRdf-0003-out.jsonld"
+    }, {
+      "@id": "#t0004",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Lists",
+      "purpose": "Multiple lists with different types of element.",
+      "input": "fromRdf-0004-in.nq",
+      "expect": "fromRdf-0004-out.jsonld"
+    }, {
+      "@id": "#t0005",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Document with list",
+      "purpose": "Uses a named graph containing a list.",
+      "input": "fromRdf-0005-in.nq",
+      "expect": "fromRdf-0005-out.jsonld"
+    }, {
+      "@id": "#t0006",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Two graphs having same subject but different values",
+      "purpose": "Ensure that properties and list elements aren't confused between graphs.",
+      "input": "fromRdf-0006-in.nq",
+      "expect": "fromRdf-0006-out.jsonld"
+    }, {
+      "@id": "#t0007",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Graph with multiple named graphs",
+      "purpose": "Testing @graph recursion.",
+      "input": "fromRdf-0007-in.nq",
+      "expect": "fromRdf-0007-out.jsonld"
+    }, {
+      "@id": "#t0008",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List conversion",
+      "purpose": "Conversion of lists of lists (the triples in the input are only partially ordered on purpose",
+      "input": "fromRdf-0008-in.nq",
+      "expect": "fromRdf-0008-out.jsonld"
+    }, {
+      "@id": "#t0009",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List conversion with IRI nodes",
+      "purpose": "Preserve IRI list nodes (i.e., not blank nodes) when converting to @list",
+      "input": "fromRdf-0009-in.nq",
+      "expect": "fromRdf-0009-out.jsonld"
+    }, {
+      "@id": "#t0010",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern without rdf:nil",
+      "purpose": "Do not convert lists that are not terminated by rdf:nil to @list.",
+      "input": "fromRdf-0010-in.nq",
+      "expect": "fromRdf-0010-out.jsonld"
+    }, {
+      "@id": "#t0011",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern with extra properties",
+      "purpose": "If additional properties are associated to a list node, the list is only partially converted to @list.",
+      "input": "fromRdf-0011-in.nq",
+      "expect": "fromRdf-0011-out.jsonld"
+    }, {
+      "@id": "#t0012",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern with cycles",
+      "purpose": "Detect lists containing cycles and do not convert them to @list.",
+      "input": "fromRdf-0012-in.nq",
+      "expect": "fromRdf-0012-out.jsonld"
+    }, {
+      "@id": "#t0013",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern with multiple values of rdf:first",
+      "purpose": "Do not convert list nodes to @list if nodes contain more than one value for rdf:first.",
+      "input": "fromRdf-0013-in.nq",
+      "expect": "fromRdf-0013-out.jsonld"
+    }, {
+      "@id": "#t0014",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern with multiple values of rdf:rest",
+      "purpose": "Do not convert list nodes to @list if nodes contain more than one value for rdf:rest.",
+      "input": "fromRdf-0014-in.nq",
+      "expect": "fromRdf-0014-out.jsonld"
+    }, {
+      "@id": "#t0015",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern with IRI rdf:rest",
+      "purpose": "Do not convert lists to @list if a list node's rdf:rest is an IRI.",
+      "input": "fromRdf-0015-in.nq",
+      "expect": "fromRdf-0015-out.jsonld"
+    }, {
+      "@id": "#t0016",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "List pattern with type rdf:List",
+      "purpose": "List nodes may have a rdf:type rdf:List.",
+      "input": "fromRdf-0016-in.nq",
+      "expect": "fromRdf-0016-out.jsonld"
+    }, {
+      "@id": "#t0017",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Remove duplicate triples",
+      "purpose": "Equivalent triples are used only once",
+      "input": "fromRdf-0017-in.nq",
+      "expect": "fromRdf-0017-out.jsonld"
+    }, {
+      "@id": "#t0018",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "use native types flag set to true",
+      "purpose": "Literals with datatype xsd:boolean, xsd:integer, and xsd:double are serialized using native scalar values",
+      "option": {
+        "useNativeTypes": true
+      },
+      "input": "fromRdf-0018-in.nq",
+      "expect": "fromRdf-0018-out.jsonld"
+    }, {
+      "@id": "#t0019",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "use rdf:type flag set to false",
+      "purpose": "Setting useRdfType to true causes an rdf:type predicate to be treated like a normal property, not @type",
+      "option": {
+        "useRdfType": true
+      },
+      "input": "fromRdf-0019-in.nq",
+      "expect": "fromRdf-0019-out.jsonld"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0001-in.jsonld b/test/test-suite/tests/toRdf-0001-in.jsonld
new file mode 100644
index 0000000..fc4e381
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0001-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@id": "http://greggkellogg.net/foaf#me",
+  "http://xmlns.com/foaf/0.1/name": "Gregg Kellogg"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0001-out.nq b/test/test-suite/tests/toRdf-0001-out.nq
new file mode 100644
index 0000000..f7238bf
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0001-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
diff --git a/test/test-suite/tests/toRdf-0002-in.jsonld b/test/test-suite/tests/toRdf-0002-in.jsonld
new file mode 100644
index 0000000..bd662d1
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0002-in.jsonld
@@ -0,0 +1,5 @@
+{
+  "@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:name": "Gregg Kellogg"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0002-out.nq b/test/test-suite/tests/toRdf-0002-out.nq
new file mode 100644
index 0000000..f7238bf
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0002-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
diff --git a/test/test-suite/tests/toRdf-0003-in.jsonld b/test/test-suite/tests/toRdf-0003-in.jsonld
new file mode 100644
index 0000000..7955fff
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0003-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
+  "@type": "foaf:Person"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0003-out.nq b/test/test-suite/tests/toRdf-0003-out.nq
new file mode 100644
index 0000000..abb5581
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0003-out.nq
@@ -0,0 +1 @@
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
diff --git a/test/test-suite/tests/toRdf-0004-in.jsonld b/test/test-suite/tests/toRdf-0004-in.jsonld
new file mode 100644
index 0000000..31d68b8
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0004-in.jsonld
@@ -0,0 +1,6 @@
+{
+  "http://www.w3.org/2000/01/rdf-schema#label": {
+    "@value": "A plain literal with a lang tag.",
+    "@language": "en-us"
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0004-out.nq b/test/test-suite/tests/toRdf-0004-out.nq
new file mode 100644
index 0000000..27d42d9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0004-out.nq
@@ -0,0 +1 @@
+_:b0 <http://www.w3.org/2000/01/rdf-schema#label> "A plain literal with a lang tag."@en-us .
diff --git a/test/test-suite/tests/toRdf-0005-in.jsonld b/test/test-suite/tests/toRdf-0005-in.jsonld
new file mode 100644
index 0000000..1b04c4e
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0005-in.jsonld
@@ -0,0 +1,6 @@
+{
+  "@id": "http://greggkellogg.net/foaf#me",
+  "http://xmlns.com/foaf/0.1/knows": {
+    "http://xmlns.com/foaf/0.1/name": {"@value": "Herman Iván", "@language": "hu"}
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0005-out.nq b/test/test-suite/tests/toRdf-0005-out.nq
new file mode 100644
index 0000000..69274a9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0005-out.nq
@@ -0,0 +1,2 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
+_:b0 <http://xmlns.com/foaf/0.1/name> "Herman Iván"@hu .
diff --git a/test/test-suite/tests/toRdf-0006-in.jsonld b/test/test-suite/tests/toRdf-0006-in.jsonld
new file mode 100644
index 0000000..f83b97c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0006-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@id":  "http://greggkellogg.net/foaf#me",
+  "http://purl.org/dc/terms/created":  {
+    "@value": "1957-02-27",
+    "@type": "http://www.w3.org/2001/XMLSchema#date"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0006-out.nq b/test/test-suite/tests/toRdf-0006-out.nq
new file mode 100644
index 0000000..232d992
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0006-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://purl.org/dc/terms/created> "1957-02-27"^^<http://www.w3.org/2001/XMLSchema#date> .
diff --git a/test/test-suite/tests/toRdf-0007-in.jsonld b/test/test-suite/tests/toRdf-0007-in.jsonld
new file mode 100644
index 0000000..5d2c77d
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0007-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@id": "http://greggkellogg.net/foaf#me",
+  "@type": "http://xmlns.com/foaf/0.1/Person"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0007-out.nq b/test/test-suite/tests/toRdf-0007-out.nq
new file mode 100644
index 0000000..7f64700
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0007-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
diff --git a/test/test-suite/tests/toRdf-0008-in.jsonld b/test/test-suite/tests/toRdf-0008-in.jsonld
new file mode 100644
index 0000000..f767f65
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0008-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": {"d": "http://example.com/default#"},
+  "d:foo": "bar"
+}
diff --git a/test/test-suite/tests/toRdf-0008-out.nq b/test/test-suite/tests/toRdf-0008-out.nq
new file mode 100644
index 0000000..b9aed32
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0008-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.com/default#foo> "bar" .
diff --git a/test/test-suite/tests/toRdf-0009-in.jsonld b/test/test-suite/tests/toRdf-0009-in.jsonld
new file mode 100644
index 0000000..5efb807
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0009-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": {"foo": "http://example.com/default#"},
+  "foo:": "bar"
+}
diff --git a/test/test-suite/tests/toRdf-0009-out.nq b/test/test-suite/tests/toRdf-0009-out.nq
new file mode 100644
index 0000000..20fe769
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0009-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.com/default#> "bar" .
diff --git a/test/test-suite/tests/toRdf-0010-in.jsonld b/test/test-suite/tests/toRdf-0010-in.jsonld
new file mode 100644
index 0000000..1ecc30b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0010-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:knows": {
+    "@id": "http://manu.sporny.org/#me",
+    "foaf:name": "Manu Sporny"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0010-out.nq b/test/test-suite/tests/toRdf-0010-out.nq
new file mode 100644
index 0000000..35c3999
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0010-out.nq
@@ -0,0 +1,2 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> <http://manu.sporny.org/#me> .
+<http://manu.sporny.org/#me> <http://xmlns.com/foaf/0.1/name> "Manu Sporny" .
diff --git a/test/test-suite/tests/toRdf-0011-in.jsonld b/test/test-suite/tests/toRdf-0011-in.jsonld
new file mode 100644
index 0000000..853938f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0011-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/"
+  },
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:knows": {
+    "foaf:name": "Dave Longley"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0011-out.nq b/test/test-suite/tests/toRdf-0011-out.nq
new file mode 100644
index 0000000..019740b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0011-out.nq
@@ -0,0 +1,2 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
+_:b0 <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
diff --git a/test/test-suite/tests/toRdf-0012-in.jsonld b/test/test-suite/tests/toRdf-0012-in.jsonld
new file mode 100644
index 0000000..2b32617
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0012-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/"
+  },
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:knows": ["Manu Sporny", "Dave Longley"]
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0012-out.nq b/test/test-suite/tests/toRdf-0012-out.nq
new file mode 100644
index 0000000..203fc14
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0012-out.nq
@@ -0,0 +1,2 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "Dave Longley" .
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "Manu Sporny" .
diff --git a/test/test-suite/tests/toRdf-0013-in.jsonld b/test/test-suite/tests/toRdf-0013-in.jsonld
new file mode 100644
index 0000000..d5b025d
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0013-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/"
+  },
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:knows": {"@list": []}
+}
diff --git a/test/test-suite/tests/toRdf-0013-out.nq b/test/test-suite/tests/toRdf-0013-out.nq
new file mode 100644
index 0000000..f334b9b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0013-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0014-in.jsonld b/test/test-suite/tests/toRdf-0014-in.jsonld
new file mode 100644
index 0000000..327284f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0014-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/"
+  },
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:knows": {"@list": ["Manu Sporny"]}
+}
diff --git a/test/test-suite/tests/toRdf-0014-out.nq b/test/test-suite/tests/toRdf-0014-out.nq
new file mode 100644
index 0000000..9a2730c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0014-out.nq
@@ -0,0 +1,3 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Manu Sporny" .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0015-in.jsonld b/test/test-suite/tests/toRdf-0015-in.jsonld
new file mode 100644
index 0000000..b340db4
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0015-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/"
+  },
+  "@id": "http://greggkellogg.net/foaf#me",
+  "foaf:knows": {"@list": ["Manu Sporny", "Dave Longley"]}
+}
diff --git a/test/test-suite/tests/toRdf-0015-out.nq b/test/test-suite/tests/toRdf-0015-out.nq
new file mode 100644
index 0000000..7bab72e
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0015-out.nq
@@ -0,0 +1,5 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Manu Sporny" .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Dave Longley" .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0016-in.jsonld b/test/test-suite/tests/toRdf-0016-in.jsonld
new file mode 100644
index 0000000..bdd01c9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0016-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@id": "",
+  "@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0016-out.nq b/test/test-suite/tests/toRdf-0016-out.nq
new file mode 100644
index 0000000..0ed95c6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0016-out.nq
@@ -0,0 +1 @@
+<http://json-ld.org/test-suite/tests/toRdf-0016-in.jsonld> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
diff --git a/test/test-suite/tests/toRdf-0017-in.jsonld b/test/test-suite/tests/toRdf-0017-in.jsonld
new file mode 100644
index 0000000..7e39ca8
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0017-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@id": "a/b",
+  "@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0017-out.nq b/test/test-suite/tests/toRdf-0017-out.nq
new file mode 100644
index 0000000..56e2224
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0017-out.nq
@@ -0,0 +1 @@
+<http://json-ld.org/test-suite/tests/a/b> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
diff --git a/test/test-suite/tests/toRdf-0018-in.jsonld b/test/test-suite/tests/toRdf-0018-in.jsonld
new file mode 100644
index 0000000..64ee0c9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0018-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@id": "#frag",
+  "@type": "http://www.w3.org/2000/01/rdf-schema#Resource"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0018-out.nq b/test/test-suite/tests/toRdf-0018-out.nq
new file mode 100644
index 0000000..3d10901
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0018-out.nq
@@ -0,0 +1 @@
+<http://json-ld.org/test-suite/tests/toRdf-0018-in.jsonld#frag> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
diff --git a/test/test-suite/tests/toRdf-0019-in.jsonld b/test/test-suite/tests/toRdf-0019-in.jsonld
new file mode 100644
index 0000000..0e0e3e3
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0019-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/",
+    "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"}
+  },
+  "@id":    "http://greggkellogg.net/foaf#me",
+  "knows":  "http://manu.sporny.org/#me"
+}
diff --git a/test/test-suite/tests/toRdf-0019-out.nq b/test/test-suite/tests/toRdf-0019-out.nq
new file mode 100644
index 0000000..bbc020f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0019-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> <http://manu.sporny.org/#me> .
diff --git a/test/test-suite/tests/toRdf-0020-in.jsonld b/test/test-suite/tests/toRdf-0020-in.jsonld
new file mode 100644
index 0000000..804b2fc
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0020-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:date"}
+  },
+  "@id":  "http://greggkellogg.net/foaf#me",
+  "created":  "1957-02-27"
+}
diff --git a/test/test-suite/tests/toRdf-0020-out.nq b/test/test-suite/tests/toRdf-0020-out.nq
new file mode 100644
index 0000000..232d992
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0020-out.nq
@@ -0,0 +1 @@
+<http://greggkellogg.net/foaf#me> <http://purl.org/dc/terms/created> "1957-02-27"^^<http://www.w3.org/2001/XMLSchema#date> .
diff --git a/test/test-suite/tests/toRdf-0022-in.jsonld b/test/test-suite/tests/toRdf-0022-in.jsonld
new file mode 100644
index 0000000..31b76ad
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0022-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": { "measure": "http://example/measure#"},
+  "measure:cups": 5.3
+}
diff --git a/test/test-suite/tests/toRdf-0022-out.nq b/test/test-suite/tests/toRdf-0022-out.nq
new file mode 100644
index 0000000..31092dd
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0022-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example/measure#cups> "5.3E0"^^<http://www.w3.org/2001/XMLSchema#double> .
diff --git a/test/test-suite/tests/toRdf-0023-in.jsonld b/test/test-suite/tests/toRdf-0023-in.jsonld
new file mode 100644
index 0000000..be26079
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0023-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": { "chem": "http://example/chem#"},
+  "chem:protons": 12
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0023-out.nq b/test/test-suite/tests/toRdf-0023-out.nq
new file mode 100644
index 0000000..d5a91bd
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0023-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example/chem#protons> "12"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/test/test-suite/tests/toRdf-0024-in.jsonld b/test/test-suite/tests/toRdf-0024-in.jsonld
new file mode 100644
index 0000000..777318a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0024-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": { "sensor": "http://example/sensor#"},
+  "sensor:active": true
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0024-out.nq b/test/test-suite/tests/toRdf-0024-out.nq
new file mode 100644
index 0000000..f058285
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0024-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example/sensor#active> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
diff --git a/test/test-suite/tests/toRdf-0025-in.jsonld b/test/test-suite/tests/toRdf-0025-in.jsonld
new file mode 100644
index 0000000..a00107b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0025-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@container": "@list"}
+  },
+  "@id": "http://greggkellogg.net/foaf#me",
+  "knows": ["Manu Sporny"]
+}
diff --git a/test/test-suite/tests/toRdf-0025-out.nq b/test/test-suite/tests/toRdf-0025-out.nq
new file mode 100644
index 0000000..9a2730c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0025-out.nq
@@ -0,0 +1,3 @@
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> _:b0 .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Manu Sporny" .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0026-in.jsonld b/test/test-suite/tests/toRdf-0026-in.jsonld
new file mode 100644
index 0000000..bb3ba6a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0026-in.jsonld
@@ -0,0 +1,4 @@
+{
+  "@context": {"rdfs": "http://www.w3.org/2000/01/rdf-schema#"},
+  "@type": ["rdfs:Resource", "rdfs:Class"]
+}
diff --git a/test/test-suite/tests/toRdf-0026-out.nq b/test/test-suite/tests/toRdf-0026-out.nq
new file mode 100644
index 0000000..9030c08
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0026-out.nq
@@ -0,0 +1,2 @@
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .
diff --git a/test/test-suite/tests/toRdf-0027-in.jsonld b/test/test-suite/tests/toRdf-0027-in.jsonld
new file mode 100644
index 0000000..920dcb8
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0027-in.jsonld
@@ -0,0 +1,30 @@
+{
+  "@context": {
+    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    "ex": "http://example.org/",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "ex:locatedIn": {"@type": "@id"},
+    "ex:hasPopulaton": {"@type": "xsd:integer"},
+    "ex:hasReference": {"@type": "@id"}
+  },
+  "@graph": [
+    {
+      "@id": "http://example.org/ParisFact1",
+      "@type": "rdf:Graph",
+      "@graph": {
+        "@id": "http://example.org/location/Paris#this",
+        "ex:locatedIn": "http://example.org/location/France#this"
+      },
+      "ex:hasReference": ["http://www.britannica.com/", "http://www.wikipedia.org/", "http://www.brockhaus.de/"]
+    },
+    {
+      "@id": "http://example.org/ParisFact2",
+      "@type": "rdf:Graph",
+      "@graph": {
+        "@id": "http://example.org/location/Paris#this",
+        "ex:hasPopulation": 7000000
+      },
+      "ex:hasReference": "http://www.wikipedia.org/"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0027-out.nq b/test/test-suite/tests/toRdf-0027-out.nq
new file mode 100644
index 0000000..e77f2ba
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0027-out.nq
@@ -0,0 +1,8 @@
+<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.britannica.com/> .
+<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.brockhaus.de/> .
+<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.wikipedia.org/> .
+<http://example.org/ParisFact1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
+<http://example.org/ParisFact2> <http://example.org/hasReference> <http://www.wikipedia.org/> .
+<http://example.org/ParisFact2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
+<http://example.org/location/Paris#this> <http://example.org/hasPopulation> "7000000"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/ParisFact2> .
+<http://example.org/location/Paris#this> <http://example.org/locatedIn> <http://example.org/location/France#this> <http://example.org/ParisFact1> .
diff --git a/test/test-suite/tests/toRdf-0028-in.jsonld b/test/test-suite/tests/toRdf-0028-in.jsonld
new file mode 100644
index 0000000..3795dfb
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0028-in.jsonld
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "sec": "http://purl.org/security#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    "dc": "http://purl.org/dc/terms/",
+    "sec:signer": {"@type": "@id"},
+    "dc:created": {"@type": "xsd:dateTime"}
+  },
+  "@id": "http://example.org/sig1",
+  "@type": ["rdf:Graph", "sec:SignedGraph"],
+  "dc:created": "2011-09-23T20:21:34Z",
+  "sec:signer": "http://payswarm.example.com/i/john/keys/5",
+  "sec:signatureValue": "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=",
+  "@graph": {
+    "@id": "http://example.org/fact1",
+    "dc:title": "Hello World!"
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0028-out.nq b/test/test-suite/tests/toRdf-0028-out.nq
new file mode 100644
index 0000000..68b12ab
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0028-out.nq
@@ -0,0 +1,6 @@
+<http://example.org/fact1> <http://purl.org/dc/terms/title> "Hello World!" <http://example.org/sig1> .
+<http://example.org/sig1> <http://purl.org/dc/terms/created> "2011-09-23T20:21:34Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://example.org/sig1> <http://purl.org/security#signatureValue> "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=" .
+<http://example.org/sig1> <http://purl.org/security#signer> <http://payswarm.example.com/i/john/keys/5> .
+<http://example.org/sig1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/security#SignedGraph> .
+<http://example.org/sig1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
diff --git a/test/test-suite/tests/toRdf-0029-in.jsonld b/test/test-suite/tests/toRdf-0029-in.jsonld
new file mode 100644
index 0000000..4a7a16c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0029-in.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "wd": "http://data.wikipedia.org/vocab#",
+    "ws": "http://data.wikipedia.org/snaks/",
+    "wp": "http://en.wikipedia.org/wiki/"
+  },
+  "@id": "ws:Assertions",
+  "@type": "wd:SnakSet",
+  "@graph": {
+    "@id": "ws:BerlinFact",
+    "@type": "wd:Snak",
+    "@graph": {
+      "@id": "wp:Berlin",
+      "wd:population": 3499879
+    },
+    "wd:assertedBy": "http://www.statistik-berlin-brandenburg.de/"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0029-out.nq b/test/test-suite/tests/toRdf-0029-out.nq
new file mode 100644
index 0000000..b3d8123
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0029-out.nq
@@ -0,0 +1,4 @@
+<http://data.wikipedia.org/snaks/Assertions> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#SnakSet> .
+<http://data.wikipedia.org/snaks/BerlinFact> <http://data.wikipedia.org/vocab#assertedBy> "http://www.statistik-berlin-brandenburg.de/" <http://data.wikipedia.org/snaks/Assertions> .
+<http://data.wikipedia.org/snaks/BerlinFact> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#Snak> <http://data.wikipedia.org/snaks/Assertions> .
+<http://en.wikipedia.org/wiki/Berlin> <http://data.wikipedia.org/vocab#population> "3499879"^^<http://www.w3.org/2001/XMLSchema#integer> <http://data.wikipedia.org/snaks/BerlinFact> .
diff --git a/test/test-suite/tests/toRdf-0030-in.jsonld b/test/test-suite/tests/toRdf-0030-in.jsonld
new file mode 100644
index 0000000..dc9cff6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0030-in.jsonld
@@ -0,0 +1,28 @@
+{
+  "@context": {
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "knows": "http://xmlns.com/foaf/0.1/knows",
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "asOf": "http://example.org/asOf"
+  },
+  "@id": "http://example.org/linked-data-graph",
+  "asOf": {"@value": "2012-04-09", "@type": "xsd:date"},
+  "@graph":
+  [
+    {
+      "@id": "http://manu.sporny.org/i/public",
+      "@type": "foaf:Person",
+      "name": "Manu Sporny",
+      "knows": "http://greggkellogg.net/foaf#me"
+    },
+    {
+      "@id": "http://greggkellogg.net/foaf#me",
+      "@type": "foaf:Person",
+      "name": "Gregg Kellogg",
+      "knows": "http://manu.sporny.org/i/public"
+    },
+    {
+      "@id": "http://www.markus-lanthaler.com/"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0030-out.nq b/test/test-suite/tests/toRdf-0030-out.nq
new file mode 100644
index 0000000..709e7fb
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0030-out.nq
@@ -0,0 +1,7 @@
+<http://example.org/linked-data-graph> <http://example.org/asOf> "2012-04-09"^^<http://www.w3.org/2001/XMLSchema#date> .
+<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foaf:Person> <http://example.org/linked-data-graph> .
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "http://manu.sporny.org/i/public" <http://example.org/linked-data-graph> .
+<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <http://example.org/linked-data-graph> .
+<http://manu.sporny.org/i/public> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foaf:Person> <http://example.org/linked-data-graph> .
+<http://manu.sporny.org/i/public> <http://xmlns.com/foaf/0.1/knows> "http://greggkellogg.net/foaf#me" <http://example.org/linked-data-graph> .
+<http://manu.sporny.org/i/public> <http://xmlns.com/foaf/0.1/name> "Manu Sporny" <http://example.org/linked-data-graph> .
diff --git a/test/test-suite/tests/toRdf-0031-in.jsonld b/test/test-suite/tests/toRdf-0031-in.jsonld
new file mode 100644
index 0000000..c317232
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0031-in.jsonld
@@ -0,0 +1,15 @@
+{
+  "@context": {
+    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
+    "defines": { "@reverse": "rdfs:definedBy" },
+    "label": "rdfs:label"
+  },
+  "@id": "http://example.com/vocab",
+  "label": "My vocabulary",
+  "defines": [
+    {
+      "@id": "http://example.com/vocab#property",
+      "label": "A property"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0031-out.nq b/test/test-suite/tests/toRdf-0031-out.nq
new file mode 100644
index 0000000..7048556
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0031-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/vocab#property> <http://www.w3.org/2000/01/rdf-schema#definedBy> <http://example.com/vocab> .
+<http://example.com/vocab#property> <http://www.w3.org/2000/01/rdf-schema#label> "A property" .
+<http://example.com/vocab> <http://www.w3.org/2000/01/rdf-schema#label> "My vocabulary" .
diff --git a/test/test-suite/tests/toRdf-0032-in.jsonld b/test/test-suite/tests/toRdf-0032-in.jsonld
new file mode 100644
index 0000000..78873bd
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0032-in.jsonld
@@ -0,0 +1,16 @@
+{
+  "@id": "ex:node1",
+  "owl:sameAs": {
+    "@id": "ex:node2",
+    "rdfs:label": "Node 2",
+    "link": "ex:node3",
+    "@context": {
+      "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+    }
+  },
+  "@context": {
+    "ex": "http://example.org/",
+    "owl": "http://www.w3.org/2002/07/owl#",
+    "link": { "@id": "ex:link", "@type": "@id" }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0032-out.nq b/test/test-suite/tests/toRdf-0032-out.nq
new file mode 100644
index 0000000..119504f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0032-out.nq
@@ -0,0 +1,3 @@
+<http://example.org/node1> <http://www.w3.org/2002/07/owl#sameAs> <http://example.org/node2> .
+<http://example.org/node2> <http://example.org/link> <http://example.org/node3> .
+<http://example.org/node2> <http://www.w3.org/2000/01/rdf-schema#label> "Node 2" .
diff --git a/test/test-suite/tests/toRdf-0033-in.jsonld b/test/test-suite/tests/toRdf-0033-in.jsonld
new file mode 100644
index 0000000..070a328
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0033-in.jsonld
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "ex": "http://example.org/",
+    "owl": "http://www.w3.org/2002/07/owl#",
+    "link": {
+      "@id": "ex:link",
+      "@type": "@id"
+    }
+  },
+  "owl:sameAs": {
+    "@context": {
+      "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+    },
+    "rdfs:label": "Node 2",
+    "link": "ex:node3",
+    "@id": "ex:node2"
+  },
+  "@id": "ex:node1"
+}
diff --git a/test/test-suite/tests/toRdf-0033-out.nq b/test/test-suite/tests/toRdf-0033-out.nq
new file mode 100644
index 0000000..119504f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0033-out.nq
@@ -0,0 +1,3 @@
+<http://example.org/node1> <http://www.w3.org/2002/07/owl#sameAs> <http://example.org/node2> .
+<http://example.org/node2> <http://example.org/link> <http://example.org/node3> .
+<http://example.org/node2> <http://www.w3.org/2000/01/rdf-schema#label> "Node 2" .
diff --git a/test/test-suite/tests/toRdf-0034-in.jsonld b/test/test-suite/tests/toRdf-0034-in.jsonld
new file mode 100644
index 0000000..e611323
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0034-in.jsonld
@@ -0,0 +1,16 @@
+{
+  "@context": {
+    "link": { "@id": "ex:link", "@type": "@id" },
+    "ex": "http://example.org/",
+    "owl": "http://www.w3.org/2002/07/owl#"
+  },
+  "@id": "ex:node1",
+  "owl:sameAs": {
+    "@context": {
+      "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+    },
+    "@id": "ex:node2",
+    "rdfs:label": "Node 2",
+    "link": "ex:node3"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0034-out.nq b/test/test-suite/tests/toRdf-0034-out.nq
new file mode 100644
index 0000000..119504f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0034-out.nq
@@ -0,0 +1,3 @@
+<http://example.org/node1> <http://www.w3.org/2002/07/owl#sameAs> <http://example.org/node2> .
+<http://example.org/node2> <http://example.org/link> <http://example.org/node3> .
+<http://example.org/node2> <http://www.w3.org/2000/01/rdf-schema#label> "Node 2" .
diff --git a/test/test-suite/tests/toRdf-0035-in.jsonld b/test/test-suite/tests/toRdf-0035-in.jsonld
new file mode 100644
index 0000000..bf6a950
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0035-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "double": {
+      "@id": "http://example.com/double",
+      "@type": "http://www.w3.org/2001/XMLSchema#double"
+    },
+    "integer": {
+      "@id": "http://example.com/integer",
+      "@type": "http://www.w3.org/2001/XMLSchema#integer"
+    }
+  },
+  "double": [1, 2.2 ],
+  "integer": [8, 9.9 ]
+}
diff --git a/test/test-suite/tests/toRdf-0035-out.nq b/test/test-suite/tests/toRdf-0035-out.nq
new file mode 100644
index 0000000..cbbaaed
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0035-out.nq
@@ -0,0 +1,4 @@
+_:b0 <http://example.com/double> "1.0E0"^^<http://www.w3.org/2001/XMLSchema#double> .
+_:b0 <http://example.com/double> "2.2E0"^^<http://www.w3.org/2001/XMLSchema#double> .
+_:b0 <http://example.com/integer> "8"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b0 <http://example.com/integer> "9.9E0"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/test/test-suite/tests/toRdf-0036-in.jsonld b/test/test-suite/tests/toRdf-0036-in.jsonld
new file mode 100644
index 0000000..0197274
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0036-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@id": "http://example.com/",
+  "ex:prop1": {
+    "@list": [ { "@id": "_:x1" }, { "@id": "_:x2" } ]
+  },
+  "ex:prop2": { "@id": "_:x3" }
+}
diff --git a/test/test-suite/tests/toRdf-0036-out.nq b/test/test-suite/tests/toRdf-0036-out.nq
new file mode 100644
index 0000000..79f8142
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0036-out.nq
@@ -0,0 +1,6 @@
+<http://example.com/> <ex:prop1> _:b3 .
+<http://example.com/> <ex:prop2> _:b2 .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:b0 .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:b1 .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0041-in.jsonld b/test/test-suite/tests/toRdf-0041-in.jsonld
new file mode 100644
index 0000000..0bfd26f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0041-in.jsonld
@@ -0,0 +1 @@
+{"@id": "http://example.org/test#example"}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0041-out.nq b/test/test-suite/tests/toRdf-0041-out.nq
new file mode 100644
index 0000000..e69de29
diff --git a/test/test-suite/tests/toRdf-0042-in.jsonld b/test/test-suite/tests/toRdf-0042-in.jsonld
new file mode 100644
index 0000000..e4598e5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0042-in.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "t1": "http://example.com/t1",
+    "t2": "http://example.com/t2",
+    "term1": "http://example.com/term1",
+    "term2": "http://example.com/term2",
+    "term3": "http://example.com/term3",
+    "term4": "http://example.com/term4",
+    "term5": "http://example.com/term5"
+  },
+  "@id": "http://example.com/id1",
+  "@type": "t1",
+  "term1": "v1",
+  "term2": {"@value": "v2", "@type": "t2"},
+  "term3": {"@value": "v3", "@language": "en"},
+  "term4": 4,
+  "term5": [50, 51]
+}
diff --git a/test/test-suite/tests/toRdf-0042-out.nq b/test/test-suite/tests/toRdf-0042-out.nq
new file mode 100644
index 0000000..54f0bc0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0042-out.nq
@@ -0,0 +1,7 @@
+<http://example.com/id1> <http://example.com/term1> "v1" .
+<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
+<http://example.com/id1> <http://example.com/term3> "v3"@en .
+<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .
diff --git a/test/test-suite/tests/toRdf-0043-in.jsonld b/test/test-suite/tests/toRdf-0043-in.jsonld
new file mode 100644
index 0000000..2007f36
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0043-in.jsonld
@@ -0,0 +1,12 @@
+{
+  "@id": "http://example.org/id",
+  "http://example.org/property": null,
+  "regularJson": {
+    "nonJsonLd": "property",
+    "deep": [{
+      "foo": "bar"
+    }, {
+      "bar": "foo"
+    }]
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0043-out.nq b/test/test-suite/tests/toRdf-0043-out.nq
new file mode 100644
index 0000000..e69de29
diff --git a/test/test-suite/tests/toRdf-0044-in.jsonld b/test/test-suite/tests/toRdf-0044-in.jsonld
new file mode 100644
index 0000000..5768520
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0044-in.jsonld
@@ -0,0 +1,21 @@
+{
+  "@context": {
+    "mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
+    "mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
+    "myset2": {"@id": "http://example.com/myset2", "@container": "@set"},
+    "myset3": {"@id": "http://example.com/myset3", "@container": "@set"}
+  },
+  "@id": "http://example.org/id",
+  "mylist1": { "@list": [ ] },
+  "mylist2": "one item",
+  "myset2": { "@set": [ ] },
+  "myset3": [ "v1" ],
+  "http://example.org/list1": { "@list": [ null ] },
+  "http://example.org/list2": { "@list": [ {"@value": null} ] },
+  "http://example.org/set1": { "@set": [ ] },
+  "http://example.org/set1": { "@set": [ null ] },
+  "http://example.org/set3": [ ],
+  "http://example.org/set4": [ null ],
+  "http://example.org/set5": "one item",
+  "http://example.org/property": { "@list": "one item" }
+}
diff --git a/test/test-suite/tests/toRdf-0044-out.nq b/test/test-suite/tests/toRdf-0044-out.nq
new file mode 100644
index 0000000..fdb2e63
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0044-out.nq
@@ -0,0 +1,11 @@
+<http://example.org/id> <http://example.com/mylist1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.org/id> <http://example.com/mylist2> _:b0 .
+<http://example.org/id> <http://example.com/myset3> "v1" .
+<http://example.org/id> <http://example.org/list1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.org/id> <http://example.org/list2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.org/id> <http://example.org/property> _:b1 .
+<http://example.org/id> <http://example.org/set5> "one item" .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "one item" .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "one item" .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0045-in.jsonld b/test/test-suite/tests/toRdf-0045-in.jsonld
new file mode 100644
index 0000000..33622d5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0045-in.jsonld
@@ -0,0 +1,23 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "homepage": {
+      "@id": "http://xmlns.com/foaf/0.1/homepage",
+      "@type": "@id"
+    },
+    "know": "http://xmlns.com/foaf/0.1/knows",
+    "@iri": "@id"
+  },
+  "@id": "#me",
+  "know": [
+    {
+      "@id": "http://example.com/bob#me",
+      "name": "Bob",
+      "homepage": "http://example.com/bob"
+    }, {
+      "@id": "http://example.com/alice#me",
+      "name": "Alice",
+      "homepage": "http://example.com/alice"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0045-out.nq b/test/test-suite/tests/toRdf-0045-out.nq
new file mode 100644
index 0000000..fa46f90
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0045-out.nq
@@ -0,0 +1,6 @@
+<http://example.com/alice#me> <http://xmlns.com/foaf/0.1/homepage> <http://example.com/alice> .
+<http://example.com/alice#me> <http://xmlns.com/foaf/0.1/name> "Alice" .
+<http://example.com/bob#me> <http://xmlns.com/foaf/0.1/homepage> <http://example.com/bob> .
+<http://example.com/bob#me> <http://xmlns.com/foaf/0.1/name> "Bob" .
+<http://json-ld.org/test-suite/tests/toRdf-0045-in.jsonld#me> <http://xmlns.com/foaf/0.1/knows> <http://example.com/alice#me> .
+<http://json-ld.org/test-suite/tests/toRdf-0045-in.jsonld#me> <http://xmlns.com/foaf/0.1/knows> <http://example.com/bob#me> .
diff --git a/test/test-suite/tests/toRdf-0046-in.jsonld b/test/test-suite/tests/toRdf-0046-in.jsonld
new file mode 100644
index 0000000..045e2a2
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0046-in.jsonld
@@ -0,0 +1,20 @@
+{
+  "@context": {
+    "http://example.org/test#property1": {
+      "@type": "@id"
+    },
+    "http://example.org/test#property2": {
+      "@type": "@id"
+    },
+    "uri": "@id"
+  },
+  "http://example.org/test#property1": {
+    "http://example.org/test#property4": "foo",
+    "uri": "http://example.org/test#example2"
+  },
+  "http://example.org/test#property2": "http://example.org/test#example3",
+  "http://example.org/test#property3": {
+    "uri": "http://example.org/test#example4"
+  },
+  "uri": "http://example.org/test#example1"
+}
diff --git a/test/test-suite/tests/toRdf-0046-out.nq b/test/test-suite/tests/toRdf-0046-out.nq
new file mode 100644
index 0000000..a9213cf
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0046-out.nq
@@ -0,0 +1,4 @@
+<http://example.org/test#example1> <http://example.org/test#property1> <http://example.org/test#example2> .
+<http://example.org/test#example1> <http://example.org/test#property2> <http://example.org/test#example3> .
+<http://example.org/test#example1> <http://example.org/test#property3> <http://example.org/test#example4> .
+<http://example.org/test#example2> <http://example.org/test#property4> "foo" .
diff --git a/test/test-suite/tests/toRdf-0047-in.jsonld b/test/test-suite/tests/toRdf-0047-in.jsonld
new file mode 100644
index 0000000..b49fac4
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0047-in.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "ex": "http://example.org/vocab#",
+    "ex:date": {
+      "@type": "xsd:dateTime"
+    },
+    "ex:parent": {
+      "@type": "@id"
+    },
+    "xsd": "http://www.w3.org/2001/XMLSchema#"
+  },
+  "@id": "http://example.org/test#example1",
+  "ex:date": "2011-01-25T00:00:00Z",
+  "ex:embed": {
+    "@id": "http://example.org/test#example2",
+    "ex:parent": "http://example.org/test#example1"
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0047-out.nq b/test/test-suite/tests/toRdf-0047-out.nq
new file mode 100644
index 0000000..5f833b1
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0047-out.nq
@@ -0,0 +1,3 @@
+<http://example.org/test#example1> <http://example.org/vocab#date> "2011-01-25T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://example.org/test#example1> <http://example.org/vocab#embed> <http://example.org/test#example2> .
+<http://example.org/test#example2> <http://example.org/vocab#parent> <http://example.org/test#example1> .
diff --git a/test/test-suite/tests/toRdf-0048-in.jsonld b/test/test-suite/tests/toRdf-0048-in.jsonld
new file mode 100644
index 0000000..a17b949
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0048-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "ex": "http://example.org/vocab#"
+  },
+  "@id": "http://example.org/test",
+  "ex:test": { "@value": "test",  "@language": "en" },
+  "ex:drop-lang-only": { "@language": "en" },
+  "ex:keep-full-value": { "@value": "only value" }
+}
diff --git a/test/test-suite/tests/toRdf-0048-out.nq b/test/test-suite/tests/toRdf-0048-out.nq
new file mode 100644
index 0000000..d0af636
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0048-out.nq
@@ -0,0 +1,2 @@
+<http://example.org/test> <http://example.org/vocab#keep-full-value> "only value" .
+<http://example.org/test> <http://example.org/vocab#test> "test"@en .
diff --git a/test/test-suite/tests/toRdf-0049-in.jsonld b/test/test-suite/tests/toRdf-0049-in.jsonld
new file mode 100644
index 0000000..6acef5c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0049-in.jsonld
@@ -0,0 +1,43 @@
+{
+  "@context": {
+    "authored": {
+      "@id": "http://example.org/vocab#authored",
+      "@type": "@id"
+    },
+    "contains": {
+      "@id": "http://example.org/vocab#contains",
+      "@type": "@id"
+    },
+    "contributor": "http://purl.org/dc/elements/1.1/contributor",
+    "description": "http://purl.org/dc/elements/1.1/description",
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "title": {
+      "@id": "http://purl.org/dc/elements/1.1/title"
+    }
+  },
+  "@graph": [
+    {
+      "@id": "http://example.org/test#chapter",
+      "description": "Fun",
+      "title": "Chapter One"
+    },
+    {
+      "@id": "http://example.org/test#jane",
+      "authored": "http://example.org/test#chapter",
+      "name": "Jane"
+    },
+    {
+      "@id": "http://example.org/test#john",
+      "name": "John"
+    },
+    {
+      "@id": "http://example.org/test#library",
+      "contains": {
+        "@id": "http://example.org/test#book",
+        "contains": "http://example.org/test#chapter",
+        "contributor": "Writer",
+        "title": "My Book"
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0049-out.nq b/test/test-suite/tests/toRdf-0049-out.nq
new file mode 100644
index 0000000..1c8d94a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0049-out.nq
@@ -0,0 +1,9 @@
+<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
+<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/description> "Fun" .
+<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/title> "Chapter One" .
+<http://example.org/test#jane> <http://example.org/vocab#authored> <http://example.org/test#chapter> .
+<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
+<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
+<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
diff --git a/test/test-suite/tests/toRdf-0050-in.jsonld b/test/test-suite/tests/toRdf-0050-in.jsonld
new file mode 100644
index 0000000..f2d0a38
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0050-in.jsonld
@@ -0,0 +1,11 @@
+{
+  "@context": {
+    "d": "http://purl.org/dc/elements/1.1/",
+    "e": "http://example.org/vocab#",
+    "f": "http://xmlns.com/foaf/0.1/",
+    "xsd": "http://www.w3.org/2001/XMLSchema#"
+  },
+  "@id": "http://example.org/test",
+  "e:bool": true,
+  "e:int": 123
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0050-out.nq b/test/test-suite/tests/toRdf-0050-out.nq
new file mode 100644
index 0000000..5fe1cc0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0050-out.nq
@@ -0,0 +1,2 @@
+<http://example.org/test> <http://example.org/vocab#bool> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/test> <http://example.org/vocab#int> "123"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/test/test-suite/tests/toRdf-0051-in.jsonld b/test/test-suite/tests/toRdf-0051-in.jsonld
new file mode 100644
index 0000000..1581559
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0051-in.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "dc": "http://purl.org/dc/elements/1.1/",
+    "ex": "http://example.org/vocab#",
+    "ex:contains": {
+      "@type": "@id"
+    },
+    "xsd": "http://www.w3.org/2001/XMLSchema#"
+  },
+  "@id": "http://example.org/test#book",
+  "dc:title": "Title",
+  "ex:contains": "http://example.org/test#chapter"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0051-out.nq b/test/test-suite/tests/toRdf-0051-out.nq
new file mode 100644
index 0000000..c581db6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0051-out.nq
@@ -0,0 +1,2 @@
+<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "Title" .
diff --git a/test/test-suite/tests/toRdf-0052-in.jsonld b/test/test-suite/tests/toRdf-0052-in.jsonld
new file mode 100644
index 0000000..d081e7f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0052-in.jsonld
@@ -0,0 +1,39 @@
+{
+  "@context": {
+    "dc": "http://purl.org/dc/elements/1.1/",
+    "ex": "http://example.org/vocab#",
+    "ex:authored": {
+      "@type": "@id"
+    },
+    "ex:contains": {
+      "@type": "@id"
+    },
+    "foaf": "http://xmlns.com/foaf/0.1/",
+    "xsd": "http://www.w3.org/2001/XMLSchema#"
+  },
+  "@graph": [
+    {
+      "@id": "http://example.org/test#chapter",
+      "dc:description": "Fun",
+      "dc:title": "Chapter One"
+    },
+    {
+      "@id": "http://example.org/test#jane",
+      "ex:authored": "http://example.org/test#chapter",
+      "foaf:name": "Jane"
+    },
+    {
+      "@id": "http://example.org/test#john",
+      "foaf:name": "John"
+    },
+    {
+      "@id": "http://example.org/test#library",
+      "ex:contains": {
+        "@id": "http://example.org/test#book",
+        "dc:contributor": "Writer",
+        "dc:title": "My Book",
+        "ex:contains": "http://example.org/test#chapter"
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0052-out.nq b/test/test-suite/tests/toRdf-0052-out.nq
new file mode 100644
index 0000000..1c8d94a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0052-out.nq
@@ -0,0 +1,9 @@
+<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
+<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/description> "Fun" .
+<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/title> "Chapter One" .
+<http://example.org/test#jane> <http://example.org/vocab#authored> <http://example.org/test#chapter> .
+<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
+<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
+<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
diff --git a/test/test-suite/tests/toRdf-0053-in.jsonld b/test/test-suite/tests/toRdf-0053-in.jsonld
new file mode 100644
index 0000000..7795576
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0053-in.jsonld
@@ -0,0 +1,9 @@
+[{
+  "@id": "http://example.com/id1",
+  "@type": ["http://example.com/t1"],
+  "http://example.com/term1": ["v1"],
+  "http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}],
+  "http://example.com/term3": [{"@value": "v3", "@language": "en"}],
+  "http://example.com/term4": [4],
+  "http://example.com/term5": [50, 51]
+}]
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0053-out.nq b/test/test-suite/tests/toRdf-0053-out.nq
new file mode 100644
index 0000000..54f0bc0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0053-out.nq
@@ -0,0 +1,7 @@
+<http://example.com/id1> <http://example.com/term1> "v1" .
+<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
+<http://example.com/id1> <http://example.com/term3> "v3"@en .
+<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .
diff --git a/test/test-suite/tests/toRdf-0054-in.jsonld b/test/test-suite/tests/toRdf-0054-in.jsonld
new file mode 100644
index 0000000..ba913ff
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0054-in.jsonld
@@ -0,0 +1,50 @@
+{
+  "@context": {
+    "ex": "http://example.org/test#",
+    "property1": {
+      "@id": "http://example.org/test#property1",
+      "@type": "@id"
+    },
+    "property2": {
+      "@id": "ex:property2",
+      "@type": "@id"
+    },
+    "uri": "@id",
+    "set": "@set",
+    "value": "@value",
+    "type": "@type",
+    "xsd": { "@id": "http://www.w3.org/2001/XMLSchema#" }
+  },
+  "property1": {
+    "uri": "ex:example2",
+    "http://example.org/test#property4": "foo"
+  },
+  "property2": "http://example.org/test#example3",
+  "http://example.org/test#property3": {
+    "uri": "http://example.org/test#example4"
+  },
+  "ex:property4": {
+    "uri": "ex:example4",
+    "ex:property5": [
+      {
+        "set": [
+          {
+          "value": "2012-03-31",
+          "type": "xsd:date"
+          }
+        ]
+      }
+    ]
+  },
+  "ex:property6": [
+    {
+      "set": [
+        {
+        "value": null,
+        "type": "xsd:date"
+        }
+      ]
+    }
+  ],
+  "uri": "http://example.org/test#example1"
+}
diff --git a/test/test-suite/tests/toRdf-0054-out.nq b/test/test-suite/tests/toRdf-0054-out.nq
new file mode 100644
index 0000000..a84697e
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0054-out.nq
@@ -0,0 +1,6 @@
+<http://example.org/test#example1> <http://example.org/test#property1> <http://example.org/test#example2> .
+<http://example.org/test#example1> <http://example.org/test#property2> <http://example.org/test#example3> .
+<http://example.org/test#example1> <http://example.org/test#property3> <http://example.org/test#example4> .
+<http://example.org/test#example1> <http://example.org/test#property4> <http://example.org/test#example4> .
+<http://example.org/test#example2> <http://example.org/test#property4> "foo" .
+<http://example.org/test#example4> <http://example.org/test#property5> "2012-03-31"^^<http://www.w3.org/2001/XMLSchema#date> .
diff --git a/test/test-suite/tests/toRdf-0055-in.jsonld b/test/test-suite/tests/toRdf-0055-in.jsonld
new file mode 100644
index 0000000..ae60d73
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0055-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
+    "mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
+    "myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
+    "myset2": {"@id": "http://example.com/myset2", "@container": "@set" },
+    "myset3": {"@id": "http://example.com/myset3", "@container": "@set" }
+  },
+  "@id": "http://example.org/id",
+  "mylist1": [],
+  "myset1": { "@set": [] },
+  "myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
+  "myset3": [ { "@set": [ "hello", "this" ] }, "will", { "@set": [ "be", "collapsed" ] } ]
+}
diff --git a/test/test-suite/tests/toRdf-0055-out.nq b/test/test-suite/tests/toRdf-0055-out.nq
new file mode 100644
index 0000000..ecd95e6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0055-out.nq
@@ -0,0 +1,6 @@
+<http://example.org/id> <http://example.com/mylist1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.org/id> <http://example.com/myset3> "be" .
+<http://example.org/id> <http://example.com/myset3> "collapsed" .
+<http://example.org/id> <http://example.com/myset3> "hello" .
+<http://example.org/id> <http://example.com/myset3> "this" .
+<http://example.org/id> <http://example.com/myset3> "will" .
diff --git a/test/test-suite/tests/toRdf-0056-in.jsonld b/test/test-suite/tests/toRdf-0056-in.jsonld
new file mode 100644
index 0000000..c151040
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0056-in.jsonld
@@ -0,0 +1,30 @@
+{
+  "@context": {
+    "myproperty": { "@id": "http://example.com/myproperty" },
+    "mylist1": {"@id": "http://example.com/mylist1", "@container": "@list"},
+    "mylist2": {"@id": "http://example.com/mylist2", "@container": "@list"},
+    "myset1": {"@id": "http://example.com/myset1", "@container": "@set" },
+    "myset2": {"@id": "http://example.com/myset2", "@container": "@set" }
+  },
+  "@id": "http://example.org/id1",
+  "mylist1": [],
+  "mylist2": [ 2, "hi" ],
+  "myset1": { "@set": [] },
+  "myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
+  "myproperty": {
+    "@context": null,
+    "@id": "http://example.org/id2",
+    "mylist1": [],
+    "mylist2": [ 2, "hi" ],
+    "myset1": { "@set": [] },
+    "myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ],
+    "http://example.org/myproperty2": "ok"
+  },
+  "http://example.com/emptyobj": {
+    "@context": null,
+    "mylist1": [],
+    "mylist2": [ 2, "hi" ],
+    "myset1": { "@set": [] },
+    "myset2": [ { "@set": [] }, [], { "@set": [ null ] }, [ null ] ]
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0056-out.nq b/test/test-suite/tests/toRdf-0056-out.nq
new file mode 100644
index 0000000..c536374
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0056-out.nq
@@ -0,0 +1,9 @@
+<http://example.org/id1> <http://example.com/emptyobj> _:b0 .
+<http://example.org/id1> <http://example.com/mylist1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+<http://example.org/id1> <http://example.com/mylist2> _:b1 .
+<http://example.org/id1> <http://example.com/myproperty> <http://example.org/id2> .
+<http://example.org/id2> <http://example.org/myproperty2> "ok" .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "hi" .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0057-in.jsonld b/test/test-suite/tests/toRdf-0057-in.jsonld
new file mode 100644
index 0000000..dea8bf8
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0057-in.jsonld
@@ -0,0 +1,45 @@
+{
+  "@context": {
+    "authored": {
+      "@id": "http://example.org/vocab#authored",
+      "@type": "@id"
+    },
+    "contains": {
+      "@id": "http://example.org/vocab#contains",
+      "@type": "@id"
+    },
+    "contributor": "http://purl.org/dc/elements/1.1/contributor",
+    "description": "http://purl.org/dc/elements/1.1/description",
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "title": {
+      "@id": "http://purl.org/dc/elements/1.1/title"
+    },
+    "id": "@id",
+    "data": "@graph"
+  },
+  "data": [
+    {
+      "id": "http://example.org/test#chapter",
+      "description": "Fun",
+      "title": "Chapter One"
+    },
+    {
+      "@id": "http://example.org/test#jane",
+      "authored": "http://example.org/test#chapter",
+      "name": "Jane"
+    },
+    {
+      "id": "http://example.org/test#john",
+      "name": "John"
+    },
+    {
+      "id": "http://example.org/test#library",
+      "contains": {
+        "@id": "http://example.org/test#book",
+        "contains": "http://example.org/test#chapter",
+        "contributor": "Writer",
+        "title": "My Book"
+      }
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0057-out.nq b/test/test-suite/tests/toRdf-0057-out.nq
new file mode 100644
index 0000000..1c8d94a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0057-out.nq
@@ -0,0 +1,9 @@
+<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
+<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/description> "Fun" .
+<http://example.org/test#chapter> <http://purl.org/dc/elements/1.1/title> "Chapter One" .
+<http://example.org/test#jane> <http://example.org/vocab#authored> <http://example.org/test#chapter> .
+<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
+<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
+<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
diff --git a/test/test-suite/tests/toRdf-0058-in.jsonld b/test/test-suite/tests/toRdf-0058-in.jsonld
new file mode 100644
index 0000000..21933fd
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0058-in.jsonld
@@ -0,0 +1,24 @@
+{
+  "@context": {
+    "ex": "http://example.org/vocab#",
+    "@language": "en",
+    "de": { "@id": "ex:german", "@language": "de" },
+    "nolang": { "@id": "ex:nolang", "@language": null }
+  },
+  "@id": "http://example.org/test",
+  "ex:test-default": [
+    "hello",
+    1,
+    true
+  ],
+  "de": [
+    "hallo",
+    2,
+    true
+  ],
+  "nolang": [
+    "no language",
+    3,
+    false
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0058-out.nq b/test/test-suite/tests/toRdf-0058-out.nq
new file mode 100644
index 0000000..aaa1ecc
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0058-out.nq
@@ -0,0 +1,9 @@
+<http://example.org/test> <http://example.org/vocab#german> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/test> <http://example.org/vocab#german> "hallo"@de .
+<http://example.org/test> <http://example.org/vocab#german> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/test> <http://example.org/vocab#nolang> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/test> <http://example.org/vocab#nolang> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/test> <http://example.org/vocab#nolang> "no language" .
+<http://example.org/test> <http://example.org/vocab#test-default> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/test> <http://example.org/vocab#test-default> "hello"@en .
+<http://example.org/test> <http://example.org/vocab#test-default> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
diff --git a/test/test-suite/tests/toRdf-0059-in.jsonld b/test/test-suite/tests/toRdf-0059-in.jsonld
new file mode 100644
index 0000000..b91f886
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0059-in.jsonld
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "myproperty": "http://example.com/myproperty"
+  },
+  "myproperty": { "@value" : null }
+}
diff --git a/test/test-suite/tests/toRdf-0059-out.nq b/test/test-suite/tests/toRdf-0059-out.nq
new file mode 100644
index 0000000..e69de29
diff --git a/test/test-suite/tests/toRdf-0060-in.jsonld b/test/test-suite/tests/toRdf-0060-in.jsonld
new file mode 100644
index 0000000..989e119
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0060-in.jsonld
@@ -0,0 +1,51 @@
+{
+  "@context": {
+    "authored": {
+      "@id": "http://example.org/vocab#authored",
+      "@type": "@id"
+    },
+    "contains": {
+      "@id": "http://example.org/vocab#contains",
+      "@type": "@id"
+    },
+    "contributor": "http://purl.org/dc/elements/1.1/contributor",
+    "description": "http://purl.org/dc/elements/1.1/description",
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "title": {
+      "@id": "http://purl.org/dc/elements/1.1/title"
+    }
+  },
+  "@graph": [
+    {
+      "@id": "http://example.org/test#jane",
+      "name": "Jane",
+      "authored": {
+        "@graph": [
+          {
+            "@id": "http://example.org/test#chapter1",
+            "description": "Fun",
+            "title": "Chapter One"
+          },
+          {
+            "@id": "http://example.org/test#chapter2",
+            "description": "More fun",
+            "title": "Chapter Two"
+          }
+        ]
+      }
+    },
+    {
+      "@id": "http://example.org/test#john",
+      "name": "John"
+    },
+    {
+      "@id": "http://example.org/test#library",
+      "contains": {
+        "@id": "http://example.org/test#book",
+        "contains": "http://example.org/test#chapter",
+        "contributor": "Writer",
+        "title": "My Book"
+      }
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0060-out.nq b/test/test-suite/tests/toRdf-0060-out.nq
new file mode 100644
index 0000000..440b2f7
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0060-out.nq
@@ -0,0 +1,11 @@
+<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" .
+<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/description> "Fun" _:b0 .
+<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/title> "Chapter One" _:b0 .
+<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/description> "More fun" _:b0 .
+<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/title> "Chapter Two" _:b0 .
+<http://example.org/test#jane> <http://example.org/vocab#authored> _:b0 .
+<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" .
+<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" .
+<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> .
diff --git a/test/test-suite/tests/toRdf-0061-in.jsonld b/test/test-suite/tests/toRdf-0061-in.jsonld
new file mode 100644
index 0000000..e52fd1b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0061-in.jsonld
@@ -0,0 +1,56 @@
+{
+  "@context": {
+    "authored": {
+      "@id": "http://example.org/vocab#authored",
+      "@type": "@id"
+    },
+    "contains": {
+      "@id": "http://example.org/vocab#contains",
+      "@type": "@id"
+    },
+    "contributor": "http://purl.org/dc/elements/1.1/contributor",
+    "description": "http://purl.org/dc/elements/1.1/description",
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "title": {
+      "@id": "http://purl.org/dc/elements/1.1/title"
+    }
+  },
+  "title": "My first graph",
+  "@graph": [
+    {
+      "@id": "http://example.org/test#jane",
+      "name": "Jane",
+      "authored": {
+        "@graph": [
+          {
+            "@id": "http://example.org/test#chapter1",
+            "description": "Fun",
+            "title": "Chapter One"
+          },
+          {
+            "@id": "http://example.org/test#chapter2",
+            "description": "More fun",
+            "title": "Chapter Two"
+          },
+          {
+            "@id": "http://example.org/test#chapter3",
+            "title": "Chapter Three"
+          }
+        ]
+      }
+    },
+    {
+      "@id": "http://example.org/test#john",
+      "name": "John"
+    },
+    {
+      "@id": "http://example.org/test#library",
+      "contains": {
+        "@id": "http://example.org/test#book",
+        "contains": "http://example.org/test#chapter",
+        "contributor": "Writer",
+        "title": "My Book"
+      }
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0061-out.nq b/test/test-suite/tests/toRdf-0061-out.nq
new file mode 100644
index 0000000..841a3d4
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0061-out.nq
@@ -0,0 +1,13 @@
+<http://example.org/test#book> <http://example.org/vocab#contains> <http://example.org/test#chapter> _:b0 .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/contributor> "Writer" _:b0 .
+<http://example.org/test#book> <http://purl.org/dc/elements/1.1/title> "My Book" _:b0 .
+<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/description> "Fun" _:b1 .
+<http://example.org/test#chapter1> <http://purl.org/dc/elements/1.1/title> "Chapter One" _:b1 .
+<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/description> "More fun" _:b1 .
+<http://example.org/test#chapter2> <http://purl.org/dc/elements/1.1/title> "Chapter Two" _:b1 .
+<http://example.org/test#chapter3> <http://purl.org/dc/elements/1.1/title> "Chapter Three" _:b1 .
+<http://example.org/test#jane> <http://example.org/vocab#authored> _:b1 _:b0 .
+<http://example.org/test#jane> <http://xmlns.com/foaf/0.1/name> "Jane" _:b0 .
+<http://example.org/test#john> <http://xmlns.com/foaf/0.1/name> "John" _:b0 .
+<http://example.org/test#library> <http://example.org/vocab#contains> <http://example.org/test#book> _:b0 .
+_:b0 <http://purl.org/dc/elements/1.1/title> "My first graph" .
diff --git a/test/test-suite/tests/toRdf-0062-in.jsonld b/test/test-suite/tests/toRdf-0062-in.jsonld
new file mode 100644
index 0000000..e7f938a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0062-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "term": "http://example.com/term",
+    "@language": "en"
+  },
+  "term": "v"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0062-out.nq b/test/test-suite/tests/toRdf-0062-out.nq
new file mode 100644
index 0000000..80c9398
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0062-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.com/term> "v"@en .
diff --git a/test/test-suite/tests/toRdf-0063-in.jsonld b/test/test-suite/tests/toRdf-0063-in.jsonld
new file mode 100644
index 0000000..2a33783
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0063-in.jsonld
@@ -0,0 +1,21 @@
+{
+  "@context": {
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "idlist": {"@id": "http://example.com/idlist", "@container": "@list", "@type": "@id"},
+    "datelist": {"@id": "http://example.com/datelist", "@container": "@list", "@type": "xsd:date"},
+    "idset": {"@id": "http://example.com/idset", "@container": "@set", "@type": "@id"},
+    "dateset": {"@id": "http://example.com/dateset", "@container": "@set", "@type": "xsd:date"},
+    "idprop": {"@id": "http://example.com/idprop", "@type": "@id" },
+    "dateprop": {"@id": "http://example.com/dateprop", "@type": "xsd:date" },
+    "idprop2": {"@id": "http://example.com/idprop2", "@type": "@id" },
+    "dateprop2": {"@id": "http://example.com/dateprop2", "@type": "xsd:date" }
+  },
+  "idlist": ["http://example.org/id"],
+  "datelist": ["2012-04-12"],
+  "idprop": {"@list": ["http://example.org/id"]},
+  "dateprop": {"@list": ["2012-04-12"]},
+  "idset": ["http://example.org/id"],
+  "dateset": ["2012-04-12"],
+  "idprop2": {"@set": ["http://example.org/id"]},
+  "dateprop2": {"@set": ["2012-04-12"]}
+}
diff --git a/test/test-suite/tests/toRdf-0063-out.nq b/test/test-suite/tests/toRdf-0063-out.nq
new file mode 100644
index 0000000..2b1ed62
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0063-out.nq
@@ -0,0 +1,16 @@
+_:b0 <http://example.com/datelist> _:b1 .
+_:b0 <http://example.com/dateprop2> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
+_:b0 <http://example.com/dateprop> _:b2 .
+_:b0 <http://example.com/dateset> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
+_:b0 <http://example.com/idlist> _:b3 .
+_:b0 <http://example.com/idprop2> <http://example.org/id> .
+_:b0 <http://example.com/idprop> _:b4 .
+_:b0 <http://example.com/idset> <http://example.org/id> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2012-04-12"^^<http://www.w3.org/2001/XMLSchema#date> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/id> .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/id> .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0064-in.jsonld b/test/test-suite/tests/toRdf-0064-in.jsonld
new file mode 100644
index 0000000..fcf010c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0064-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": [
+    {
+      "name": "http://xmlns.com/foaf/0.1/name",
+      "homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage","@type": "@id"}
+    },
+    {"ical": "http://www.w3.org/2002/12/cal/ical#"}
+  ],
+  "@id": "http://example.com/speakers#Alice",
+  "name": "Alice",
+  "homepage": "http://xkcd.com/177/",
+  "ical:summary": "Alice Talk",
+  "ical:location": "Lyon Convention Centre, Lyon, France"
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0064-out.nq b/test/test-suite/tests/toRdf-0064-out.nq
new file mode 100644
index 0000000..1ed3b1c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0064-out.nq
@@ -0,0 +1,4 @@
+<http://example.com/speakers#Alice> <http://www.w3.org/2002/12/cal/ical#location> "Lyon Convention Centre, Lyon, France" .
+<http://example.com/speakers#Alice> <http://www.w3.org/2002/12/cal/ical#summary> "Alice Talk" .
+<http://example.com/speakers#Alice> <http://xmlns.com/foaf/0.1/homepage> <http://xkcd.com/177/> .
+<http://example.com/speakers#Alice> <http://xmlns.com/foaf/0.1/name> "Alice" .
diff --git a/test/test-suite/tests/toRdf-0065-in.jsonld b/test/test-suite/tests/toRdf-0065-in.jsonld
new file mode 100644
index 0000000..426de36
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0065-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "foo": "http://example.com/foo/",
+    "foo:bar": "http://example.com/bar",
+    "bar": {"@id": "foo:bar", "@type": "@id"},
+    "_": "http://example.com/underscore/"
+  },
+  "@type": [ "foo", "foo:bar", "_" ]
+}
diff --git a/test/test-suite/tests/toRdf-0065-out.nq b/test/test-suite/tests/toRdf-0065-out.nq
new file mode 100644
index 0000000..57adb84
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0065-out.nq
@@ -0,0 +1,3 @@
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/bar> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/foo/> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/underscore/> .
diff --git a/test/test-suite/tests/toRdf-0066-in.jsonld b/test/test-suite/tests/toRdf-0066-in.jsonld
new file mode 100644
index 0000000..36d8cac
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0066-in.jsonld
@@ -0,0 +1,20 @@
+{
+  "@context": {
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"@id": "@type", "@type": "@id"}
+  },
+  "@graph": [
+    {
+      "@id": "http://example.com/a",
+      "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/b"
+    }, {
+      "@id": "http://example.com/c",
+      "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
+        "http://example.com/d",
+        "http://example.com/e"
+      ]
+    }, {
+      "@id": "http://example.com/f",
+      "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/g"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0066-out.nq b/test/test-suite/tests/toRdf-0066-out.nq
new file mode 100644
index 0000000..093e629
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0066-out.nq
@@ -0,0 +1,4 @@
+<http://example.com/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/b> .
+<http://example.com/c> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/d> .
+<http://example.com/c> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/e> .
+<http://example.com/f> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/g> .
diff --git a/test/test-suite/tests/toRdf-0067-in.jsonld b/test/test-suite/tests/toRdf-0067-in.jsonld
new file mode 100644
index 0000000..6c47cfb
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0067-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "mylist": {"@id": "http://example.com/mylist", "@container": "@list"},
+    "myset": {"@id": "http://example.com/myset", "@container": "@set"}
+  },
+  "@id": "http://example.org/id",
+  "mylist": [1, 2, 2, 3],
+  "myset": [1, 2, 2, 3]
+}
diff --git a/test/test-suite/tests/toRdf-0067-out.nq b/test/test-suite/tests/toRdf-0067-out.nq
new file mode 100644
index 0000000..d089ef5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0067-out.nq
@@ -0,0 +1,12 @@
+<http://example.org/id> <http://example.com/mylist> _:b0 .
+<http://example.org/id> <http://example.com/myset> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/id> <http://example.com/myset> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/id> <http://example.com/myset> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
diff --git a/test/test-suite/tests/toRdf-0068-in.jsonld b/test/test-suite/tests/toRdf-0068-in.jsonld
new file mode 100644
index 0000000..4f05d0e
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0068-in.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "@vocab": "http://example.org/vocab#",
+    "date": { "@type": "dateTime" }
+  },
+  "@id": "example1",
+  "@type": "test",
+  "date": "2011-01-25T00:00:00Z",
+  "embed": {
+    "@id": "example2",
+    "expandedDate": { "@value": "2012-08-01T00:00:00Z", "@type": "dateTime" }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0068-out.nq b/test/test-suite/tests/toRdf-0068-out.nq
new file mode 100644
index 0000000..e8b4f18
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0068-out.nq
@@ -0,0 +1,4 @@
+<http://json-ld.org/test-suite/tests/example1> <http://example.org/vocab#date> "2011-01-25T00:00:00Z"^^<http://example.org/vocab#dateTime> .
+<http://json-ld.org/test-suite/tests/example1> <http://example.org/vocab#embed> <http://json-ld.org/test-suite/tests/example2> .
+<http://json-ld.org/test-suite/tests/example1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#test> .
+<http://json-ld.org/test-suite/tests/example2> <http://example.org/vocab#expandedDate> "2012-08-01T00:00:00Z"^^<http://example.org/vocab#dateTime> .
diff --git a/test/test-suite/tests/toRdf-0069-in.jsonld b/test/test-suite/tests/toRdf-0069-in.jsonld
new file mode 100644
index 0000000..08cdde3
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0069-in.jsonld
@@ -0,0 +1,32 @@
+{
+  "@context": {
+    "links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
+  },
+  "@id": "relativeIris",
+  "@type": [
+    "link",
+    "#fragment-works",
+    "?query=works",
+    "./",
+    "../",
+    "../parent",
+    "../../parent-parent-eq-root",
+    "../../../../../still-root",
+    "../.././.././../../too-many-dots",
+    "/absolute",
+    "//example.org/scheme-relative"
+  ],
+  "links": [
+    "link",
+    "#fragment-works",
+    "?query=works",
+    "./",
+    "../",
+    "../parent",
+    "../../parent-parent-eq-root",
+    "./../../../useless/../../../still-root",
+    "../.././.././../../too-many-dots",
+    "/absolute",
+    "//example.org/scheme-relative"
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0069-out.nq b/test/test-suite/tests/toRdf-0069-out.nq
new file mode 100644
index 0000000..8991013
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0069-out.nq
@@ -0,0 +1,34 @@
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.example.com/link> _:b0 .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/scheme-relative> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/absolute> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/parent-parent-eq-root> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/still-root> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/parent> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/link> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld#fragment-works> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld?query=works> .
+<http://json-ld.org/test-suite/tests/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/too-many-dots> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/link> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld#fragment-works> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
+_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
+_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/toRdf-0069-in.jsonld?query=works> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/tests/> .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/> .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b5 .
+_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/test-suite/parent> .
+_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b6 .
+_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/parent-parent-eq-root> .
+_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b7 .
+_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/still-root> .
+_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b8 .
+_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/too-many-dots> .
+_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b9 .
+_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://json-ld.org/absolute> .
+_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b10 .
diff --git a/test/test-suite/tests/toRdf-0070-in.jsonld b/test/test-suite/tests/toRdf-0070-in.jsonld
new file mode 100644
index 0000000..ca71167
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0070-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "vocab": "http://example.com/vocab/",
+    "label": {
+      "@id": "vocab:label",
+      "@container": "@language"
+    }
+  },
+  "@id": "http://example.com/queen",
+  "label": {
+    "en": "The Queen",
+    "de": [ "Die Königin", "Ihre Majestät" ]
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0070-out.nq b/test/test-suite/tests/toRdf-0070-out.nq
new file mode 100644
index 0000000..c171a40
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0070-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/queen> <http://example.com/vocab/label> "Die Königin"@de .
+<http://example.com/queen> <http://example.com/vocab/label> "Ihre Majestät"@de .
+<http://example.com/queen> <http://example.com/vocab/label> "The Queen"@en .
diff --git a/test/test-suite/tests/toRdf-0071-in.jsonld b/test/test-suite/tests/toRdf-0071-in.jsonld
new file mode 100644
index 0000000..192ff27
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0071-in.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "ex": "http://example.org/vocab#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "ex:integer": { "@type": "xsd:integer" },
+    "ex:double": { "@type": "xsd:double" },
+    "ex:boolean": { "@type": "xsd:boolean" }
+  },
+  "@id": "http://example.org/test#example1",
+  "ex:integer": 1,
+  "ex:double": 123.45,
+  "ex:boolean": true
+}
diff --git a/test/test-suite/tests/toRdf-0071-out.nq b/test/test-suite/tests/toRdf-0071-out.nq
new file mode 100644
index 0000000..3812698
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0071-out.nq
@@ -0,0 +1,3 @@
+<http://example.org/test#example1> <http://example.org/vocab#boolean> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/test#example1> <http://example.org/vocab#double> "1.2345E2"^^<http://www.w3.org/2001/XMLSchema#double> .
+<http://example.org/test#example1> <http://example.org/vocab#integer> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/test/test-suite/tests/toRdf-0072-in.jsonld b/test/test-suite/tests/toRdf-0072-in.jsonld
new file mode 100644
index 0000000..920554f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0072-in.jsonld
@@ -0,0 +1,11 @@
+{
+  "@context": {
+    "@vocab": "http://xmlns.com/foaf/0.1/",
+    "from": null,
+    "university": { "@id": null }
+  },
+  "@id": "http://me.markus-lanthaler.com/",
+  "name": "Markus Lanthaler",
+  "from": "Italy",
+  "university": "TU Graz"
+}
diff --git a/test/test-suite/tests/toRdf-0072-out.nq b/test/test-suite/tests/toRdf-0072-out.nq
new file mode 100644
index 0000000..fe7cd66
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0072-out.nq
@@ -0,0 +1 @@
+<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0073-in.jsonld b/test/test-suite/tests/toRdf-0073-in.jsonld
new file mode 100644
index 0000000..abf6fee
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0073-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "@vocab": "http://example.com/vocab#",
+    "homepage": {
+      "@type": "@id"
+    },
+    "created_at": {
+      "@type": "http://www.w3.org/2001/XMLSchema#date"
+    }
+  },
+  "name": "Markus Lanthaler",
+  "homepage": "http://www.markus-lanthaler.com/",
+  "created_at": "2012-10-28"
+}
diff --git a/test/test-suite/tests/toRdf-0073-out.nq b/test/test-suite/tests/toRdf-0073-out.nq
new file mode 100644
index 0000000..58e36e1
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0073-out.nq
@@ -0,0 +1,3 @@
+_:b0 <http://example.com/vocab#created_at> "2012-10-28"^^<http://www.w3.org/2001/XMLSchema#date> .
+_:b0 <http://example.com/vocab#homepage> <http://www.markus-lanthaler.com/> .
+_:b0 <http://example.com/vocab#name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0074-in.jsonld b/test/test-suite/tests/toRdf-0074-in.jsonld
new file mode 100644
index 0000000..22bb603
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0074-in.jsonld
@@ -0,0 +1,16 @@
+{
+  "@context": {
+    "@vocab": "http://example.com/vocab/",
+    "colliding": "http://example.com/vocab/collidingTerm"
+  },
+  "@id": "http://example.com/IriCollissions",
+  "colliding": [
+    "value 1",
+    2
+  ],
+  "collidingTerm": [
+    3,
+    "four"
+  ],
+  "http://example.com/vocab/collidingTerm": 5
+}
diff --git a/test/test-suite/tests/toRdf-0074-out.nq b/test/test-suite/tests/toRdf-0074-out.nq
new file mode 100644
index 0000000..a1c2f66
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0074-out.nq
@@ -0,0 +1,5 @@
+<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "5"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "four" .
+<http://example.com/IriCollissions> <http://example.com/vocab/collidingTerm> "value 1" .
diff --git a/test/test-suite/tests/toRdf-0075-in.jsonld b/test/test-suite/tests/toRdf-0075-in.jsonld
new file mode 100644
index 0000000..7bf5911
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0075-in.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "@vocab": "http://example.com/vocab/",
+    "@language": "it",
+    "label": {
+      "@container": "@language"
+    }
+  },
+  "@id": "http://example.com/queen",
+  "label": {
+    "en": "The Queen",
+    "de": [ "Die Königin", "Ihre Majestät" ]
+  },
+  "http://example.com/vocab/label": [
+    "Il re",
+    { "@value": "The king", "@language": "en" }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0075-out.nq b/test/test-suite/tests/toRdf-0075-out.nq
new file mode 100644
index 0000000..a7b58ee
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0075-out.nq
@@ -0,0 +1,5 @@
+<http://example.com/queen> <http://example.com/vocab/label> "Die Königin"@de .
+<http://example.com/queen> <http://example.com/vocab/label> "Ihre Majestät"@de .
+<http://example.com/queen> <http://example.com/vocab/label> "Il re"@it .
+<http://example.com/queen> <http://example.com/vocab/label> "The Queen"@en .
+<http://example.com/queen> <http://example.com/vocab/label> "The king"@en .
diff --git a/test/test-suite/tests/toRdf-0076-in.jsonld b/test/test-suite/tests/toRdf-0076-in.jsonld
new file mode 100644
index 0000000..23c99b5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0076-in.jsonld
@@ -0,0 +1,90 @@
+{
+  "@context": {
+    "property": "http://example.com/property",
+    "indexContainer": { "@id": "http://example.com/container", "@container": "@index" }
+  },
+  "@id": "http://example.org/indexTest",
+  "indexContainer": {
+    "A": [
+      {
+        "@id": "http://example.org/nodeWithoutIndexA"
+      },
+      {
+        "@id": "http://example.org/nodeWithIndexA",
+        "@index": "this overrides the 'A' index from the container"
+      },
+      1,
+      true,
+      false,
+      null,
+      "simple string A",
+      {
+        "@value": "typed literal A",
+        "@type": "http://example.org/type"
+      },
+      {
+        "@value": "language-tagged string A",
+        "@language": "en"
+      }
+    ],
+    "B": "simple string B",
+    "C": [
+      {
+        "@id": "http://example.org/nodeWithoutIndexC"
+      },
+      {
+        "@id": "http://example.org/nodeWithIndexC",
+        "@index": "this overrides the 'C' index from the container"
+      },
+      3,
+      true,
+      false,
+      null,
+      "simple string C",
+      {
+        "@value": "typed literal C",
+        "@type": "http://example.org/type"
+      },
+      {
+        "@value": "language-tagged string C",
+        "@language": "en"
+      }
+    ]
+  },
+  "property": [
+    {
+      "@id": "http://example.org/nodeWithoutIndexProp"
+    },
+    {
+      "@id": "http://example.org/nodeWithIndexProp",
+      "@index": "prop"
+    },
+    {
+      "@value": 3,
+      "@index": "prop"
+    },
+    {
+      "@value": true,
+      "@index": "prop"
+    },
+    {
+      "@value": false,
+      "@index": "prop"
+    },
+    {
+      "@value": null,
+      "@index": "prop"
+    },
+    "simple string no index",
+    {
+      "@value": "typed literal Prop",
+      "@type": "http://example.org/type",
+      "@index": "prop"
+    },
+    {
+      "@value": "language-tagged string Prop",
+      "@language": "en",
+      "@index": "prop"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0076-out.nq b/test/test-suite/tests/toRdf-0076-out.nq
new file mode 100644
index 0000000..5fc76bd
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0076-out.nq
@@ -0,0 +1,25 @@
+<http://example.org/indexTest> <http://example.com/container> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/indexTest> <http://example.com/container> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/indexTest> <http://example.com/container> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/indexTest> <http://example.com/container> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/indexTest> <http://example.com/container> "language-tagged string A"@en .
+<http://example.org/indexTest> <http://example.com/container> "language-tagged string C"@en .
+<http://example.org/indexTest> <http://example.com/container> "simple string A" .
+<http://example.org/indexTest> <http://example.com/container> "simple string B" .
+<http://example.org/indexTest> <http://example.com/container> "simple string C" .
+<http://example.org/indexTest> <http://example.com/container> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/indexTest> <http://example.com/container> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/indexTest> <http://example.com/container> "typed literal A"^^<http://example.org/type> .
+<http://example.org/indexTest> <http://example.com/container> "typed literal C"^^<http://example.org/type> .
+<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithIndexA> .
+<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithIndexC> .
+<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithoutIndexA> .
+<http://example.org/indexTest> <http://example.com/container> <http://example.org/nodeWithoutIndexC> .
+<http://example.org/indexTest> <http://example.com/property> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
+<http://example.org/indexTest> <http://example.com/property> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/indexTest> <http://example.com/property> "language-tagged string Prop"@en .
+<http://example.org/indexTest> <http://example.com/property> "simple string no index" .
+<http://example.org/indexTest> <http://example.com/property> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+<http://example.org/indexTest> <http://example.com/property> "typed literal Prop"^^<http://example.org/type> .
+<http://example.org/indexTest> <http://example.com/property> <http://example.org/nodeWithIndexProp> .
+<http://example.org/indexTest> <http://example.com/property> <http://example.org/nodeWithoutIndexProp> .
diff --git a/test/test-suite/tests/toRdf-0077-in.jsonld b/test/test-suite/tests/toRdf-0077-in.jsonld
new file mode 100644
index 0000000..7e65af4
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0077-in.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "http://xmlns.com/foaf/0.1/knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0077-out.nq b/test/test-suite/tests/toRdf-0077-out.nq
new file mode 100644
index 0000000..787901b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0077-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0078-in.jsonld b/test/test-suite/tests/toRdf-0078-in.jsonld
new file mode 100644
index 0000000..1707129
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0078-in.jsonld
@@ -0,0 +1,38 @@
+{
+  "@context": {
+    "term": "_:term",
+    "termId": { "@id": "term", "@type": "@id" }
+  },
+  "@id": "_:term",
+  "@type": "_:term",
+  "term": [
+    {
+      "@id": "_:term",
+      "@type": "term"
+    },
+    {
+      "@id": "_:Bx",
+      "term": "term"
+    },
+    "plain value",
+    {
+      "@id": "_:term"
+    }
+  ],
+  "termId": [
+    {
+      "@id": "_:term",
+      "@type": "term"
+    },
+    {
+      "@id": "_:Cx",
+      "term": "termId"
+    },
+    "term:AppendedToBlankNode",
+    "_:termAppendedToBlankNode",
+    "relativeIri",
+    {
+      "@id": "_:term"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0078-out.nq b/test/test-suite/tests/toRdf-0078-out.nq
new file mode 100644
index 0000000..bca2360
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0078-out.nq
@@ -0,0 +1 @@
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:b0 .
diff --git a/test/test-suite/tests/toRdf-0079-in.jsonld b/test/test-suite/tests/toRdf-0079-in.jsonld
new file mode 100644
index 0000000..7c3549e
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0079-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0079-out.nq b/test/test-suite/tests/toRdf-0079-out.nq
new file mode 100644
index 0000000..787901b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0079-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0080-in.jsonld b/test/test-suite/tests/toRdf-0080-in.jsonld
new file mode 100644
index 0000000..2d02e0a
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0080-in.jsonld
@@ -0,0 +1,23 @@
+{
+  "@context": {
+    "vocab": "http://example.com/vocab/",
+    "label": {
+      "@id": "vocab:label",
+      "@container": "@language"
+    },
+    "indexes": {
+      "@id": "vocab:index",
+      "@container": "@index"
+    }
+  },
+  "@id": "http://example.com/queen",
+  "label": [
+    "The Queen"
+  ],
+  "indexes":
+  [
+    "No",
+    "indexes",
+    { "@id": "asTheValueIsntAnObject" }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0080-out.nq b/test/test-suite/tests/toRdf-0080-out.nq
new file mode 100644
index 0000000..4059ef5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0080-out.nq
@@ -0,0 +1,4 @@
+<http://example.com/queen> <http://example.com/vocab/index> "No" .
+<http://example.com/queen> <http://example.com/vocab/index> "indexes" .
+<http://example.com/queen> <http://example.com/vocab/index> <http://json-ld.org/test-suite/tests/asTheValueIsntAnObject> .
+<http://example.com/queen> <http://example.com/vocab/label> "The Queen" .
diff --git a/test/test-suite/tests/toRdf-0081-in.jsonld b/test/test-suite/tests/toRdf-0081-in.jsonld
new file mode 100644
index 0000000..7915153
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0081-in.jsonld
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "property": "http://example.com/property",
+    "nested": "http://example.com/nested",
+    "@language": "en"
+  },
+  "property": "this is English",
+  "nested": {
+    "@context": {
+      "@language": null
+    },
+    "property": "and this is a plain string"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0081-out.nq b/test/test-suite/tests/toRdf-0081-out.nq
new file mode 100644
index 0000000..d938ed7
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0081-out.nq
@@ -0,0 +1,3 @@
+_:b0 <http://example.com/nested> _:b1 .
+_:b0 <http://example.com/property> "this is English"@en .
+_:b1 <http://example.com/property> "and this is a plain string" .
diff --git a/test/test-suite/tests/toRdf-0082-in.jsonld b/test/test-suite/tests/toRdf-0082-in.jsonld
new file mode 100644
index 0000000..60cf9ac
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0082-in.jsonld
@@ -0,0 +1,12 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": {
+    "@id": "http://example.com/people/dave",
+    "name": "Dave Longley"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0082-out.nq b/test/test-suite/tests/toRdf-0082-out.nq
new file mode 100644
index 0000000..787901b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0082-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0083-in.jsonld b/test/test-suite/tests/toRdf-0083-in.jsonld
new file mode 100644
index 0000000..8ef0758
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0083-in.jsonld
@@ -0,0 +1,20 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "isKnownBy": [
+      {
+        "@id": "http://example.com/people/dave",
+        "name": "Dave Longley"
+      },
+      {
+        "@id": "http://example.com/people/gregg",
+        "name": "Gregg Kellogg"
+      }
+    ]
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0083-out.nq b/test/test-suite/tests/toRdf-0083-out.nq
new file mode 100644
index 0000000..82f12f7
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0083-out.nq
@@ -0,0 +1,5 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/dave> .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/gregg> .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0084-in.jsonld b/test/test-suite/tests/toRdf-0084-in.jsonld
new file mode 100644
index 0000000..c12bd7b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0084-in.jsonld
@@ -0,0 +1,16 @@
+{
+  "@context": {
+    "property": { "@id": "http://example.com/vocab/property", "@language": "de" },
+    "indexMap": { "@id": "http://example.com/vocab/indexMap", "@language": "en", "@container": "@index" }
+  },
+  "@id": "http://example.com/node",
+  "property": [
+    {
+      "@id": "http://example.com/propertyValueNode",
+      "indexMap": {
+        "expands to english string": "simple string"
+      }
+    },
+    "einfacher String"
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0084-out.nq b/test/test-suite/tests/toRdf-0084-out.nq
new file mode 100644
index 0000000..21981f0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0084-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/node> <http://example.com/vocab/property> "einfacher String"@de .
+<http://example.com/node> <http://example.com/vocab/property> <http://example.com/propertyValueNode> .
+<http://example.com/propertyValueNode> <http://example.com/vocab/indexMap> "simple string"@en .
diff --git a/test/test-suite/tests/toRdf-0085-in.jsonld b/test/test-suite/tests/toRdf-0085-in.jsonld
new file mode 100644
index 0000000..09207e3
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0085-in.jsonld
@@ -0,0 +1,3 @@
+{
+    "@value": "free-floating value"
+}
diff --git a/test/test-suite/tests/toRdf-0085-out.nq b/test/test-suite/tests/toRdf-0085-out.nq
new file mode 100644
index 0000000..e69de29
diff --git a/test/test-suite/tests/toRdf-0086-in.jsonld b/test/test-suite/tests/toRdf-0086-in.jsonld
new file mode 100644
index 0000000..081a887
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0086-in.jsonld
@@ -0,0 +1,14 @@
+{
+    "@graph": [
+        { "@id": "http://example.com/free-floating-node" },
+        { "@value": "free-floating value object" },
+        { "@value": "free-floating value language-tagged string",  "@language": "en" },
+        { "@value": "free-floating value typed value",  "@type": "http://example.com/type" },
+        "free-floating plain string",
+        true,
+        false,
+        null,
+        1,
+        1.5
+    ]
+}
diff --git a/test/test-suite/tests/toRdf-0086-out.nq b/test/test-suite/tests/toRdf-0086-out.nq
new file mode 100644
index 0000000..e69de29
diff --git a/test/test-suite/tests/toRdf-0087-in.jsonld b/test/test-suite/tests/toRdf-0087-in.jsonld
new file mode 100644
index 0000000..90d5411
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0087-in.jsonld
@@ -0,0 +1,28 @@
+{
+    "@context": {
+        "property": "http://example.com/property"
+    },
+    "@graph": [
+        {
+            "@set": [
+                "free-floating strings in set objects are removed",
+                {
+                    "@id": "http://example.com/free-floating-node"
+                },
+                {
+                    "@id": "http://example.com/node",
+                    "property": "nodes with properties are not removed"
+                }
+            ]
+        },
+        {
+            "@list": [
+                "lists are removed even though they represent an invisible linked structure, they have no real meaning",
+                {
+                    "@id": "http://example.com/node-in-free-floating-list",
+                    "property": "everything inside a free-floating list is removed with the list; also nodes with properties"
+                }
+            ]
+        }
+    ]
+}
diff --git a/test/test-suite/tests/toRdf-0087-out.nq b/test/test-suite/tests/toRdf-0087-out.nq
new file mode 100644
index 0000000..f9b7ee6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0087-out.nq
@@ -0,0 +1 @@
+<http://example.com/node> <http://example.com/property> "nodes with properties are not removed" .
diff --git a/test/test-suite/tests/toRdf-0088-in.jsonld b/test/test-suite/tests/toRdf-0088-in.jsonld
new file mode 100644
index 0000000..005f5e1
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0088-in.jsonld
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "term": "http://example.com/terms-are-not-considered-in-id",
+    "compact-iris": "http://example.com/compact-iris-",
+    "property": "http://example.com/property",
+    "@vocab": "http://example.org/vocab-is-not-considered-for-id"
+  },
+  "@id": "term",
+  "property": [
+    {
+      "@id": "compact-iris:are-considered",
+      "property": "@id supports the following values: relative, absolute, and compact IRIs"
+    },
+    {
+      "@id": "../parent-node",
+      "property": "relative IRIs get resolved against the document's base IRI"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0088-out.nq b/test/test-suite/tests/toRdf-0088-out.nq
new file mode 100644
index 0000000..55b4f9f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0088-out.nq
@@ -0,0 +1,4 @@
+<http://example.com/compact-iris-are-considered> <http://example.com/property> "@id supports the following values: relative, absolute, and compact IRIs" .
+<http://json-ld.org/test-suite/parent-node> <http://example.com/property> "relative IRIs get resolved against the document's base IRI" .
+<http://json-ld.org/test-suite/tests/term> <http://example.com/property> <http://example.com/compact-iris-are-considered> .
+<http://json-ld.org/test-suite/tests/term> <http://example.com/property> <http://json-ld.org/test-suite/parent-node> .
diff --git a/test/test-suite/tests/toRdf-0089-in.jsonld b/test/test-suite/tests/toRdf-0089-in.jsonld
new file mode 100644
index 0000000..3f10e01
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0089-in.jsonld
@@ -0,0 +1,12 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@type": "@id" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": [
+    "http://example.com/people/dave",
+    "http://example.com/people/gregg"
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0089-out.nq b/test/test-suite/tests/toRdf-0089-out.nq
new file mode 100644
index 0000000..fe5c7f3
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0089-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0090-in.jsonld b/test/test-suite/tests/toRdf-0090-in.jsonld
new file mode 100644
index 0000000..01b2472
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0090-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "issue": { "@id": "http://example.com/issue/", "@type": "@id" },
+    "issue:raisedBy": { "@container": "@set" }
+  },
+  "issue": "/issue/1",
+  "issue:raisedBy": "Markus"
+}
diff --git a/test/test-suite/tests/toRdf-0090-out.nq b/test/test-suite/tests/toRdf-0090-out.nq
new file mode 100644
index 0000000..537edf6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0090-out.nq
@@ -0,0 +1,2 @@
+_:b0 <http://example.com/issue/> <http://json-ld.org/issue/1> .
+_:b0 <http://example.com/issue/raisedBy> "Markus" .
diff --git a/test/test-suite/tests/toRdf-0091-in.jsonld b/test/test-suite/tests/toRdf-0091-in.jsonld
new file mode 100644
index 0000000..77b7fbd
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0091-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": [
+    { "id": "@id" },
+    { "url": "id" }
+  ],
+  "url": "/issue/1",
+  "http://example.com/property": "ok"
+}
diff --git a/test/test-suite/tests/toRdf-0091-out.nq b/test/test-suite/tests/toRdf-0091-out.nq
new file mode 100644
index 0000000..3481907
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0091-out.nq
@@ -0,0 +1 @@
+<http://json-ld.org/issue/1> <http://example.com/property> "ok" .
diff --git a/test/test-suite/tests/toRdf-0092-in.jsonld b/test/test-suite/tests/toRdf-0092-in.jsonld
new file mode 100644
index 0000000..ee3d9d2
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0092-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "@vocab": "http://example.org/",
+    "property": "vocabRelativeProperty"
+  },
+  "property": "must expand to http://example.org/vocabRelativeProperty",
+  "http://example.org/property": "ok"
+}
diff --git a/test/test-suite/tests/toRdf-0092-out.nq b/test/test-suite/tests/toRdf-0092-out.nq
new file mode 100644
index 0000000..7e88362
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0092-out.nq
@@ -0,0 +1,2 @@
+_:b0 <http://example.org/property> "ok" .
+_:b0 <http://example.org/vocabRelativeProperty> "must expand to http://example.org/vocabRelativeProperty" .
diff --git a/test/test-suite/tests/toRdf-0093-in.jsonld b/test/test-suite/tests/toRdf-0093-in.jsonld
new file mode 100644
index 0000000..3ac3ea9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0093-in.jsonld
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "term": {"@id": "http://example.org/term", "@type": "@vocab"}
+  },
+  "term": "http://example.org/enum"
+}
diff --git a/test/test-suite/tests/toRdf-0093-out.nq b/test/test-suite/tests/toRdf-0093-out.nq
new file mode 100644
index 0000000..fe48284
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0093-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.org/term> <http://example.org/enum> .
diff --git a/test/test-suite/tests/toRdf-0094-in.jsonld b/test/test-suite/tests/toRdf-0094-in.jsonld
new file mode 100644
index 0000000..680afbf
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0094-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "term": {"@id": "http://example.org/term", "@type": "@vocab"},
+    "enum": {"@id": "http://example.org/enum"}
+  },
+  "term": "enum"
+}
diff --git a/test/test-suite/tests/toRdf-0094-out.nq b/test/test-suite/tests/toRdf-0094-out.nq
new file mode 100644
index 0000000..fe48284
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0094-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.org/term> <http://example.org/enum> .
diff --git a/test/test-suite/tests/toRdf-0095-in.jsonld b/test/test-suite/tests/toRdf-0095-in.jsonld
new file mode 100644
index 0000000..1c5ed3b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0095-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "@vocab": "http://example.org/",
+    "term": {"@id": "http://example.org/term", "@type": "@vocab"}
+  },
+  "term": "enum"
+}
diff --git a/test/test-suite/tests/toRdf-0095-out.nq b/test/test-suite/tests/toRdf-0095-out.nq
new file mode 100644
index 0000000..fe48284
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0095-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.org/term> <http://example.org/enum> .
diff --git a/test/test-suite/tests/toRdf-0096-in.jsonld b/test/test-suite/tests/toRdf-0096-in.jsonld
new file mode 100644
index 0000000..6d5b0cb
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0096-in.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "homepage": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@vocab" },
+    "link": { "@id": "http://example.com/link", "@type": "@id" },
+    "MarkusHomepage": "http://www.markus-lanthaler.com/",
+    "relative-iri": "http://example.com/error-if-this-is-used-for-link"
+  },
+  "@id": "http://me.markus-lanthaler.com/",
+  "name": "Markus Lanthaler",
+  "homepage": "MarkusHomepage",
+  "link": "relative-iri"
+}
diff --git a/test/test-suite/tests/toRdf-0096-out.nq b/test/test-suite/tests/toRdf-0096-out.nq
new file mode 100644
index 0000000..bca879f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0096-out.nq
@@ -0,0 +1,3 @@
+<http://me.markus-lanthaler.com/> <http://example.com/link> <http://json-ld.org/test-suite/tests/relative-iri> .
+<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/homepage> <http://www.markus-lanthaler.com/> .
+<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0097-in.jsonld b/test/test-suite/tests/toRdf-0097-in.jsonld
new file mode 100644
index 0000000..732cc92
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0097-in.jsonld
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "term": { "@id": "http://example.org/term", "@type": "@vocab" }
+  },
+  "term": "not-a-term-thus-a-relative-IRI"
+}
diff --git a/test/test-suite/tests/toRdf-0097-out.nq b/test/test-suite/tests/toRdf-0097-out.nq
new file mode 100644
index 0000000..384f1d9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0097-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.org/term> <http://json-ld.org/test-suite/tests/not-a-term-thus-a-relative-IRI> .
diff --git a/test/test-suite/tests/toRdf-0098-in.jsonld b/test/test-suite/tests/toRdf-0098-in.jsonld
new file mode 100644
index 0000000..68dc324
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0098-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "term": { "@id": "http://example.org/term", "@type": "@vocab" },
+    "prefix": "http://example.com/vocab#"
+  },
+  "term": "prefix:suffix"
+}
diff --git a/test/test-suite/tests/toRdf-0098-out.nq b/test/test-suite/tests/toRdf-0098-out.nq
new file mode 100644
index 0000000..49cae84
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0098-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.org/term> <http://example.com/vocab#suffix> .
diff --git a/test/test-suite/tests/toRdf-0099-in.jsonld b/test/test-suite/tests/toRdf-0099-in.jsonld
new file mode 100644
index 0000000..05f582f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0099-in.jsonld
@@ -0,0 +1,16 @@
+{
+  "@context": {
+    "@vocab": "http://example.org/vocab#"
+  },
+  "@id": "example-with-vocab",
+  "@type": "vocab-prefixed",
+  "property": "property expanded using @vocab",
+  "embed": {
+    "@context": {
+      "@vocab": null
+    },
+    "@id": "example-vocab-reset",
+    "@type": "document-relative",
+    "property": "@vocab reset, property will be dropped"
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0099-out.nq b/test/test-suite/tests/toRdf-0099-out.nq
new file mode 100644
index 0000000..85da3ac
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0099-out.nq
@@ -0,0 +1,4 @@
+<http://json-ld.org/test-suite/tests/example-vocab-reset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/document-relative> .
+<http://json-ld.org/test-suite/tests/example-with-vocab> <http://example.org/vocab#embed> <http://json-ld.org/test-suite/tests/example-vocab-reset> .
+<http://json-ld.org/test-suite/tests/example-with-vocab> <http://example.org/vocab#property> "property expanded using @vocab" .
+<http://json-ld.org/test-suite/tests/example-with-vocab> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#vocab-prefixed> .
diff --git a/test/test-suite/tests/toRdf-0100-in.jsonld b/test/test-suite/tests/toRdf-0100-in.jsonld
new file mode 100644
index 0000000..2a2d190
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0100-in.jsonld
@@ -0,0 +1,30 @@
+{
+  "@context": {
+    "property": "http://example.com/vocab#property"
+  },
+  "@id": "../document-relative",
+  "@type": "#document-relative",
+  "property": {
+    "@context": {
+      "@base": "http://example.org/test/"
+    },
+    "@id": "../document-base-overwritten",
+    "@type": "#document-base-overwritten",
+    "property": [
+      {
+        "@context": null,
+        "@id": "../document-relative",
+        "@type": "#document-relative",
+        "property": "context completely reset, drops property"
+      },
+      {
+        "@context": {
+          "@base": null
+        },
+        "@id": "../document-relative",
+        "@type": "#document-relative",
+        "property": "@base is set to none"
+      }
+    ]
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0100-out.nq b/test/test-suite/tests/toRdf-0100-out.nq
new file mode 100644
index 0000000..8f20fb1
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0100-out.nq
@@ -0,0 +1,4 @@
+<http://example.org/document-base-overwritten> <http://example.com/vocab#property> <http://json-ld.org/test-suite/document-relative> .
+<http://example.org/document-base-overwritten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/test/#document-base-overwritten> .
+<http://json-ld.org/test-suite/document-relative> <http://example.com/vocab#property> <http://example.org/document-base-overwritten> .
+<http://json-ld.org/test-suite/document-relative> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://json-ld.org/test-suite/tests/toRdf-0100-in.jsonld#document-relative> .
diff --git a/test/test-suite/tests/toRdf-0101-in.jsonld b/test/test-suite/tests/toRdf-0101-in.jsonld
new file mode 100644
index 0000000..45c1d51
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0101-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "property": {
+      "@id": "http://example.com/property",
+      "@type": "http://example.com/datatype"
+    }
+  },
+  "property": [ 1, true, false, 5.1 ]
+}
diff --git a/test/test-suite/tests/toRdf-0101-out.nq b/test/test-suite/tests/toRdf-0101-out.nq
new file mode 100644
index 0000000..00a8ffe
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0101-out.nq
@@ -0,0 +1,4 @@
+_:b0 <http://example.com/property> "1"^^<http://example.com/datatype> .
+_:b0 <http://example.com/property> "5.1E0"^^<http://example.com/datatype> .
+_:b0 <http://example.com/property> "false"^^<http://example.com/datatype> .
+_:b0 <http://example.com/property> "true"^^<http://example.com/datatype> .
diff --git a/test/test-suite/tests/toRdf-0102-in.jsonld b/test/test-suite/tests/toRdf-0102-in.jsonld
new file mode 100644
index 0000000..fb47251
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0102-in.jsonld
@@ -0,0 +1,35 @@
+{
+  "@context": {
+    "@base": "http://example.com/some/deep/directory/and/file#with-a-fragment",
+    "links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
+  },
+  "@id": "relativeIris",
+  "@type": [
+    "link",
+    "#fragment-works",
+    "?query=works",
+    "./",
+    "../",
+    "../parent",
+    "../../parent-parent-eq-root",
+    "../../../../../still-root",
+    "../.././.././../../too-many-dots",
+    "/absolute",
+    "//example.org/scheme-relative"
+  ],
+  "links": [
+    "link",
+    "#fragment-works",
+    "?query=works",
+    "./",
+    "../",
+    "../parent",
+    "../../parent-parent-eq-root",
+    "./../../../../../still-root",
+    "../.././.././../../too-many-dots",
+    "/absolute",
+    "//example.org/scheme-relative",
+    "//example.org/../scheme-relative",
+    "//example.org/.././useless/../../scheme-relative"
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0102-out.nq b/test/test-suite/tests/toRdf-0102-out.nq
new file mode 100644
index 0000000..d5f5db3
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0102-out.nq
@@ -0,0 +1,38 @@
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.example.com/link> _:b0 .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/absolute> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/file#fragment-works> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/file?query=works> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/and/link> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/directory/parent> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/some/deep/parent-parent-eq-root> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/still-root> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/too-many-dots> .
+<http://example.com/some/deep/directory/and/relativeIris> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/scheme-relative> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/link> .
+_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/file#fragment-works> .
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
+_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
+_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b11 .
+_:b11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
+_:b11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b12 .
+_:b12 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/scheme-relative> .
+_:b12 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/file?query=works> .
+_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/and/> .
+_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/> .
+_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b5 .
+_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/directory/parent> .
+_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b6 .
+_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/some/deep/parent-parent-eq-root> .
+_:b6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b7 .
+_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/still-root> .
+_:b7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b8 .
+_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/too-many-dots> .
+_:b8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b9 .
+_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.com/absolute> .
+_:b9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b10 .
diff --git a/test/test-suite/tests/toRdf-0103-in.jsonld b/test/test-suite/tests/toRdf-0103-in.jsonld
new file mode 100644
index 0000000..a9a83b0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0103-in.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@index" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": {
+    "Dave": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    },
+    "Gregg": {
+      "@id": "http://example.com/people/gregg",
+      "name": "Gregg Kellogg"
+    }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0103-out.nq b/test/test-suite/tests/toRdf-0103-out.nq
new file mode 100644
index 0000000..d907850
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0103-out.nq
@@ -0,0 +1,5 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/gregg> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0104-in.jsonld b/test/test-suite/tests/toRdf-0104-in.jsonld
new file mode 100644
index 0000000..dc31389
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0104-in.jsonld
@@ -0,0 +1,16 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": [
+    {
+      "name": "Dave Longley"
+    },
+    {
+      "name": "Gregg Kellogg"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0104-out.nq b/test/test-suite/tests/toRdf-0104-out.nq
new file mode 100644
index 0000000..15b5842
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0104-out.nq
@@ -0,0 +1,5 @@
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
+_:b0 <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+_:b0 <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+_:b1 <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+_:b1 <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
diff --git a/test/test-suite/tests/toRdf-0105-in.jsonld b/test/test-suite/tests/toRdf-0105-in.jsonld
new file mode 100644
index 0000000..116e050
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0105-in.jsonld
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    },
+    "relative-iri": {
+      "@id": "relative-node",
+      "name": "Keys that are not mapped to an IRI in a reverse-map are dropped"
+    }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0105-out.nq b/test/test-suite/tests/toRdf-0105-out.nq
new file mode 100644
index 0000000..787901b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0105-out.nq
@@ -0,0 +1,3 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
diff --git a/test/test-suite/tests/toRdf-0106-in.jsonld b/test/test-suite/tests/toRdf-0106-in.jsonld
new file mode 100644
index 0000000..b3a9bd8
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0106-in.jsonld
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows",
+    "@vocab": "http://example.com/vocab/"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    },
+    "noTerm": {
+      "@id": "relative-node",
+      "name": "Compact keys using @vocab"
+    }
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0106-out.nq b/test/test-suite/tests/toRdf-0106-out.nq
new file mode 100644
index 0000000..1dcbdf7
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0106-out.nq
@@ -0,0 +1,5 @@
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/knows> <http://example.com/people/markus> .
+<http://example.com/people/dave> <http://xmlns.com/foaf/0.1/name> "Dave Longley" .
+<http://example.com/people/markus> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
+<http://json-ld.org/test-suite/tests/relative-node> <http://example.com/vocab/noTerm> <http://example.com/people/markus> .
+<http://json-ld.org/test-suite/tests/relative-node> <http://xmlns.com/foaf/0.1/name> "Compact keys using @vocab" .
diff --git a/test/test-suite/tests/toRdf-0107-in.jsonld b/test/test-suite/tests/toRdf-0107-in.jsonld
new file mode 100644
index 0000000..a8e29a6
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0107-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "http": "http://example.com/this-prefix-would-overwrite-all-http-iris"
+  },
+  "@id": "http://example.org/node1",
+  "@type": "http://example.org/type",
+  "http://example.org/property": "all these IRIs remain unchanged because they are interpreted as absolute IRIs"
+}
diff --git a/test/test-suite/tests/toRdf-0107-out.nq b/test/test-suite/tests/toRdf-0107-out.nq
new file mode 100644
index 0000000..c33dd89
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0107-out.nq
@@ -0,0 +1,2 @@
+<http://example.org/node1> <http://example.org/property> "all these IRIs remain unchanged because they are interpreted as absolute IRIs" .
+<http://example.org/node1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/type> .
diff --git a/test/test-suite/tests/toRdf-0108-in.jsonld b/test/test-suite/tests/toRdf-0108-in.jsonld
new file mode 100644
index 0000000..ab52e5e
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0108-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "_": "http://example.com/this-prefix-would-overwrite-all-blank-node-identifiers"
+  },
+  "@id": "_:node1",
+  "@type": "_:type",
+  "_:property": "all these IRIs remain unchanged because they are interpreted as blank node identifiers"
+}
diff --git a/test/test-suite/tests/toRdf-0108-out.nq b/test/test-suite/tests/toRdf-0108-out.nq
new file mode 100644
index 0000000..6a736bb
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0108-out.nq
@@ -0,0 +1 @@
+_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:b0 .
diff --git a/test/test-suite/tests/toRdf-0109-in.jsonld b/test/test-suite/tests/toRdf-0109-in.jsonld
new file mode 100644
index 0000000..8f4a9aa
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0109-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
+    "rdfs:subClassOf": { "@id": "rdfs:subClassOf", "@type": "@id" }
+  },
+  "@id": "http://example.com/vocab#class",
+  "@type": "rdfs:Class",
+  "rdfs:subClassOf": "http://example.com/vocab#someOtherClass"
+}
diff --git a/test/test-suite/tests/toRdf-0109-out.nq b/test/test-suite/tests/toRdf-0109-out.nq
new file mode 100644
index 0000000..eb20efc
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0109-out.nq
@@ -0,0 +1,2 @@
+<http://example.com/vocab#class> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
+<http://example.com/vocab#class> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/vocab#someOtherClass> .
diff --git a/test/test-suite/tests/toRdf-0110-in.jsonld b/test/test-suite/tests/toRdf-0110-in.jsonld
new file mode 100644
index 0000000..59733fb
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0110-in.jsonld
@@ -0,0 +1,9 @@
+{
+  "@context": {
+    "prefix": "http://www.example.org/vocab#",
+    "prefix:foo": "prefix:foo"
+  },
+  "@id": "http://example.com/vocab#id",
+  "@type": "prefix:Class",
+  "prefix:foo": "bar"
+}
diff --git a/test/test-suite/tests/toRdf-0110-out.nq b/test/test-suite/tests/toRdf-0110-out.nq
new file mode 100644
index 0000000..532caa7
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0110-out.nq
@@ -0,0 +1,2 @@
+<http://example.com/vocab#id> <http://www.example.org/vocab#foo> "bar" .
+<http://example.com/vocab#id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/vocab#Class> .
diff --git a/test/test-suite/tests/toRdf-0111-in.jsonld b/test/test-suite/tests/toRdf-0111-in.jsonld
new file mode 100644
index 0000000..598c43f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0111-in.jsonld
@@ -0,0 +1,15 @@
+{
+  "@context": [
+    {
+      "v": "http://example.com/vocab#",
+      "v:term": "v:somethingElse",
+      "v:termId": { "@id": "v:somethingElseId" }
+    },
+    {
+      "v:term": "v:term",
+      "v:termId": { "@id": "v:termId" }
+    }
+  ],
+  "v:term": "value of v:term",
+  "v:termId": "value of v:termId"
+}
diff --git a/test/test-suite/tests/toRdf-0111-out.nq b/test/test-suite/tests/toRdf-0111-out.nq
new file mode 100644
index 0000000..3f78e2c
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0111-out.nq
@@ -0,0 +1,2 @@
+_:b0 <http://example.com/vocab#term> "value of v:term" .
+_:b0 <http://example.com/vocab#termId> "value of v:termId" .
diff --git a/test/test-suite/tests/toRdf-0112-in.jsonld b/test/test-suite/tests/toRdf-0112-in.jsonld
new file mode 100644
index 0000000..dcfa1b4
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0112-in.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context": [
+    {
+      "v": "http://example.com/vocab#",
+      "term": "v:somethingElse"
+    },
+    {
+      "@vocab": "http://example.com/anotherVocab#",
+      "term": "term"
+    }
+  ],
+  "term": "value of term"
+}
diff --git a/test/test-suite/tests/toRdf-0112-out.nq b/test/test-suite/tests/toRdf-0112-out.nq
new file mode 100644
index 0000000..8799e69
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0112-out.nq
@@ -0,0 +1 @@
+_:b0 <http://example.com/anotherVocab#term> "value of term" .
diff --git a/test/test-suite/tests/toRdf-0113-in.jsonld b/test/test-suite/tests/toRdf-0113-in.jsonld
new file mode 100644
index 0000000..3c337f0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0113-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@id": "http://example/g",
+  "@graph": {
+    "@id": "http://example/s",
+    "http://example/p": {"@id": "http://example/o"}
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0113-out.nq b/test/test-suite/tests/toRdf-0113-out.nq
new file mode 100644
index 0000000..a52ec90
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0113-out.nq
@@ -0,0 +1 @@
+<http://example/s> <http://example/p> <http://example/o> <http://example/g> .
diff --git a/test/test-suite/tests/toRdf-0114-in.jsonld b/test/test-suite/tests/toRdf-0114-in.jsonld
new file mode 100644
index 0000000..9f170b5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0114-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "@id": "_:g",
+  "@graph": {
+    "@id": "http://example/s",
+    "http://example/p": {"@id": "http://example/o"}
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0114-out.nq b/test/test-suite/tests/toRdf-0114-out.nq
new file mode 100644
index 0000000..58a2adc
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0114-out.nq
@@ -0,0 +1 @@
+<http://example/s> <http://example/p> <http://example/o> _:b0 .
diff --git a/test/test-suite/tests/toRdf-0115-in.jsonld b/test/test-suite/tests/toRdf-0115-in.jsonld
new file mode 100644
index 0000000..c719184
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0115-in.jsonld
@@ -0,0 +1,20 @@
+{
+  "@graph": [{
+    "@id": "http://example/s0",
+    "http://example/p0": {"@id": "http://example/o0"}
+  },
+  {
+    "@id": "http://example/g",
+    "@graph": {
+      "@id": "http://example/s1",
+      "http://example/p1": {"@id": "http://example/o1"}
+    }
+  },
+  {
+    "@id": "_:g",
+    "@graph": {
+      "@id": "http://example/s2",
+      "http://example/p2": {"@id": "http://example/o2"}
+    }
+  }]
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0115-out.nq b/test/test-suite/tests/toRdf-0115-out.nq
new file mode 100644
index 0000000..975388b
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0115-out.nq
@@ -0,0 +1,3 @@
+<http://example/s0> <http://example/p0> <http://example/o0> .
+<http://example/s1> <http://example/p1> <http://example/o1> <http://example/g> .
+<http://example/s2> <http://example/p2> <http://example/o2> _:b0 .
diff --git a/test/test-suite/tests/toRdf-0116-in.jsonld b/test/test-suite/tests/toRdf-0116-in.jsonld
new file mode 100644
index 0000000..d574989
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0116-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@id": "http://example/s0",
+  "http://example/p0": {"@id": "http://example/o0"},
+  "@graph": {
+    "@id": "http://example/s1",
+    "http://example/p1": {"@id": "http://example/o1"}
+  }
+}
\ No newline at end of file
diff --git a/test/test-suite/tests/toRdf-0116-out.nq b/test/test-suite/tests/toRdf-0116-out.nq
new file mode 100644
index 0000000..a7887a9
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0116-out.nq
@@ -0,0 +1,2 @@
+<http://example/s0> <http://example/p0> <http://example/o0> .
+<http://example/s1> <http://example/p1> <http://example/o1> <http://example/s0> .
diff --git a/test/test-suite/tests/toRdf-0117-in.jsonld b/test/test-suite/tests/toRdf-0117-in.jsonld
new file mode 100644
index 0000000..cdd79a8
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0117-in.jsonld
@@ -0,0 +1,7 @@
+{
+  "http://example/p0": {"@id": "http://example/o0"},
+  "@graph": {
+    "@id": "http://example/s1",
+    "http://example/p1": {"@id": "http://example/o1"}
+  }
+}
diff --git a/test/test-suite/tests/toRdf-0117-out.nq b/test/test-suite/tests/toRdf-0117-out.nq
new file mode 100644
index 0000000..1fdb0e0
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0117-out.nq
@@ -0,0 +1,2 @@
+<http://example/s1> <http://example/p1> <http://example/o1> _:b0 .
+_:b0 <http://example/p0> <http://example/o0> .
diff --git a/test/test-suite/tests/toRdf-0118-in.jsonld b/test/test-suite/tests/toRdf-0118-in.jsonld
new file mode 100644
index 0000000..1707129
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0118-in.jsonld
@@ -0,0 +1,38 @@
+{
+  "@context": {
+    "term": "_:term",
+    "termId": { "@id": "term", "@type": "@id" }
+  },
+  "@id": "_:term",
+  "@type": "_:term",
+  "term": [
+    {
+      "@id": "_:term",
+      "@type": "term"
+    },
+    {
+      "@id": "_:Bx",
+      "term": "term"
+    },
+    "plain value",
+    {
+      "@id": "_:term"
+    }
+  ],
+  "termId": [
+    {
+      "@id": "_:term",
+      "@type": "term"
+    },
+    {
+      "@id": "_:Cx",
+      "term": "termId"
+    },
+    "term:AppendedToBlankNode",
+    "_:termAppendedToBlankNode",
+    "relativeIri",
+    {
+      "@id": "_:term"
+    }
+  ]
+}
diff --git a/test/test-suite/tests/toRdf-0118-out.nq b/test/test-suite/tests/toRdf-0118-out.nq
new file mode 100644
index 0000000..4e0570d
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0118-out.nq
@@ -0,0 +1,9 @@
+_:term <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:term .
+_:term _:term "plain value" .
+_:term _:term <http://json-ld.org/test-suite/tests/relativeIri> .
+_:term _:term _:term .
+_:term _:term _:Bx .
+_:term _:term _:Cx .
+_:term _:term _:b3 .
+_:Bx _:term "term" .
+_:Cx _:term "termId" .
diff --git a/test/test-suite/tests/toRdf-0119-in.jsonld b/test/test-suite/tests/toRdf-0119-in.jsonld
new file mode 100644
index 0000000..088bb2f
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0119-in.jsonld
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "foo": "http://example.org/foo",
+    "bar": { "@reverse": "http://example.org/bar", "@type": "@id" }
+  },
+  "foo": "Foo",
+  "bar": [ "http://example.org/origin", "_:b0" ]
+}
diff --git a/test/test-suite/tests/toRdf-0119-out.nq b/test/test-suite/tests/toRdf-0119-out.nq
new file mode 100644
index 0000000..6fbbe3d
--- /dev/null
+++ b/test/test-suite/tests/toRdf-0119-out.nq
@@ -0,0 +1,3 @@
+<http://example.org/origin> <http://example.org/bar> _:b0 .
+_:b0 <http://example.org/foo> "Foo" .
+_:b1 <http://example.org/bar> _:b0 .
diff --git a/test/test-suite/tests/toRdf-manifest.jsonld b/test/test-suite/tests/toRdf-manifest.jsonld
new file mode 100644
index 0000000..8abb3e5
--- /dev/null
+++ b/test/test-suite/tests/toRdf-manifest.jsonld
@@ -0,0 +1,812 @@
+{
+  "@context": "http://json-ld.org/test-suite/context.jsonld",
+  "@id": "",
+  "@type": "mf:Manifest",
+  "name": "Transform JSON-LD to RDF",
+  "description": "JSON-LD to RDF tests generate N-Quads output and use string comparison.",
+  "baseIri": "http://json-ld.org/test-suite/tests/",
+  "sequence": [
+    {
+      "@id": "#t0001",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Plain literal with URIs",
+      "purpose": "Tests generation of a triple using full URIs and a plain literal.",
+      "input": "toRdf-0001-in.jsonld",
+      "expect": "toRdf-0001-out.nq"
+    }, {
+      "@id": "#t0002",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Plain literal with CURIE from default context",
+      "purpose": "Tests generation of a triple using a CURIE defined in the default context.",
+      "input": "toRdf-0002-in.jsonld",
+      "expect": "toRdf-0002-out.nq"
+    }, {
+      "@id": "#t0003",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Default subject is BNode",
+      "purpose": "Tests that a BNode is created if no explicit subject is set.",
+      "input": "toRdf-0003-in.jsonld",
+      "expect": "toRdf-0003-out.nq"
+    }, {
+      "@id": "#t0004",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Literal with language tag",
+      "purpose": "Tests that a plain literal is created with a language tag.",
+      "input": "toRdf-0004-in.jsonld",
+      "expect": "toRdf-0004-out.nq"
+    }, {
+      "@id": "#t0005",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Extended character set literal",
+      "purpose": "Tests that a literal may be created using extended characters.",
+      "input": "toRdf-0005-in.jsonld",
+      "expect": "toRdf-0005-out.nq"
+    }, {
+      "@id": "#t0006",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Typed literal",
+      "purpose": "Tests creation of a literal with a datatype.",
+      "input": "toRdf-0006-in.jsonld",
+      "expect": "toRdf-0006-out.nq"
+    }, {
+      "@id": "#t0007",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Tests 'a' generates rdf:type and object is implicit IRI",
+      "purpose": "Verify that 'a' is an alias for rdf:type, and the object is created as an IRI.",
+      "input": "toRdf-0007-in.jsonld",
+      "expect": "toRdf-0007-out.nq"
+    }, {
+      "@id": "#t0008",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test prefix defined in @context",
+      "purpose": "Generate an IRI using a prefix defined within an @context.",
+      "input": "toRdf-0008-in.jsonld",
+      "expect": "toRdf-0008-out.nq"
+    }, {
+      "@id": "#t0009",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test using an empty suffix",
+      "purpose": "An empty suffix may be used.",
+      "input": "toRdf-0009-in.jsonld",
+      "expect": "toRdf-0009-out.nq"
+    }, {
+      "@id": "#t0010",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test object processing defines object",
+      "purpose": "A property referencing an associative array gets object from subject of array.",
+      "input": "toRdf-0010-in.jsonld",
+      "expect": "toRdf-0010-out.nq"
+    }, {
+      "@id": "#t0011",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test object processing defines object with implicit BNode",
+      "purpose": "If no @ is specified, a BNode is created, and will be used as the object of an enclosing property.",
+      "input": "toRdf-0011-in.jsonld",
+      "expect": "toRdf-0011-out.nq"
+    }, {
+      "@id": "#t0012",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Multiple Objects for a Single Property",
+      "purpose": "Tests that Multiple Objects are for a Single Property using array syntax.",
+      "input": "toRdf-0012-in.jsonld",
+      "expect": "toRdf-0012-out.nq"
+    }, {
+      "@id": "#t0013",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Creation of an empty list",
+      "purpose": "Tests that @list: [] generates an empty list.",
+      "input": "toRdf-0013-in.jsonld",
+      "expect": "toRdf-0013-out.nq"
+    }, {
+      "@id": "#t0014",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Creation of a list with single element",
+      "purpose": "Tests that @list generates a list.",
+      "input": "toRdf-0014-in.jsonld",
+      "expect": "toRdf-0014-out.nq"
+    }, {
+      "@id": "#t0015",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Creation of a list with multiple elements",
+      "purpose": "Tests that list with multiple elements.",
+      "input": "toRdf-0015-in.jsonld",
+      "expect": "toRdf-0015-out.nq"
+    }, {
+      "@id": "#t0016",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Empty IRI expands to resource location",
+      "purpose": "Expanding an empty IRI uses the test file location.",
+      "input": "toRdf-0016-in.jsonld",
+      "expect": "toRdf-0016-out.nq"
+    }, {
+      "@id": "#t0017",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Relative IRI expands relative resource location",
+      "purpose": "Expanding a relative IRI uses the test file location.",
+      "input": "toRdf-0017-in.jsonld",
+      "expect": "toRdf-0017-out.nq"
+    }, {
+      "@id": "#t0018",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Frag ID expands relative resource location",
+      "purpose": "Expanding a fragment uses the test file location.",
+      "input": "toRdf-0018-in.jsonld",
+      "expect": "toRdf-0018-out.nq"
+    }, {
+      "@id": "#t0019",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test type coercion to anyURI",
+      "purpose": "Tests coercion of object to anyURI when specified.",
+      "input": "toRdf-0019-in.jsonld",
+      "expect": "toRdf-0019-out.nq"
+    }, {
+      "@id": "#t0020",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test type coercion to typed literal",
+      "purpose": "Tests coercion of object to a typed literal when specified.",
+      "input": "toRdf-0020-in.jsonld",
+      "expect": "toRdf-0020-out.nq"
+    }, {
+      "@id": "#t0022",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test coercion of double value",
+      "purpose": "Tests that a decimal value generates a xsd:double typed literal;.",
+      "input": "toRdf-0022-in.jsonld",
+      "expect": "toRdf-0022-out.nq"
+    }, {
+      "@id": "#t0023",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test coercion of integer value",
+      "purpose": "Tests that a decimal value generates a xsd:integer typed literal.",
+      "input": "toRdf-0023-in.jsonld",
+      "expect": "toRdf-0023-out.nq"
+    }, {
+      "@id": "#t0024",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test coercion of boolean value",
+      "purpose": "Tests that a decimal value generates a xsd:boolean typed literal.",
+      "input": "toRdf-0024-in.jsonld",
+      "expect": "toRdf-0024-out.nq"
+    }, {
+      "@id": "#t0025",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test list coercion with single element",
+      "purpose": "Tests that an array with a single element on a property with @list coercion creates an RDF Collection.",
+      "input": "toRdf-0025-in.jsonld",
+      "expect": "toRdf-0025-out.nq"
+    }, {
+      "@id": "#t0026",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Test creation of multiple types",
+      "purpose": "Tests that @type with an array of types creates multiple types.",
+      "input": "toRdf-0026-in.jsonld",
+      "expect": "toRdf-0026-out.nq"
+    }, {
+      "@id": "#t0027",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Simple named graph (Wikidata)",
+      "purpose": "Using @graph with other keys places triples in a named graph.",
+      "input": "toRdf-0027-in.jsonld",
+      "expect": "toRdf-0027-out.nq"
+    }, {
+      "@id": "#t0028",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Simple named graph",
+      "purpose": "Signing a graph.",
+      "input": "toRdf-0028-in.jsonld",
+      "expect": "toRdf-0028-out.nq"
+    }, {
+      "@id": "#t0029",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "named graph with embedded named graph",
+      "purpose": "Tests that named graphs containing named graphs flatten to single level of graph naming.",
+      "input": "toRdf-0029-in.jsonld",
+      "expect": "toRdf-0029-out.nq"
+    }, {
+      "@id": "#t0030",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "top-level graph with string subject reference",
+      "purpose": "Tests graphs containing subject references as strings.",
+      "input": "toRdf-0030-in.jsonld",
+      "expect": "toRdf-0030-out.nq"
+    }, {
+      "@id": "#t0031",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Reverse property",
+      "purpose": "Tests conversion of reverse properties.",
+      "input": "toRdf-0031-in.jsonld",
+      "expect": "toRdf-0031-out.nq"
+    }, {
+      "@id": "#t0032",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@context reordering",
+      "purpose": "Tests that generated triples do not depend on order of @context.",
+      "input": "toRdf-0032-in.jsonld",
+      "expect": "toRdf-0032-out.nq"
+    }, {
+      "@id": "#t0033",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@id reordering",
+      "purpose": "Tests that generated triples do not depend on order of @id.",
+      "input": "toRdf-0033-in.jsonld",
+      "expect": "toRdf-0033-out.nq"
+    }, {
+      "@id": "#t0034",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "context properties reordering",
+      "purpose": "Tests that generated triples do not depend on order of properties inside @context.",
+      "input": "toRdf-0034-in.jsonld",
+      "expect": "toRdf-0034-out.nq"
+    }, {
+      "@id": "#t0035",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "non-fractional numbers converted to xsd:double",
+      "purpose": "xsd:double's canonical lexical is used when converting numbers without fraction that are coerced to xsd:double",
+      "input": "toRdf-0035-in.jsonld",
+      "expect": "toRdf-0035-out.nq"
+    }, {
+      "@id": "#t0036",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Use nodeMapGeneration bnode labels",
+      "purpose": "The toRDF algorithm does not relabel blank nodes; it reuses the counter from the nodeMapGeneration to generate new ones",
+      "input": "toRdf-0036-in.jsonld",
+      "expect": "toRdf-0036-out.nq"
+    }, {
+      "@id": "#t0041",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "drop free-floating nodes",
+      "purpose": "Free-floating nodes do not generate RDF triples",
+      "input": "toRdf-0041-in.jsonld",
+      "expect": "toRdf-0041-out.nq"
+    }, {
+      "@id": "#t0042",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "basic",
+      "purpose": "Basic RDF conversion",
+      "input": "toRdf-0042-in.jsonld",
+      "expect": "toRdf-0042-out.nq"
+    }, {
+      "@id": "#t0043",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "drop null and unmapped properties",
+      "purpose": "Properties mapped to null or which are never mapped are dropped",
+      "input": "toRdf-0043-in.jsonld",
+      "expect": "toRdf-0043-out.nq"
+    }, {
+      "@id": "#t0044",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "optimize @set, keep empty arrays",
+      "purpose": "RDF version of expand-0004",
+      "input": "toRdf-0044-in.jsonld",
+      "expect": "toRdf-0044-out.nq"
+    }, {
+      "@id": "#t0045",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "do not expand aliased @id/@type",
+      "purpose": "RDF version of expand-0005",
+      "input": "toRdf-0045-in.jsonld",
+      "expect": "toRdf-0045-out.nq"
+    }, {
+      "@id": "#t0046",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "alias keywords",
+      "purpose": "RDF version of expand-0006",
+      "input": "toRdf-0046-in.jsonld",
+      "expect": "toRdf-0046-out.nq"
+    }, {
+      "@id": "#t0047",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "date type-coercion",
+      "purpose": "Type-coerced dates generate typed literals",
+      "input": "toRdf-0047-in.jsonld",
+      "expect": "toRdf-0047-out.nq"
+    }, {
+      "@id": "#t0048",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@value with @language",
+      "purpose": "RDF version of expand-0008",
+      "input": "toRdf-0048-in.jsonld",
+      "expect": "toRdf-0048-out.nq"
+    }, {
+      "@id": "#t0049",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@graph with terms",
+      "purpose": "RDF version of expand-0009",
+      "input": "toRdf-0049-in.jsonld",
+      "expect": "toRdf-0049-out.nq"
+    }, {
+      "@id": "#t0050",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "native types",
+      "purpose": "Native types generate typed literals",
+      "input": "toRdf-0050-in.jsonld",
+      "expect": "toRdf-0050-out.nq"
+    }, {
+      "@id": "#t0051",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "coerced @id",
+      "purpose": "RDF version of expand-0011",
+      "input": "toRdf-0051-in.jsonld",
+      "expect": "toRdf-0051-out.nq"
+    }, {
+      "@id": "#t0052",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@graph with embed",
+      "purpose": "RDF version of expand-0012",
+      "input": "toRdf-0052-in.jsonld",
+      "expect": "toRdf-0052-out.nq"
+    }, {
+      "@id": "#t0053",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "expand already expanded",
+      "purpose": "RDF version of expand-0013",
+      "input": "toRdf-0053-in.jsonld",
+      "expect": "toRdf-0053-out.nq"
+    }, {
+      "@id": "#t0054",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@set of @value objects with keyword aliases",
+      "purpose": "RDF version of expand-0014",
+      "input": "toRdf-0054-in.jsonld",
+      "expect": "toRdf-0054-out.nq"
+    }, {
+      "@id": "#t0055",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "collapse set of sets, keep empty lists",
+      "purpose": "RDF version of expand-0015",
+      "input": "toRdf-0055-in.jsonld",
+      "expect": "toRdf-0055-out.nq"
+    }, {
+      "@id": "#t0056",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "context reset",
+      "purpose": "RDF version of expand-0016",
+      "input": "toRdf-0056-in.jsonld",
+      "expect": "toRdf-0056-out.nq"
+    }, {
+      "@id": "#t0057",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@graph and @id aliased",
+      "purpose": "RDF version of expand-0017",
+      "input": "toRdf-0057-in.jsonld",
+      "expect": "toRdf-0057-out.nq"
+    }, {
+      "@id": "#t0058",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "override default @language",
+      "purpose": "RDF version of expand-0018",
+      "input": "toRdf-0058-in.jsonld",
+      "expect": "toRdf-0058-out.nq"
+    }, {
+      "@id": "#t0059",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "remove @value = null",
+      "purpose": "RDF version of expand-0019",
+      "input": "toRdf-0059-in.jsonld",
+      "expect": "toRdf-0059-out.nq"
+    }, {
+      "@id": "#t0060",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "do not remove @graph if not at top-level",
+      "purpose": "Embedded @graph without @id creates BNode-labeled named graph",
+      "input": "toRdf-0060-in.jsonld",
+      "expect": "toRdf-0060-out.nq"
+    }, {
+      "@id": "#t0061",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "do not remove @graph at top-level if not only property",
+      "purpose": "RDF version of expand-0021",
+      "input": "toRdf-0061-in.jsonld",
+      "expect": "toRdf-0061-out.nq"
+    }, {
+      "@id": "#t0062",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "expand value with default language",
+      "purpose": "RDF version of expand-0022",
+      "input": "toRdf-0062-in.jsonld",
+      "expect": "toRdf-0062-out.nq"
+    }, {
+      "@id": "#t0063",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Lists and sets of properties with list/set coercion",
+      "purpose": "RDF version of expand-0023",
+      "input": "toRdf-0063-in.jsonld",
+      "expect": "toRdf-0063-out.nq"
+    }, {
+      "@id": "#t0064",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Multiple contexts",
+      "purpose": "RDF version of expand-0024",
+      "input": "toRdf-0064-in.jsonld",
+      "expect": "toRdf-0064-out.nq"
+    }, {
+      "@id": "#t0065",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Problematic IRI expansion tests",
+      "purpose": "RDF version of expand-0025",
+      "input": "toRdf-0065-in.jsonld",
+      "expect": "toRdf-0065-out.nq"
+    }, {
+      "@id": "#t0066",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expanding term mapping to @type uses @type syntax",
+      "purpose": "RDF version of expand-0026",
+      "input": "toRdf-0066-in.jsonld",
+      "expect": "toRdf-0066-out.nq"
+    }, {
+      "@id": "#t0067",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Keep duplicate values in @list and @set",
+      "purpose": "RDF version of expand-0027",
+      "input": "toRdf-0067-in.jsonld",
+      "expect": "toRdf-0067-out.nq"
+    }, {
+      "@id": "#t0068",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Use @vocab in properties and @type but not in @id",
+      "purpose": "RDF version of expand-0028",
+      "input": "toRdf-0068-in.jsonld",
+      "expect": "toRdf-0068-out.nq"
+    }, {
+      "@id": "#t0069",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Relative IRIs",
+      "purpose": "RDF version of expand-0029",
+      "input": "toRdf-0069-in.jsonld",
+      "expect": "toRdf-0069-out.nq"
+    }, {
+      "@id": "#t0070",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Language maps",
+      "purpose": "RDF version of expand-0030",
+      "input": "toRdf-0070-in.jsonld",
+      "expect": "toRdf-0070-out.nq"
+    }, {
+      "@id": "#t0071",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "type-coercion of native types",
+      "purpose": "RDF version of expand-0031",
+      "input": "toRdf-0071-in.jsonld",
+      "expect": "toRdf-0071-out.nq"
+    }, {
+      "@id": "#t0072",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Mapping a term to null decouples it from @vocab",
+      "purpose": "RDF version of expand-0032",
+      "input": "toRdf-0072-in.jsonld",
+      "expect": "toRdf-0072-out.nq"
+    }, {
+      "@id": "#t0073",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Using @vocab with with type-coercion",
+      "purpose": "RDF version of expand-0033",
+      "input": "toRdf-0073-in.jsonld",
+      "expect": "toRdf-0073-out.nq"
+    }, {
+      "@id": "#t0074",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Multiple properties expanding to the same IRI",
+      "purpose": "RDF version of expand-0034",
+      "input": "toRdf-0074-in.jsonld",
+      "expect": "toRdf-0074-out.nq"
+    }, {
+      "@id": "#t0075",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Language maps with @vocab, default language, and colliding property",
+      "purpose": "RDF version of expand-0035",
+      "input": "toRdf-0075-in.jsonld",
+      "expect": "toRdf-0075-out.nq"
+    }, {
+      "@id": "#t0076",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expanding @index",
+      "purpose": "RDF version of expand-0036",
+      "input": "toRdf-0076-in.jsonld",
+      "expect": "toRdf-0076-out.nq"
+    }, {
+      "@id": "#t0077",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expanding @reverse",
+      "purpose": "RDF version of expand-0037",
+      "input": "toRdf-0077-in.jsonld",
+      "expect": "toRdf-0077-out.nq"
+    }, {
+      "@id": "#t0078",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Drop blank node predicates by default",
+      "purpose": "Triples with blank node predicates are dropped by default.",
+      "input": "toRdf-0078-in.jsonld",
+      "expect": "toRdf-0078-out.nq"
+    }, {
+      "@id": "#t0079",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Using terms in a reverse-maps",
+      "purpose": "RDF version of expand-0039",
+      "input": "toRdf-0079-in.jsonld",
+      "expect": "toRdf-0079-out.nq"
+    }, {
+      "@id": "#t0080",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "language and index expansion on non-objects",
+      "purpose": "RDF version of expand-0040",
+      "input": "toRdf-0080-in.jsonld",
+      "expect": "toRdf-0080-out.nq"
+    }, {
+      "@id": "#t0081",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Reset the default language",
+      "purpose": "RDF version of expand-0041",
+      "input": "toRdf-0081-in.jsonld",
+      "expect": "toRdf-0081-out.nq"
+    }, {
+      "@id": "#t0082",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expanding reverse properties",
+      "purpose": "RDF version of expand-0042",
+      "input": "toRdf-0082-in.jsonld",
+      "expect": "toRdf-0082-out.nq"
+    }, {
+      "@id": "#t0083",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Using reverse properties inside a @reverse-container",
+      "purpose": "RDF version of expand-0043",
+      "input": "toRdf-0083-in.jsonld",
+      "expect": "toRdf-0083-out.nq"
+    }, {
+      "@id": "#t0084",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Ensure index maps use language mapping",
+      "purpose": "RDF version of expand-0044",
+      "input": "toRdf-0084-in.jsonld",
+      "expect": "toRdf-0084-out.nq"
+    }, {
+      "@id": "#t0085",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Top-level value objects are removed",
+      "purpose": "RDF version of expand-0045",
+      "input": "toRdf-0085-in.jsonld",
+      "expect": "toRdf-0085-out.nq"
+    }, {
+      "@id": "#t0086",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Free-floating nodes are removed",
+      "purpose": "RDF version of expand-0046",
+      "input": "toRdf-0086-in.jsonld",
+      "expect": "toRdf-0086-out.nq"
+    }, {
+      "@id": "#t0087",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Remove free-floating set values and lists",
+      "purpose": "RDF version of expand-0047",
+      "input": "toRdf-0087-in.jsonld",
+      "expect": "toRdf-0087-out.nq"
+    }, {
+      "@id": "#t0088",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Terms are ignored in @id",
+      "purpose": "RDF version of expand-0048",
+      "input": "toRdf-0088-in.jsonld",
+      "expect": "toRdf-0088-out.nq"
+    }, {
+      "@id": "#t0089",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Using strings as value of a reverse property",
+      "purpose": "RDF version of expand-0049",
+      "input": "toRdf-0089-in.jsonld",
+      "expect": "toRdf-0089-out.nq"
+    }, {
+      "@id": "#t0090",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Term definitions with prefix separate from prefix definitions",
+      "purpose": "RDF version of expand-0050",
+      "input": "toRdf-0090-in.jsonld",
+      "expect": "toRdf-0090-out.nq"
+    }, {
+      "@id": "#t0091",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expansion of keyword aliases in term definitions",
+      "purpose": "RDF version of expand-0051",
+      "input": "toRdf-0091-in.jsonld",
+      "expect": "toRdf-0091-out.nq"
+    }, {
+      "@id": "#t0092",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "@vocab-relative IRIs in term definitions",
+      "purpose": "RDF version of expand-0052",
+      "input": "toRdf-0092-in.jsonld",
+      "expect": "toRdf-0092-out.nq"
+    }, {
+      "@id": "#t0093",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand absolute IRI with @type: @vocab",
+      "purpose": "RDF version of expand-0053",
+      "input": "toRdf-0093-in.jsonld",
+      "expect": "toRdf-0093-out.nq"
+    }, {
+      "@id": "#t0094",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand term with @type: @vocab",
+      "purpose": "RDF version of expand-0054",
+      "input": "toRdf-0094-in.jsonld",
+      "expect": "toRdf-0094-out.nq"
+    }, {
+      "@id": "#t0095",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand @vocab-relative term with @type: @vocab",
+      "purpose": "RDF version of expand-0055",
+      "input": "toRdf-0095-in.jsonld",
+      "expect": "toRdf-0095-out.nq"
+    }, {
+      "@id": "#t0096",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Use terms with @type: @vocab but not with @type: @id",
+      "purpose": "RDF version of expand-0056",
+      "input": "toRdf-0096-in.jsonld",
+      "expect": "toRdf-0096-out.nq"
+    }, {
+      "@id": "#t0097",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand relative IRI with @type: @vocab",
+      "purpose": "RDF version of expand-0057",
+      "input": "toRdf-0097-in.jsonld",
+      "expect": "toRdf-0097-out.nq"
+    }, {
+      "@id": "#t0098",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand compact IRI with @type: @vocab",
+      "purpose": "RDF version of expand-0058",
+      "input": "toRdf-0098-in.jsonld",
+      "expect": "toRdf-0098-out.nq"
+    }, {
+      "@id": "#t0099",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Reset @vocab by setting it to null",
+      "purpose": "RDF version of expand-0059",
+      "input": "toRdf-0099-in.jsonld",
+      "expect": "toRdf-0099-out.nq"
+    }, {
+      "@id": "#t0100",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Overwrite document base with @base and reset it again",
+      "purpose": "RDF version of expand-0060",
+      "input": "toRdf-0100-in.jsonld",
+      "expect": "toRdf-0100-out.nq"
+    }, {
+      "@id": "#t0101",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Coercing native types to arbitrary datatypes",
+      "purpose": "RDF version of expand-0061",
+      "input": "toRdf-0101-in.jsonld",
+      "expect": "toRdf-0101-out.nq"
+    }, {
+      "@id": "#t0102",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Various relative IRIs with with @base",
+      "purpose": "RDF version of expand-0062",
+      "input": "toRdf-0102-in.jsonld",
+      "expect": "toRdf-0102-out.nq"
+    }, {
+      "@id": "#t0103",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand a reverse property with an index-container",
+      "purpose": "RDF version of expand-0063",
+      "input": "toRdf-0103-in.jsonld",
+      "expect": "toRdf-0103-out.nq"
+    }, {
+      "@id": "#t0104",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Expand reverse property whose values are unlabeled blank nodes",
+      "purpose": "RDF version of expand-0064",
+      "input": "toRdf-0104-in.jsonld",
+      "expect": "toRdf-0104-out.nq"
+    }, {
+      "@id": "#t0105",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Keys that are not mapped to an IRI in a reverse-map are dropped",
+      "purpose": "RDF version of expand-0065",
+      "input": "toRdf-0105-in.jsonld",
+      "expect": "toRdf-0105-out.nq"
+    }, {
+      "@id": "#t0106",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Use @vocab to expand keys in reverse-maps",
+      "purpose": "RDF version of expand-0066",
+      "input": "toRdf-0106-in.jsonld",
+      "expect": "toRdf-0106-out.nq"
+    }, {
+      "@id": "#t0107",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "prefix:://sufffix not a compact IRI",
+      "purpose": "RDF version of expand-0067",
+      "input": "toRdf-0107-in.jsonld",
+      "expect": "toRdf-0107-out.nq"
+    }, {
+      "@id": "#t0108",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "_::sufffix not a compact IRI",
+      "purpose": "RDF version of expand-0068",
+      "input": "toRdf-0108-in.jsonld",
+      "expect": "toRdf-0108-out.nq"
+    }, {
+      "@id": "#t0109",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Compact IRI as term with type mapping",
+      "purpose": "RDF version of expand-0069",
+      "input": "toRdf-0109-in.jsonld",
+      "expect": "toRdf-0109-out.nq"
+    }, {
+      "@id": "#t0110",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Redefine compact IRI with itself",
+      "purpose": "RDF version of expand-0070",
+      "input": "toRdf-0110-in.jsonld",
+      "expect": "toRdf-0110-out.nq"
+    }, {
+      "@id": "#t0111",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Redefine terms looking like compact IRIs",
+      "purpose": "RDF version of expand-0071",
+      "input": "toRdf-0111-in.jsonld",
+      "expect": "toRdf-0111-out.nq"
+    }, {
+      "@id": "#t0112",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Redefine term using @vocab, not itself",
+      "purpose": "RDF version of expand-0072",
+      "input": "toRdf-0112-in.jsonld",
+      "expect": "toRdf-0112-out.nq"
+    }, {
+      "@id": "#t0113",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Dataset with a IRI named graph",
+      "purpose": "Basic use of creating a named graph using an IRI name",
+      "input": "toRdf-0113-in.jsonld",
+      "expect": "toRdf-0113-out.nq"
+    }, {
+      "@id": "#t0114",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Dataset with a IRI named graph",
+      "purpose": "Basic use of creating a named graph using a BNode name",
+      "input": "toRdf-0114-in.jsonld",
+      "expect": "toRdf-0114-out.nq"
+    }, {
+      "@id": "#t0115",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Dataset with a default and two named graphs",
+      "purpose": "Dataset with a default and two named graphs (IRI and BNode)",
+      "input": "toRdf-0115-in.jsonld",
+      "expect": "toRdf-0115-out.nq"
+    }, {
+      "@id": "#t0116",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Dataset from node with embedded named graph",
+      "purpose": "Embedding @graph in a node creates a named graph",
+      "input": "toRdf-0116-in.jsonld",
+      "expect": "toRdf-0116-out.nq"
+    }, {
+      "@id": "#t0117",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Dataset from node with embedded named graph (bnode)",
+      "purpose": "Embedding @graph in a node creates a named graph. Graph name is created if there is no subject",
+      "input": "toRdf-0117-in.jsonld",
+      "expect": "toRdf-0117-out.nq"
+    }, {
+      "@id": "#t0118",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "produce generalized RDF flag",
+      "purpose": "Triples with blank node predicates are not dropped if the produce generalized RDF flag is true.",
+      "option": {
+        "produceGeneralizedRdf": true
+      },
+      "input": "toRdf-0118-in.jsonld",
+      "expect": "toRdf-0118-out.nq"
+    }, {
+      "@id": "#t0119",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
+      "name": "Blank nodes with reverse properties",
+      "purpose": "Proper (re-)labeling of blank nodes if used with reverse properties.",
+      "input": "toRdf-0119-in.jsonld",
+      "expect": "toRdf-0119-out.nq"
+    }
+  ]
+}
diff --git a/test/test-suite/vocab.jsonld b/test/test-suite/vocab.jsonld
new file mode 100644
index 0000000..4cf6e15
--- /dev/null
+++ b/test/test-suite/vocab.jsonld
@@ -0,0 +1,231 @@
+{
+  "@context": {
+    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
+    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    "dc": "http://purl.org/dc/elements/1.1/",
+    "mf": "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "jld": "http://json-ld.org/test-suite/vocab#",
+    "jld:Test": {
+      "@type": "@id"
+    },
+    "dc:identifier": {
+      "@type": "@id"
+    },
+    "rdfs:subClassOf": {
+      "@type": "@id"
+    },
+    "rdfs:domain": {
+      "@type": "@id"
+    },
+    "rdfs:range": {
+      "@type": "@id"
+    }
+  },
+  "@graph": [
+    {
+      "@id": "http://json-ld.org/test-suite/vocab#",
+      "dc:creator": "Gregg Kellogg",
+      "dc:date": "2013-09-23",
+      "dc:description": "Test case manifest vocabulary extensions",
+      "dc:identifier": "http://json-ld.org/test-suite/vocab#",
+      "dc:publisher": "W3C Linked JSON Community Group",
+      "dc:title": "Test case manifest vocabulary extensions",
+      "rdfs:comment": "Manifest vocabulary for JSON-LD test cases"
+    },
+    {
+      "@id": "jld:CompactTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `CompactTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [compact](http://json-ld.org/spec/latest/json-ld-api/index.html#widl-JsonLdProcessor-compact-Promise-any-input-JsonLdContext-context-JsonLdOptions-options) method with the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing a JSON-LD file in expanded form, context from `:input` (a [...]
+      "rdfs:label": "Compact Evaluation Test"
+    },
+    {
+      "@id": "jld:ExpandTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `ExpandTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [expand](http://json-ld.org/spec/latest/json-ld-api/index.html#widl-JsonLdProcessor-expand-Promise-any-input-JsonLdOptions-options) method with the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing a JSON-LD file, and optional options from `:option`. The expected results for a `P [...]
+      "rdfs:label": "Expand Evaluation Test"
+    },
+    {
+      "@id": "jld:FlattenTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `FlattenTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [flatten](http://json-ld.org/spec/latest/json-ld-api/index.html#widl-JsonLdProcessor-flatten-Promise-any-input-JsonLdContext-context-JsonLdOptions-options) method with the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing a JSON-LD file, optional context from `:input` (aliased a [...]
+      "rdfs:label": "Flatten Evaluation Test"
+    },
+    {
+      "@id": "jld:FrameTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `FrameTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [frame](http://json-ld.org/spec/latest/json-ld-framing/#widl-JsonLdProcessor-frame-void-object-or-object---or-IRI-input-object-or-IRI-frame-JsonLdCallback-callback-JsonLdOptions-options) method with the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing a JSON-LD file, frame from ` [...]
+      "rdfs:label": "Frame Evaluation Test"
+    },
+    {
+      "@id": "jld:FromRDFTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `FromRDFTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [RDF to Object Conversion](http://json-ld.org/spec/latest/json-ld-api/index.html#rdf-to-object-conversion) algorithm with the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing an N-Quads file and optional options from `:option`. The expected results for a `PositiveEvaluationTest [...]
+      "rdfs:label": "From RDF Evaluation Test"
+    },
+    {
+      "@id": "jld:NegativeEvaluationTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A Negative Evaluation test is successful when the result of processing the input file specified as `mf:action` (aliased as \"input\" in test manifest) results in the error identified by the literal value of `mf:result` (aliased as \"expect\" in test manifest). The specifics of invoking test, including the interpretation of options (`:option`) and other input files are specified through another class.",
+      "rdfs:label": "Positive Evaluation Test",
+      "rdfs:subClassOf": "jld:Test"
+    },
+    {
+      "@id": "jld:NegativeSyntaxTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action. Negative syntax tests are tests of which the result should be a parser error.",
+      "rdfs:label": "Negative Syntax Test",
+      "rdfs:subClassOf": "jld:Test"
+    },
+    {
+      "@id": "jld:NormalizeTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `NormalizeTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [Normalization](http://json-ld.org/spec/latest/rdf-graph-normalization/#normalization-algorithm) algorithmwith the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing an JSON-LD file and optional options from `:option`. The expected results for a PositiveEvaluationTest are N-Qua [...]
+      "rdfs:label": "Normalization Evaluation Test"
+    },
+    {
+      "@id": "jld:Option",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "Options passed to the test runner to affect invocation of the appropriate API method.",
+      "rdfs:label": "Processor Options"
+    },
+    {
+      "@id": "jld:PositiveEvaluationTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A Positive Evaluation test is successful when the result of processing the input file specified as `mf:action` (aliased as \"input\" in test manifest) exactly matches the output file specified as `mf:result` (aliased as \"expect\" in test manifest) using the comparison defined in another class. The specifics of invoking test, including the interpretation of options (`:option`) and other input files are specified through another class.",
+      "rdfs:label": "Positive Evaluation Test",
+      "rdfs:subClassOf": "jld:Test"
+    },
+    {
+      "@id": "jld:PositiveSyntaxTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action.",
+      "rdfs:label": "Positive Syntax Test",
+      "rdfs:subClassOf": "jld:Test"
+    },
+    {
+      "@id": "jld:Test",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "All JSON-LD tests have an input file referenced using `mf:action` (aliased as \"input\" in test manifest). Positive and Negative Evaluation Tests also have a result file referenced using `mf:result` (aliased as \"expect\" in test manifest). Other tests may take different inputs and options as defined for each test class. Tests should be run with the processingMode option set to \"json-ld-1.0\", unless specified explicitly as a test option.",
+      "rdfs:label": "Superclass of all JSON-LD tests"
+    },
+    {
+      "@id": "jld:ToRDFTest",
+      "@type": "rdfs:Class",
+      "rdfs:comment": "A `ToRDFTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`. Tests are run using the [Deserialize JSON-LD to RDF algorithm](http://json-ld.org/spec/latest/json-ld-api/index.html#deserialize-json-ld-to-rdf-algorithm) with the input argument from `mf:action` (aliased as \"input\" in test manifest) referencing an JSON-LD file and optional options from `:option`. The expected results for a `PositiveEv [...]
+      "rdfs:label": "To RDF Evaluation Test"
+    },
+    {
+      "@id": "jld:base",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "base",
+      "rdfs:range": "rdfs:Resource"
+    },
+    {
+      "@id": "jld:compactArrays",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "If set to `true`, the JSON-LD processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "compact arrays",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:contentType",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The HTTP Content-Type used for the input file, in case it is a non-registered type.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "content type",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:expandContext",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "A context that is used to initialize the active context when expanding a document.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "expand context",
+      "rdfs:range": "rdfs:Resource"
+    },
+    {
+      "@id": "jld:httpLink",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "An HTTP Link header to be added to the result of requesting the input file.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "HTTP link",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:httpStatus",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The HTTP status code that must be returned when the input file is requested. This is typically used along with the `redirectTo` property.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "HTTP status",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:input",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "Secondary input file",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "input",
+      "rdfs:range": "rdfs:Resource"
+    },
+    {
+      "@id": "jld:option",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "Options affecting processing",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "option",
+      "rdfs:range": "jld:Option"
+    },
+    {
+      "@id": "jld:processingMode",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "If set to \"json-ld-1.0\", the JSON-LD processor must produce exactly the same results as the algorithms defined in this specification. If set to another value, the JSON-LD processor is allowed to extend or modify the algorithms defined in this specification to enable application-specific optimizations. The definition of such optimizations is beyond the scope of this specification and thus not defined. Consequently, different implementations may implement different [...]
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "processing mode",
+      "rdfs:range": "xsd:string"
+    },
+    {
+      "@id": "jld:produceGeneralizedRdf",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.",
+      "rdfs:domain": "jld:ToRDFTest",
+      "rdfs:label": "produce generalized RDF",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:redirectTo",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "redirect to",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:useDocumentLoader",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "Test runners must implement a callback method with a method signature as defined in [LoadDocumentCallback](http://json-ld.org/spec/latest/json-ld-api/index.html#idl-def-LoadDocumentCallback). Specifying this option requires the test runner to provide this callback to the appropriate API method using the `documentLoader` option.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "use document loader",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:useNativeTypes",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "If the _use native types_ flag is set to `true`, RDF literals with a datatype IRI that equal `xsd:integer` or `xsd:double` are converted to a JSON numbers and RDF literals with a datatype IRI that equals `xsd:boolean` are converted to `true` or `false` based on their lexical form.",
+      "rdfs:domain": "jld:FromRDFTest",
+      "rdfs:label": "use native types",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:useRdfType",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "If the _use rdf type_ flag is set to `true`, statements with an `rdf:type` predicate will not use `@type`, but will be transformed as a normal property.",
+      "rdfs:domain": "jld:FromRDFTest",
+      "rdfs:label": "use RDF types",
+      "rdfs:range": "xsd:boolean"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/test/test-suite/vocab_context.jsonld b/test/test-suite/vocab_context.jsonld
new file mode 100644
index 0000000..af0c5b3
--- /dev/null
+++ b/test/test-suite/vocab_context.jsonld
@@ -0,0 +1,15 @@
+{
+  "@context": {
+    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
+    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    "dc": "http://purl.org/dc/elements/1.1/",
+    "mf": "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "jld": "http://json-ld.org/test-suite/vocab#",
+    "jld:Test": {"@type": "@id"},
+    "dc:identifier": {"@type": "@id"},
+    "rdfs:subClassOf": {"@type": "@id"},
+    "rdfs:domain": {"@type": "@id"},
+    "rdfs:range": {"@type": "@id"}
+  }
+}
\ No newline at end of file
diff --git a/test/test_api.py b/test/test_api.py
new file mode 100644
index 0000000..f32f471
--- /dev/null
+++ b/test/test_api.py
@@ -0,0 +1,26 @@
+from rdflib.plugin import register, Parser, Serializer
+register('json-ld', Parser, 'rdflib_jsonld.parser', 'JsonLDParser')
+register('json-ld', Serializer, 'rdflib_jsonld.serializer', 'JsonLDSerializer')
+
+from rdflib import Graph, Literal, URIRef
+
+def test_parse():
+    test_json = '''
+    {
+        "@context": {
+            "dc": "http://purl.org/dc/terms/",
+            "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+            "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
+        },
+        "@id": "http://example.org/about",
+        "dc:title": {
+            "@language": "en",
+            "@value": "Someone's Homepage"
+        }
+    }
+    '''
+    g = Graph().parse(data=test_json, format='json-ld')
+    assert list(g) == [(
+        URIRef('http://example.org/about'),
+        URIRef('http://purl.org/dc/terms/title'),
+        Literal("Someone's Homepage", lang='en'))]
diff --git a/test/test_api.pyc b/test/test_api.pyc
new file mode 100644
index 0000000..6cc1060
Binary files /dev/null and b/test/test_api.pyc differ
diff --git a/test/test_compaction.py b/test/test_compaction.py
new file mode 100644
index 0000000..14a9c3e
--- /dev/null
+++ b/test/test_compaction.py
@@ -0,0 +1,196 @@
+# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
+import re
+import json
+import itertools
+from rdflib import Graph
+from rdflib.serializer import Serializer
+
+
+cases = []
+def case(*args): cases.append(args)
+
+
+case("""
+ at prefix dc: <http://purl.org/dc/terms/> .
+<http://example.org/>
+    dc:title "Homepage"@en .
+""",
+{
+    "@context": {"@vocab": "http://purl.org/dc/terms/", "@language": "en"},
+    "@id": "http://example.org/",
+    "title": "Homepage"
+}
+)
+
+
+case("""
+ at prefix dc: <http://purl.org/dc/terms/> .
+<http://example.org/>
+    dc:title "Homepage"@en, "Hemsida"@sv .
+""",
+{
+    "@context": {"@vocab": "http://purl.org/dc/terms/", "title": {"@container": "@language"}},
+    "@id": "http://example.org/",
+    "title": {"en": "Homepage", "sv": "Hemsida"}
+}
+)
+
+
+case("""
+ at prefix dc: <http://purl.org/dc/terms/> .
+<http://example.org/>
+    dc:title "Homepage"@en, "Hemsida"@sv .
+""",
+{
+    "@context": {
+        "@vocab": "http://purl.org/dc/terms/",
+        "@language": "sv",
+        "title_en": {"@id": "title", "@language": "en"}
+    },
+    "@id": "http://example.org/",
+    "title_en": "Homepage",
+    "title": "Hemsida"
+}
+)
+
+
+# .. Requires set values to be sorted to be predicatble
+#case("""
+#@prefix dc: <http://purl.org/dc/terms/> .
+#<http://example.org/>
+#    dc:title "Homepage"@en, "Home Page"@en, "Home Page"@en-GB, "Hemsida"@sv .
+#""",
+#{
+#    "@context": "-||-",
+#    "@id": "http://example.org/",
+#    "title_en": ["Homepage", "Home Page"],
+#    "title": [{"@language": "en-GB", "@value": "Home Page"}, "Hemsida"]
+#}
+#)
+
+
+case("""
+ at prefix dc: <http://purl.org/dc/terms/> .
+<http://example.org/easter_island>
+    dc:title "Påskön"@sv .
+""",
+{
+    "@context": {"@vocab": "http://purl.org/dc/terms/", "@language": "sv"},
+    "@id": "http://example.org/easter_island",
+    "title": "Påskön"
+}
+)
+
+
+case("""
+ at prefix : <http://example.org/ns#> .
+<http://example.org/> :has _:blank-1 .
+""",
+{
+    "@context": {"has": {"@type": "@id", "@id": "http://example.org/ns#has"}},
+    "@id": "http://example.org/",
+    "has": "_:blank-1"
+}
+)
+
+
+case("""
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix : <http://example.org/ns#> .
+:Something rdfs:subClassOf :Thing .
+""",
+{
+    "@context": {
+        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
+        "v": "http://example.org/ns#",
+        "rdfs:subClassOf": {"@container": "@set"}
+    },
+    "@id": "v:Something",
+    "rdfs:subClassOf": [{"@id": "v:Thing"}]
+}
+)
+
+
+case("""
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix : <http://example.org/ns#> .
+:Something rdfs:subClassOf :Thing .
+""",
+{
+    "@context": {
+        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
+        "v": "http://example.org/ns#",
+        "subClassOf": {"@id": "rdfs:subClassOf", "@type": "@id", "@container": "@set"}
+    },
+    "@id": "v:Something",
+    "subClassOf": ["v:Thing"]
+}
+)
+
+
+case("""
+ at prefix owl: <http://www.w3.org/2002/07/owl#> .
+ at prefix : <http://example.org/ns#> .
+:World owl:unionOf (:Everyhing :Nothing) .
+""",
+{
+    "@context": {
+        "owl": "http://www.w3.org/2002/07/owl#",
+        "v": "http://example.org/ns#"
+    },
+    "@id": "v:World",
+    "owl:unionOf": {"@list": [{"@id": "v:Everyhing"}, {"@id": "v:Nothing"}]}
+}
+)
+
+
+case("""
+ at prefix owl: <http://www.w3.org/2002/07/owl#> .
+ at prefix : <http://example.org/ns#> .
+:World owl:unionOf (:Everyhing :Nothing) .
+""",
+{
+    "@context": {
+        "owl": "http://www.w3.org/2002/07/owl#",
+        "v": "http://example.org/ns#",
+        "unionOf": {"@id": "owl:unionOf", "@container": "@list"}
+    },
+    "@id": "v:World",
+    "unionOf": [{"@id": "v:Everyhing"}, {"@id": "v:Nothing"}]
+}
+)
+
+
+case("""
+ at prefix owl: <http://www.w3.org/2002/07/owl#> .
+ at prefix : <http://example.org/ns#> .
+:World owl:unionOf (:Everyhing :Nothing) .
+""",
+{
+    "@context": {
+        "owl": "http://www.w3.org/2002/07/owl#",
+        "v": "http://example.org/ns#",
+        "unionOf": {"@id": "owl:unionOf", "@type": "@id", "@container": "@list"}
+    },
+    "@id": "v:World",
+    "unionOf": ["v:Everyhing", "v:Nothing"]
+}
+)
+
+
+json_kwargs = dict(indent=2, separators=(',', ': '), sort_keys=True, ensure_ascii=False)
+
+def run(data, expected):
+    context = expected['@context']
+    g = Graph().parse(data=data, format='turtle')
+    result = g.serialize(format='json-ld', context=context, **json_kwargs).decode('utf-8')
+    incr = itertools.count(1)
+    result = re.sub(r'"_:[^"]+"', lambda m: '"_:blank-%s"' % incr.next(), result)
+    expected = json.dumps(expected, **json_kwargs)
+    assert result == expected
+
+
+def test_cases():
+    for data, expected in cases:
+        yield run, data, expected
diff --git a/test/test_compaction.pyc b/test/test_compaction.pyc
new file mode 100644
index 0000000..4e84db0
Binary files /dev/null and b/test/test_compaction.pyc differ
diff --git a/test/test_context.rst b/test/test_context.rst
new file mode 100644
index 0000000..1ee2994
--- /dev/null
+++ b/test/test_context.rst
@@ -0,0 +1,116 @@
+
+Context Spec:
+
+    >>> from rdflib_jsonld.context import Context, Term
+
+    >>> ctx = Context()
+
+    >>> ctx.add_term(u'label', u'http://example.org/ns/label')
+    >>> term = ctx.terms.get(u'label')
+    >>> term.name
+    u'label'
+
+    >>> ctx.find_term(u'http://example.org/ns/label') is term
+    True
+
+Selecting term based on value characteristics:
+
+    >>> ctx.add_term(u'updated', u'http://example.org/ns/updated')
+    >>> ctx.add_term(u'updatedDate', u'http://example.org/ns/updated',
+    ...     coercion=u'http://www.w3.org/2001/XMLSchema#date')
+
+    >>> ctx.find_term(u'http://example.org/ns/updated').name
+    u'updated'
+    >>> ctx.find_term(u'http://example.org/ns/updated',
+    ...     coercion=u'http://www.w3.org/2001/XMLSchema#date').name
+    u'updatedDate'
+
+    >>> ctx.find_term(u'http://example.org/ns/title_sv', language=u'sv')
+    >>>
+
+    >>> ctx.find_term(u'http://example.org/ns/authorList', container=u'@set')
+    >>>
+
+    >>> ctx.find_term(u'http://example.org/ns/creator', reverse=True)
+    >>>
+
+Getting keyword values from nodes:
+
+    >>> ctx.get_id({u'@id': u'urn:x:1'})
+    u'urn:x:1'
+    >>> ctx.get_language({u'@language': u'en'})
+    u'en'
+
+Parsing a context expands prefixes:
+
+    >>> ctx = Context({
+    ...     u'@vocab': u'http://example.org/ns/',
+    ...     u'x': u'http://example.org/ns/',
+    ...     u'label': u'x:label',
+    ...     u'x:updated': {u'@type': u'x:date'}})
+    >>> term = ctx.terms.get(u'label')
+
+    >>> term.id
+    u'http://example.org/ns/label'
+
+    >>> term = ctx.terms.get(u'x:updated')
+    >>> term.id
+    u'http://example.org/ns/updated'
+    >>> term.type
+    u'http://example.org/ns/date'
+
+Expanding terms:
+
+    >>> ctx.expand(u'term')
+    u'http://example.org/ns/term'
+
+    >>> ctx.expand(u'x:term')
+    u'http://example.org/ns/term'
+
+Shrinking IRIs:
+
+    >>> ctx.shrink_iri(u'http://example.org/ns/term')
+    u'x:term'
+
+    >>> ctx.to_symbol(u'http://example.org/ns/term')
+    u'term'
+
+Resolving IRIs:
+
+    >>> ctx = Context({u'@base': u'http://example.org/path/leaf'})
+    >>> ctx.resolve(u'/')
+    u'http://example.org/'
+    >>> ctx.resolve(u'/trail')
+    u'http://example.org/trail'
+    >>> ctx.resolve(u'../')
+    u'http://example.org/'
+    >>> ctx.resolve(u'../../')
+    u'http://example.org/'
+
+Accessing keyword values by alias:
+
+    >>> ctx = Context({u'iri': u'@id', u'lang': u'@language'})
+    >>> ctx.get_id({u'iri': u'urn:x:1'})
+    u'urn:x:1'
+    >>> ctx.get_language({u'lang': u'en'})
+    u'en'
+
+Standard keywords still work:
+
+    >>> ctx.get_id({u'@id': u'urn:x:1'})
+    u'urn:x:1'
+
+Representing keywords by alias:
+
+    >>> ctx.id_key
+    u'iri'
+
+    >>> ctx.lang_key
+    u'lang'
+
+Creating a subcontext:
+
+    >>> ctx4 = ctx.subcontext({u'lang': u'@language'}) #doctest: +ELLIPSIS
+    >>> ctx4.get_language({u'lang': u'en'})
+    u'en'
+
diff --git a/test/test_testsuite.py b/test/test_testsuite.py
new file mode 100644
index 0000000..d8cc638
--- /dev/null
+++ b/test/test_testsuite.py
@@ -0,0 +1,251 @@
+from __future__ import with_statement
+from os import environ, chdir, path as p
+try:
+    import json
+    assert json
+except ImportError:
+    import simplejson as json
+from rdflib import ConjunctiveGraph, Graph, Literal, URIRef
+from rdflib.compare import isomorphic
+from rdflib.py3compat import PY3
+from rdflib_jsonld.parser import to_rdf
+from rdflib_jsonld.serializer import from_rdf
+from rdflib_jsonld.keys import CONTEXT, GRAPH
+
+
+# monkey-patch NTriplesParser to keep source bnode id:s ..
+from rdflib.plugins.parsers.ntriples import NTriplesParser, r_nodeid, bNode
+def _preserving_nodeid(self):
+    if not self.peek('_'):
+        return False
+    return bNode(self.eat(r_nodeid).group(1))
+NTriplesParser.nodeid = _preserving_nodeid
+# .. and accept bnodes everywhere
+_uriref = NTriplesParser.uriref
+def _uriref_or_nodeid(self):
+    return _uriref(self) or self.nodeid()
+NTriplesParser.uriref = _uriref_or_nodeid
+
+
+unsupported_tests = ("frame", "normalize")
+unsupported_tests += ("error", "remote",)
+unsupported_tests += ("flatten", "compact", "expand")
+
+known_bugs = (
+        # invalid nquads (bnode as predicate)
+        #"toRdf-0078-in", "toRdf-0108-in",
+        # TODO: Literal doesn't preserve representations
+        "fromRdf-0002-in", "toRdf-0035-in", "toRdf-0101-in",
+        "fromRdf-0008-in", # TODO: needs to disallow outer lists-of-lists
+        #"toRdf-0091-in", # TODO: multiple aliases version?
+        )
+
+import sys
+if sys.version_info[:2] < (2, 6):
+    # Fails on bug in older urlparse.urljoin; ignoring..
+    known_bugs += ('toRdf-0069-in','toRdf-0102-in')
+
+TC_BASE = "http://json-ld.org/test-suite/tests/"
+
+
+testsuite_dir = environ.get("JSONLD_TESTSUITE") or p.join(
+        p.abspath(p.dirname(__file__)), "test-suite")
+test_dir = p.join(testsuite_dir, "tests")
+
+
+def read_manifest(skiptests):
+    f = open(p.join(testsuite_dir, "manifest.jsonld"), 'r')
+    manifestdata = json.load(f)
+    f.close()
+    # context = manifestdata.get('context')
+    for m in manifestdata.get('sequence'):
+        if any(token in m for token in unsupported_tests):
+            continue
+        f = open(p.join(testsuite_dir, m), 'r')
+        md = json.load(f)
+        f.close()
+        for test in md.get('sequence'):
+            parts = test.get(u'input', '').split('.')[0].split('-')
+            category, testnum, direction = parts
+            if test.get(u'input', '').split('.')[0] in skiptests \
+                or category in skiptests:
+                pass
+            else:
+                inputpath = test.get(u'input')
+                expectedpath = test.get(u'expect')
+                context = test.get(u'context', False)
+                options = test.get(u'option') or {}
+                yield category, testnum, inputpath, expectedpath, context, options
+
+
+def test_suite(skip_known_bugs=True):
+    skiptests = unsupported_tests
+    if skip_known_bugs:
+        skiptests += known_bugs
+    chdir(test_dir)
+    for cat, num, inputpath, expectedpath, context, options in read_manifest(skiptests):
+        if inputpath.endswith(".jsonld"): # toRdf
+            if expectedpath.endswith(".jsonld"): # compact/expand/flatten
+                func = _test_json
+            else: # toRdf
+                func = _test_parser
+        else:  # fromRdf
+            func = _test_serializer
+        #func.description = "%s-%s-%s" % (group, case)
+        yield func, cat, num, inputpath, expectedpath, context, options
+
+
+def _test_json(cat, num, inputpath, expectedpath, context, options):
+    base = TC_BASE + inputpath
+    input_obj = _load_json(inputpath)
+    input_graph = ConjunctiveGraph()
+    to_rdf(input_obj, input_graph, base=base, context_data=context,
+            produce_generalized_rdf=True)
+    expected_json = _load_json(expectedpath)
+    use_native_types = True # CONTEXT in input_obj
+    result_json = from_rdf(input_graph, context, base=TC_BASE + inputpath,
+            use_native_types=options.get('useNativeTypes', use_native_types),
+            use_rdf_type=options.get('useRdfType', False))
+
+    def _prune_json(data):
+        if CONTEXT in data:
+            data.pop(CONTEXT)
+        if GRAPH in data:
+            data = data[GRAPH]
+        #def _remove_empty_sets(obj):
+        return data
+
+    expected_json = _prune_json(expected_json)
+    result_json = _prune_json(result_json)
+
+    _compare_json(expected_json, result_json)
+
+
+def _test_parser(cat, num, inputpath, expectedpath, context, options):
+    input_obj = _load_json(inputpath)
+    expected_graph = _load_nquads(expectedpath)
+    base = TC_BASE + inputpath
+    result_graph = ConjunctiveGraph()
+    to_rdf(input_obj, result_graph, base=base, context_data=context,
+            produce_generalized_rdf = options.get('produceGeneralizedRdf', False))
+    assert isomorphic(
+            result_graph, expected_graph), "Expected:\n%s\nGot:\n%s" % (
+            expected_graph.serialize(format='turtle'),
+            result_graph.serialize(format='turtle'))
+
+
+def _test_serializer(cat, num, inputpath, expectedpath, context, options):
+    input_graph = _load_nquads(inputpath)
+    expected_json = _load_json(expectedpath)
+    result_json = from_rdf(input_graph, context, base=TC_BASE + inputpath,
+            use_native_types=options.get('useNativeTypes', False),
+            use_rdf_type=options.get('useRdfType', False))
+    _compare_json(expected_json, result_json)
+
+
+def _load_nquads(source):
+    graph = ConjunctiveGraph()
+    with open(source) as f:
+        if PY3:
+            data = f.read()
+        else:
+            data = f.read().decode('utf-8')
+    graph.parse(data=data, format='nquads')
+    return graph
+
+
+def _load_json(source):
+    with open(source) as f:
+        return json.load(f)
+
+
+def _to_ordered(obj):
+    if isinstance(obj, list):
+        # NOTE: use type in key to handle mixed
+        # lists of e.g. bool, int, float.
+        return sorted((_to_ordered(lv) for lv in obj),
+                key=lambda x: (_ord_key(x), type(x).__name__))
+    if not isinstance(obj, dict):
+        return obj
+    return sorted((k, _to_ordered(v))
+            for k, v in obj.items())
+
+
+def _ord_key(x):
+    if isinstance(x, dict) and '@id' in x:
+        return x['@id']
+    else:
+        return x
+
+
+def _dump_json(obj):
+    return json.dumps(obj,
+            indent=4, separators=(',', ': '),
+            sort_keys=True, check_circular=True)
+
+
+def _compare_json(expected, result):
+    expected = json.loads(_dump_json(expected))
+    result = json.loads(_dump_json(result))
+    assert _to_ordered(expected) == _to_ordered(result), \
+            "Expected JSON:\n%s\nGot:\n%s" % (
+                    _dump_json(expected), _dump_json(result))
+
+if __name__ == '__main__':
+    import sys
+    from rdflib import *
+    from datetime import datetime
+
+    EARL = Namespace("http://www.w3.org/ns/earl#")
+    DC = Namespace("http://purl.org/dc/terms/")
+    FOAF = Namespace("http://xmlns.com/foaf/0.1/")
+    DOAP = Namespace("http://usefulinc.com/ns/doap#")
+
+    rdflib_jsonld_page = "https://github.com/RDFLib/rdflib-jsonld"
+    rdflib_jsonld = URIRef(rdflib_jsonld_page + "#it")
+
+    args = sys.argv[1:]
+    asserter = URIRef(args.pop(0)) if args else None
+    asserter_name = Literal(args.pop(0)) if args else None
+
+    graph = Graph()
+
+    graph.parse(data="""
+        @prefix earl: <{EARL}> .
+        @prefix dc: <{DC}> .
+        @prefix foaf: <{FOAF}> .
+        @prefix doap: <{DOAP}> .
+
+        <{rdflib_jsonld}> a doap:Project, earl:TestSubject, earl:Software ;
+            doap:homepage <{rdflib_jsonld_page}> ;
+            doap:name "RDFLib-JSONLD" ;
+            doap:programming-language "Python" ;
+            doap:title "RDFLib plugin for JSON-LD " .
+    """.format(**vars()), format='turtle')
+
+    if asserter_name:
+        graph.add((asserter, RDF.type, FOAF.Person))
+        graph.add((asserter, FOAF.name, asserter_name))
+        graph.add((rdflib_jsonld, DOAP.developer, asserter))
+
+    for args in test_suite(skip_known_bugs=False):
+        try:
+            args[0](*args[1:])
+            success = True
+        except AssertionError:
+            success = False
+        assertion = graph.resource(BNode())
+        assertion.add(RDF.type, EARL.Assertion)
+        assertion.add(EARL.mode, EARL.automatic)
+        if asserter:
+            assertion.add(EARL.assertedBy, asserter)
+        assertion.add(EARL.subject, rdflib_jsonld)
+        assertion.add(EARL.test, URIRef(
+            "http://json-ld.org/test-suite/tests/{1}-manifest.jsonld#t{2}".format(*args)))
+        result = graph.resource(BNode())
+        assertion.add(EARL.result, result)
+        result.add(RDF.type, EARL.TestResult)
+        result.add(DC.date, Literal(datetime.utcnow()))
+        result.add(EARL.outcome, EARL.passed if success else EARL.failed)
+
+    graph.serialize(sys.stdout, format='turtle')
diff --git a/test/test_testsuite.pyc b/test/test_testsuite.pyc
new file mode 100644
index 0000000..6fd3a9c
Binary files /dev/null and b/test/test_testsuite.pyc differ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-rdflib-jsonld.git



More information about the debian-med-commit mailing list