rdflib-jsonld-0.4.0/0000755000076500000000000000000012716145127014676 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/docs/0000755000076500000000000000000012716145127015626 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/docs/conf.py0000644000076500000000000001744712716144070017136 0ustar neuronwheel00000000000000#!/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 # " v 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 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} rdflib-jsonld-0.4.0/docs/index.rst0000644000076500000000000000373212716144070017470 0ustar neuronwheel00000000000000.. 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 `_ 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` rdflib-jsonld-0.4.0/docs/jsonld-parser.rst0000644000076500000000000000257612716144070021151 0ustar neuronwheel00000000000000.. _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. 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 >>> 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(%(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 rdflib-jsonld-0.4.0/docs/jsonld-serializer.rst0000644000076500000000000000245112716144070022016 0ustar neuronwheel00000000000000.. _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. Read in an RDFLib Graph and serialize it, specifying ``format='json-ld'``. .. code-block:: python >>> from rdflib import Graph, plugin >>> testrdf = ''' ... @prefix dc: . ... ... 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", "@value": "Someone's Homepage" } } Module contents --------------- .. currentmodule:: rdflib_jsonld.jsonld_serializer .. autoclass:: JsonLDSerializer :members: serialize .. autofunction:: to_tree rdflib-jsonld-0.4.0/docs/make.bat0000644000076500000000000001176612716144070017242 0ustar neuronwheel00000000000000@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 ^` where ^ 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 rdflib-jsonld-0.4.0/docs/Makefile0000644000076500000000000001272512716144070017271 0ustar neuronwheel00000000000000# 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 ' where 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." rdflib-jsonld-0.4.0/LICENSE.md0000644000076500000000000000320412716144070016275 0ustar neuronwheel00000000000000LICENSE AGREEMENT FOR RDFLIB-JSONLD ======================================================================== Copyright (c) 2012-2015, RDFLib Team All rights reserved. See http://github.com/RDFLib/rdflib-jsonld Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. rdflib-jsonld-0.4.0/MANIFEST.in0000644000076500000000000000013012716144070016422 0ustar neuronwheel00000000000000include *.md recursive-include rdflib_jsonld *.py include setup.* graft docs graft test rdflib-jsonld-0.4.0/PKG-INFO0000644000076500000000000000231712716145127015776 0ustar neuronwheel00000000000000Metadata-Version: 1.1 Name: rdflib-jsonld Version: 0.4.0 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 rdflib-jsonld-0.4.0/rdflib_jsonld/0000755000076500000000000000000012716145127017511 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/rdflib_jsonld/__init__.py0000644000076500000000000000003612716144070021615 0ustar neuronwheel00000000000000""" """ __version__ = "0.4.0" rdflib-jsonld-0.4.0/rdflib_jsonld/context.py0000644000076500000000000002330612716144070021547 0ustar neuronwheel00000000000000# -*- coding: utf-8 -*- """ Implementation of the JSON-LD Context structure. See: http://json-ld.org/ """ from collections import namedtuple from rdflib.namespace import RDF from .keys import (BASE, CONTAINER, CONTEXT, GRAPH, ID, INDEX, LANG, LIST, REV, SET, TYPE, VALUE, VOCAB) from . import errors from .util import source_to_json, urljoin, urlsplit, split_iri, norm_url 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) @property def base(self): return self._base @base.setter def base(self, base): if base: hash_index = base.find('#') if hash_index > -1: base = base[0:hash_index] self._base = self.resolve_iri(base) if ( hasattr(self, '_base') and base is not None) else base self._basedomain = '%s://%s' % urlsplit(base)[0:2] if base else None 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 self.isblank(iri): return iri return self.resolve_iri(iri) def resolve_iri(self, iri): return norm_url(self._base, iri) def isblank(self, ref): return ref.startswith('_:') 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)) elif self._base: if unicode(iri) == self._base: return "" elif iri.startswith(self._basedomain): return iri[len(self._basedomain):] 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 load(self, source, base=None): self.active = True sources = [] source = source if isinstance(source, list) else [source] self._prep_sources(base, source, sources) for source_url, source in sources: self._read_source(source, source_url) def _prep_sources(self, base, inputs, sources, referenced_contexts=None, in_source_url=None): referenced_contexts = referenced_contexts or set() for source in inputs: if isinstance(source, basestring): source_url = urljoin(base, source) if source_url in referenced_contexts: raise errors.RECURSIVE_CONTEXT_INCLUSION referenced_contexts.add(source_url) source = source_to_json(source_url) if CONTEXT not in source: raise errors.INVALID_REMOTE_CONTEXT else: source_url = in_source_url if isinstance(source, dict): if CONTEXT in source: source = source[CONTEXT] source = source if isinstance(source, list) else [source] if isinstance(source, list): self._prep_sources(base, source, sources, referenced_contexts, source_url) else: sources.append((source_url, source)) def _read_source(self, source, source_url=None): 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: if source_url: continue 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 Term = namedtuple('Term', 'id, name, type, container, language, reverse') Term.__new__.__defaults__ = (UNDEF, UNDEF, UNDEF, False) rdflib-jsonld-0.4.0/rdflib_jsonld/errors.py0000644000076500000000000000041012716144070021366 0ustar neuronwheel00000000000000class JSONLDException(ValueError): pass # http://www.w3.org/TR/json-ld-api/#idl-def-JsonLdErrorCode.{code-message} RECURSIVE_CONTEXT_INCLUSION = JSONLDException("recursive context inclusion") INVALID_REMOTE_CONTEXT = JSONLDException("invalid remote context") rdflib-jsonld-0.4.0/rdflib_jsonld/keys.py0000644000076500000000000000035012716144070021030 0ustar neuronwheel00000000000000BASE = 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' rdflib-jsonld-0.4.0/rdflib_jsonld/parser.py0000644000076500000000000002541412716144070021361 0ustar neuronwheel00000000000000# -*- 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) ALLOW_LISTS_OF_LISTS = True # NOTE: Not allowed in JSON-LD 1.0 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) def to_rdf(data, graph, base=None, context_data=None, produce_generalized_rdf=False, allow_lists_of_lists=None): # TODO: docstring w. args and return value context=Context(base=base) if context_data: context.load(context_data) parser = Parser(generalized_rdf=produce_generalized_rdf, allow_lists_of_lists=allow_lists_of_lists) return parser.parse(data, context, graph) class Parser(object): def __init__(self, generalized_rdf=False, allow_lists_of_lists=None): self.generalized_rdf = generalized_rdf self.allow_lists_of_lists = (allow_lists_of_lists if allow_lists_of_lists is not None else ALLOW_LISTS_OF_LISTS) def parse(self, data, context, graph): topcontext = False if isinstance(data, list): resources = data elif isinstance(data, dict): l_ctx = data.get(CONTEXT) if l_ctx: context.load(l_ctx, context.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: self._add_to_graph(graph, graph, context, node, topcontext) return graph def _add_to_graph(self, 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 = self._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(): self._key_to_graph(dataset, graph, context, subj, rkey, robj, True) else: self._key_to_graph(dataset, graph, context, subj, key, obj) return subj def _key_to_graph(self, 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: self._add_to_graph(dataset, subgraph, context, onode) return elif SET in (key, term_id): for onode in obj_nodes: self._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 = self._get_bnodeid(pred_uri) if bid: if not self.generalized_rdf: return pred = BNode(bid) else: pred = URIRef(pred_uri) for obj_node in obj_nodes: obj = self._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(self, 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 and not self.allow_lists_of_lists: return listref = self._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 self._add_to_graph(dataset, graph, context, node) def _to_rdf_id(self, context, id_val): bid = self._get_bnodeid(id_val) if bid: return BNode(bid) else: uri = context.resolve(id_val) if not self.generalized_rdf and ':' not in uri: return None return URIRef(uri) def _get_bnodeid(self, ref): if not ref.startswith('_:'): return bid = ref.split('_:', 1)[-1] return bid or None def _add_list(self, 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 = self._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 rdflib-jsonld-0.4.0/rdflib_jsonld/serializer.py0000644000076500000000000002767112716144070022245 0ustar neuronwheel00000000000000# -*- 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: . ... ... 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) rdflib-jsonld-0.4.0/rdflib_jsonld/util.py0000644000076500000000000000453012716144070021036 0ustar neuronwheel00000000000000try: import json assert json # workaround for pyflakes issue #13 except ImportError: import simplejson as json from rdflib.py3compat import PY3, format_doctest_out 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 @format_doctest_out def norm_url(base, url): """ >>> norm_url('http://example.org/', '/one') 'http://example.org/one' >>> norm_url('http://example.org/', '/one#') 'http://example.org/one#' >>> norm_url('http://example.org/one', 'two') 'http://example.org/two' >>> norm_url('http://example.org/one/', 'two') 'http://example.org/one/two' >>> norm_url('http://example.org/', 'http://example.net/one') 'http://example.net/one' """ parts = urlsplit(urljoin(base, 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]) rdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/0000755000076500000000000000000012716145127021203 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/dependency_links.txt0000644000076500000000000000000112716145127025251 0ustar neuronwheel00000000000000 rdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/entry_points.txt0000644000076500000000000000041012716145127024474 0ustar neuronwheel00000000000000[rdf.plugins.parser] application/ld+json = rdflib_jsonld.parser:JsonLDParser json-ld = rdflib_jsonld.parser:JsonLDParser [rdf.plugins.serializer] application/ld+json = rdflib_jsonld.serializer:JsonLDSerializer json-ld = rdflib_jsonld.serializer:JsonLDSerializer rdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/PKG-INFO0000644000076500000000000000231712716145127022303 0ustar neuronwheel00000000000000Metadata-Version: 1.1 Name: rdflib-jsonld Version: 0.4.0 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 rdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/requires.txt0000644000076500000000000000001412716145127023576 0ustar neuronwheel00000000000000rdflib>=4.2 rdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/SOURCES.txt0000644000076500000000000002737212716145127023102 0ustar neuronwheel00000000000000LICENSE.md 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/errors.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/README.md test/__init__.py test/test_api.py test/test_compaction.py test/test_context.py test/test_testsuite.py 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.jsonldrdflib-jsonld-0.4.0/rdflib_jsonld.egg-info/top_level.txt0000644000076500000000000000001612716145127023732 0ustar neuronwheel00000000000000rdflib_jsonld rdflib-jsonld-0.4.0/README.md0000644000076500000000000000425312716144070016155 0ustar neuronwheel00000000000000RDFLib 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 Installation ------------ The easiest way to install the RDFLib JSON-LD plugin is directly from PyPi using pip by running the command below: pip install rdflib-jsonld Otherwise you can download the source and install it directly by running: python setup.py install Using the plug-in JSONLD serializer/parser with RDFLib ------------------------------------------------------ The plugin parser and serializer are automatically registered if installed by setuptools. ```python >>> from rdflib import Graph, plugin >>> from rdflib.serializer import Serializer >>> testrdf = ''' ... @prefix dc: . ... ... 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) rdflib-jsonld-0.4.0/setup.cfg0000644000076500000000000000017312716145127016520 0ustar neuronwheel00000000000000[nosetests] attr = !known_issue verbosity = 1 with-doctest = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 rdflib-jsonld-0.4.0/setup.py0000644000076500000000000000717512716144070016416 0ustar neuronwheel00000000000000#!/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', 'application/ld+json = rdflib_jsonld.parser:JsonLDParser', ], 'rdf.plugins.serializer': [ 'json-ld = rdflib_jsonld.serializer:JsonLDSerializer', 'application/ld+json = 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) rdflib-jsonld-0.4.0/test/0000755000076500000000000000000012716145127015655 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/__init__.py0000644000076500000000000000062012716144070017760 0ustar neuronwheel00000000000000from 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 rdflib-jsonld-0.4.0/test/README.md0000644000076500000000000000121212716144070017124 0ustar neuronwheel00000000000000The `test-suite` directory is a partial *copy* of the official test suite available at . 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/ rdflib-jsonld-0.4.0/test/test-suite/0000755000076500000000000000000012716145127017763 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/context.jsonld0000644000076500000000000000252512716144070022662 0ustar neuronwheel00000000000000{ "@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"} } } rdflib-jsonld-0.4.0/test/test-suite/manifest.jsonld0000644000076500000000000000110012716144070022770 0ustar neuronwheel00000000000000{ "@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" ] } rdflib-jsonld-0.4.0/test/test-suite/README0000644000076500000000000000564612716144070020652 0ustar neuronwheel00000000000000Introduction ------------ 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@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@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. rdflib-jsonld-0.4.0/test/test-suite/tests/0000755000076500000000000000000012716145127021125 5ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0001-in.nq0000644000076500000000000000065612716144070024051 0ustar neuronwheel00000000000000 . . "Plain" . "2012-05-12"^^ . "English"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0001-out.jsonld0000644000076500000000000000054712716144070025124 0ustar neuronwheel00000000000000[ { "@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"} ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0002-in.nq0000644000076500000000000000102012716144070024034 0ustar neuronwheel00000000000000 "true"^^ . "false"^^ . "1"^^ . "1.1"^^ . "1.1E-1"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0002-out.jsonld0000644000076500000000000000113212716144070025114 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0003-in.nq0000644000076500000000000000100312716144070024036 0ustar neuronwheel00000000000000 . _:a . _:a . . . . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0003-out.jsonld0000644000076500000000000000065012716144070025121 0ustar neuronwheel00000000000000[ { "@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"}] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0004-in.nq0000644000076500000000000000147212716144070024051 0ustar neuronwheel00000000000000 . _:a "apple" . _:a _:b . _:b "bananna" . _:b . _:a . . _:c . _:c . _:c . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0004-out.jsonld0000644000076500000000000000060212716144070025117 0ustar neuronwheel00000000000000[ { "@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"}] }] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0005-in.nq0000644000076500000000000000152212716144070024046 0ustar neuronwheel00000000000000 . . _:a "a" . _:a _:b . _:b "b" . _:b . _:a . . "Graph" . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0005-out.jsonld0000644000076500000000000000073712716144070025131 0ustar neuronwheel00000000000000[ { "@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"}] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0006-in.nq0000644000076500000000000000254312716144070024053 0ustar neuronwheel00000000000000 . . _:a . _:a "a" . _:a _:b . _:b "b" . _:b . . . _:c . _:c "c" . _:c _:d . _:d "d" . _:d . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0006-out.jsonld0000644000076500000000000000137212716144070025126 0ustar neuronwheel00000000000000[ { "@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"} ] }] } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0007-in.nq0000644000076500000000000000145412716144070024054 0ustar neuronwheel00000000000000 . "http://gregkellogg.net/foaf#me" . . "http://www.statistik-berlin-brandenburg.de/" . "3499879"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0007-out.jsonld0000644000076500000000000000146512716144070025132 0ustar neuronwheel00000000000000[ { "@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" }] } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0008-in.nq0000644000076500000000000000334712716144070024060 0ustar neuronwheel00000000000000 _:outerlist . _:outerlist _:lista . _:outerlist _:b0 . _:lista "a1" . _:lista _:a2 . _:a2 "a2" . _:a2 _:a3 . _:a3 "a3" . _:a3 . _:c0 _:c1 . _:c0 . _:c1 "c1" . _:c1 _:c2 . _:c2 "c2" . _:c2 _:c3 . _:c3 "c3" . _:c3 . _:b0 _:b1 . _:b0 _:c0 . _:b1 "b1" . _:b1 _:b2 . _:b2 "b2" . _:b2 _:b3 . _:b3 "b3" . _:b3 . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0008-out.jsonld0000644000076500000000000000203212716144070025122 0ustar neuronwheel00000000000000[ { "@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" } ] } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0009-in.nq0000644000076500000000000000102312716144070024046 0ustar neuronwheel00000000000000 . "a" . _:b . _:b "b" . _:b _:c . _:c "c" . _:c . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0009-out.jsonld0000644000076500000000000000063412716144070025131 0ustar neuronwheel00000000000000[ { "@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" } ] } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0010-in.nq0000644000076500000000000000055012716144070024042 0ustar neuronwheel00000000000000 _:a . _:a "a" . _:a _:b . _:b "b" . _:b _:c . _:c "c" . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0010-out.jsonld0000644000076500000000000000107512716144070025121 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0011-in.nq0000644000076500000000000000110212716144070024035 0ustar neuronwheel00000000000000 _:a . _:a "a" . _:a _:b . _:b "b" . _:b "This list node has also properties other than rdf:first and rdf:rest" . _:b _:c . _:c "c" . _:c . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0011-out.jsonld0000644000076500000000000000123212716144070025115 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0012-in.nq0000644000076500000000000000064412716144070024050 0ustar neuronwheel00000000000000 _:a . _:a "a" . _:a _:b . _:b "b" . _:b _:c . _:c "c" . _:c _:b . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0012-out.jsonld0000644000076500000000000000121312716144070025115 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0013-in.nq0000644000076500000000000000102012716144070024036 0ustar neuronwheel00000000000000 _:a . _:a "a" . _:a _:b . _:b "b1" . _:b "b2" . _:b _:c . _:c "c" . _:c . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0013-out.jsonld0000644000076500000000000000111012716144070025112 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0014-in.nq0000644000076500000000000000126312716144070024050 0ustar neuronwheel00000000000000 _:a . _:a "a" . _:a _:b . _:b "b" . _:b _:c . _:b _:d . _:c "c" . _:c . _:d "d" . _:d . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0014-out.jsonld0000644000076500000000000000102712716144070025122 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0015-in.nq0000644000076500000000000000026212716144070024047 0ustar neuronwheel00000000000000 _:a . _:a "a" . _:a "b" . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0015-out.jsonld0000644000076500000000000000043612716144070025126 0ustar neuronwheel00000000000000[ { "@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" } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0016-in.nq0000644000076500000000000000160312716144070024050 0ustar neuronwheel00000000000000 _:b0 . _:b0 . _:b0 "A" . _:b0 _:b1 . _:b1 "B" . _:b1 _:b2 . _:b1 . _:b1 . _:b1 . _:b2 "C" . _:b2 . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0016-out.jsonld0000644000076500000000000000043212716144070025123 0ustar neuronwheel00000000000000[ { "@id": "http://example.com/", "http://example.com/list": [ { "@list": [ { "@value": "A" }, { "@value": "B" }, { "@value": "C" } ] } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0017-in.nq0000644000076500000000000000147612716144070024061 0ustar neuronwheel00000000000000 "1" . "1" . "2"^^ . "2"^^ . . . . . . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0017-out.jsonld0000644000076500000000000000046412716144070025131 0ustar neuronwheel00000000000000[ { "@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" ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0018-in.nq0000644000076500000000000000102012716144070024043 0ustar neuronwheel00000000000000 "true"^^ . "false"^^ . "1"^^ . "1.1"^^ . "1.1E-1"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0018-out.jsonld0000644000076500000000000000041612716144070025127 0ustar neuronwheel00000000000000[ { "@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 } ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0019-in.nq0000644000076500000000000000065612716144070024062 0ustar neuronwheel00000000000000 . . "Plain" . "2012-05-12"^^ . "English"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-0019-out.jsonld0000644000076500000000000000064612716144070025135 0ustar neuronwheel00000000000000[ { "@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"} ] } ] rdflib-jsonld-0.4.0/test/test-suite/tests/fromRdf-manifest.jsonld0000644000076500000000000001430412716144070025541 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0001-in.jsonld0000644000076500000000000000014312716144070024372 0ustar neuronwheel00000000000000{ "@id": "http://greggkellogg.net/foaf#me", "http://xmlns.com/foaf/0.1/name": "Gregg Kellogg" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0001-out.nq0000644000076500000000000000012512716144070023720 0ustar neuronwheel00000000000000 "Gregg Kellogg" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0002-in.jsonld0000644000076500000000000000020412716144070024371 0ustar neuronwheel00000000000000{ "@context": {"foaf": "http://xmlns.com/foaf/0.1/"}, "@id": "http://greggkellogg.net/foaf#me", "foaf:name": "Gregg Kellogg" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0002-out.nq0000644000076500000000000000012512716144070023721 0ustar neuronwheel00000000000000 "Gregg Kellogg" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0003-in.jsonld0000644000076500000000000000012212716144070024371 0ustar neuronwheel00000000000000{ "@context": {"foaf": "http://xmlns.com/foaf/0.1/"}, "@type": "foaf:Person" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0003-out.nq0000644000076500000000000000013412716144070023722 0ustar neuronwheel00000000000000_:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0004-in.jsonld0000644000076500000000000000020412716144070024373 0ustar neuronwheel00000000000000{ "http://www.w3.org/2000/01/rdf-schema#label": { "@value": "A plain literal with a lang tag.", "@language": "en-us" } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0004-out.nq0000644000076500000000000000013512716144070023724 0ustar neuronwheel00000000000000_:b0 "A plain literal with a lang tag."@en-us . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0005-in.jsonld0000644000076500000000000000025712716144070024404 0ustar neuronwheel00000000000000{ "@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"} } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0005-out.nq0000644000076500000000000000020512716144070023723 0ustar neuronwheel00000000000000 _:b0 . _:b0 "Herman Iván"@hu . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0006-in.jsonld0000644000076500000000000000025712716144070024405 0ustar neuronwheel00000000000000{ "@id": "http://greggkellogg.net/foaf#me", "http://purl.org/dc/terms/created": { "@value": "1957-02-27", "@type": "http://www.w3.org/2001/XMLSchema#date" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0006-out.nq0000644000076500000000000000017512716144070023732 0ustar neuronwheel00000000000000 "1957-02-27"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0007-in.jsonld0000644000076500000000000000013512716144070024401 0ustar neuronwheel00000000000000{ "@id": "http://greggkellogg.net/foaf#me", "@type": "http://xmlns.com/foaf/0.1/Person" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0007-out.nq0000644000076500000000000000017112716144070023727 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0008-in.jsonld0000644000076500000000000000011112716144070024374 0ustar neuronwheel00000000000000{ "@context": {"d": "http://example.com/default#"}, "d:foo": "bar" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0008-out.nq0000644000076500000000000000005612716144070023732 0ustar neuronwheel00000000000000_:b0 "bar" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0009-in.jsonld0000644000076500000000000000011212716144070024376 0ustar neuronwheel00000000000000{ "@context": {"foo": "http://example.com/default#"}, "foo:": "bar" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0009-out.nq0000644000076500000000000000005312716144070023730 0ustar neuronwheel00000000000000_:b0 "bar" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0010-in.jsonld0000644000076500000000000000030412716144070024371 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0010-out.nq0000644000076500000000000000026112716144070023721 0ustar neuronwheel00000000000000 . "Manu Sporny" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0011-in.jsonld0000644000076500000000000000024412716144070024375 0ustar neuronwheel00000000000000{ "@context": { "foaf": "http://xmlns.com/foaf/0.1/" }, "@id": "http://greggkellogg.net/foaf#me", "foaf:knows": { "foaf:name": "Dave Longley" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0011-out.nq0000644000076500000000000000020212716144070023715 0ustar neuronwheel00000000000000 _:b0 . _:b0 "Dave Longley" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0012-in.jsonld0000644000076500000000000000023512716144070024376 0ustar neuronwheel00000000000000{ "@context": { "foaf": "http://xmlns.com/foaf/0.1/" }, "@id": "http://greggkellogg.net/foaf#me", "foaf:knows": ["Manu Sporny", "Dave Longley"] }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0012-out.nq0000644000076500000000000000025112716144070023722 0ustar neuronwheel00000000000000 "Dave Longley" . "Manu Sporny" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0013-in.jsonld0000644000076500000000000000021412716144070024374 0ustar neuronwheel00000000000000{ "@context": { "foaf": "http://xmlns.com/foaf/0.1/" }, "@id": "http://greggkellogg.net/foaf#me", "foaf:knows": {"@list": []} } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0013-out.nq0000644000076500000000000000016712716144070023731 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0014-in.jsonld0000644000076500000000000000023112716144070024374 0ustar neuronwheel00000000000000{ "@context": { "foaf": "http://xmlns.com/foaf/0.1/" }, "@id": "http://greggkellogg.net/foaf#me", "foaf:knows": {"@list": ["Manu Sporny"]} } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0014-out.nq0000644000076500000000000000037512716144070023733 0ustar neuronwheel00000000000000 _:b0 . _:b0 "Manu Sporny" . _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0015-in.jsonld0000644000076500000000000000025112716144070024377 0ustar neuronwheel00000000000000{ "@context": { "foaf": "http://xmlns.com/foaf/0.1/" }, "@id": "http://greggkellogg.net/foaf#me", "foaf:knows": {"@list": ["Manu Sporny", "Dave Longley"]} } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0015-out.nq0000644000076500000000000000060412716144070023727 0ustar neuronwheel00000000000000 _:b0 . _:b0 "Manu Sporny" . _:b0 _:b1 . _:b1 "Dave Longley" . _:b1 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0016-in.jsonld0000644000076500000000000000011312716144070024375 0ustar neuronwheel00000000000000{ "@id": "", "@type": "http://www.w3.org/2000/01/rdf-schema#Resource" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0016-out.nq0000644000076500000000000000023712716144070023732 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0017-in.jsonld0000644000076500000000000000011612716144070024401 0ustar neuronwheel00000000000000{ "@id": "a/b", "@type": "http://www.w3.org/2000/01/rdf-schema#Resource" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0017-out.nq0000644000076500000000000000021612716144070023730 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0018-in.jsonld0000644000076500000000000000012012716144070024375 0ustar neuronwheel00000000000000{ "@id": "#frag", "@type": "http://www.w3.org/2000/01/rdf-schema#Resource" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0018-out.nq0000644000076500000000000000024412716144070023732 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0019-in.jsonld0000644000076500000000000000034312716144070024405 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0019-out.nq0000644000076500000000000000014312716144070023731 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0020-in.jsonld0000644000076500000000000000034112716144070024373 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0020-out.nq0000644000076500000000000000017512716144070023726 0ustar neuronwheel00000000000000 "1957-02-27"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0022-in.jsonld0000644000076500000000000000012112716144070024371 0ustar neuronwheel00000000000000{ "@context": { "measure": "http://example/measure#"}, "measure:cups": 5.3 } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0022-out.nq0000644000076500000000000000013012716144070023717 0ustar neuronwheel00000000000000_:b0 "5.3E0"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0023-in.jsonld0000644000076500000000000000011112716144070024371 0ustar neuronwheel00000000000000{ "@context": { "chem": "http://example/chem#"}, "chem:protons": 12 }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0023-out.nq0000644000076500000000000000012612716144070023725 0ustar neuronwheel00000000000000_:b0 "12"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0024-in.jsonld0000644000076500000000000000012012716144070024372 0ustar neuronwheel00000000000000{ "@context": { "sensor": "http://example/sensor#"}, "sensor:active": true }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0024-out.nq0000644000076500000000000000013112716144070023722 0ustar neuronwheel00000000000000_:b0 "true"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0025-in.jsonld0000644000076500000000000000025712716144070024406 0ustar neuronwheel00000000000000{ "@context": { "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@container": "@list"} }, "@id": "http://greggkellogg.net/foaf#me", "knows": ["Manu Sporny"] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0025-out.nq0000644000076500000000000000037512716144070023735 0ustar neuronwheel00000000000000 _:b0 . _:b0 "Manu Sporny" . _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0026-in.jsonld0000644000076500000000000000016012716144070024400 0ustar neuronwheel00000000000000{ "@context": {"rdfs": "http://www.w3.org/2000/01/rdf-schema#"}, "@type": ["rdfs:Resource", "rdfs:Class"] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0026-out.nq0000644000076500000000000000031712716144070023732 0ustar neuronwheel00000000000000_:b0 . _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0027-in.jsonld0000644000076500000000000000162612716144070024411 0ustar neuronwheel00000000000000{ "@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/" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0027-out.nq0000644000076500000000000000170612716144070023736 0ustar neuronwheel00000000000000 . . . . . . "7000000"^^ . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0028-in.jsonld0000644000076500000000000000120312716144070024401 0ustar neuronwheel00000000000000{ "@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!" } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0028-out.nq0000644000076500000000000000131312716144070023731 0ustar neuronwheel00000000000000 "Hello World!" . "2011-09-23T20:21:34Z"^^ . "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=" . . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0029-in.jsonld0000644000076500000000000000065312716144070024412 0ustar neuronwheel00000000000000{ "@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/" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0029-out.nq0000644000076500000000000000125712716144070023741 0ustar neuronwheel00000000000000 . "http://www.statistik-berlin-brandenburg.de/" . . "3499879"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0030-in.jsonld0000644000076500000000000000133312716144070024376 0ustar neuronwheel00000000000000{ "@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/" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0030-out.nq0000644000076500000000000000164312716144070023730 0ustar neuronwheel00000000000000 "2012-04-09"^^ . . "http://manu.sporny.org/i/public" . "Gregg Kellogg" . . "http://greggkellogg.net/foaf#me" . "Manu Sporny" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0031-in.jsonld0000644000076500000000000000050712716144070024401 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0031-out.nq0000644000076500000000000000045412716144070023730 0ustar neuronwheel00000000000000 . "A property" . "My vocabulary" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0032-in.jsonld0000644000076500000000000000053412716144070024402 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0032-out.nq0000644000076500000000000000040412716144070023724 0ustar neuronwheel00000000000000 . . "Node 2" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0033-in.jsonld0000644000076500000000000000055412716144070024405 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0033-out.nq0000644000076500000000000000040412716144070023725 0ustar neuronwheel00000000000000 . . "Node 2" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0034-in.jsonld0000644000076500000000000000053412716144070024404 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0034-out.nq0000644000076500000000000000040412716144070023726 0ustar neuronwheel00000000000000 . . "Node 2" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0035-in.jsonld0000644000076500000000000000047512716144070024411 0ustar neuronwheel00000000000000{ "@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 ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0035-out.nq0000644000076500000000000000053012716144070023727 0ustar neuronwheel00000000000000_:b0 "1.0E0"^^ . _:b0 "2.2E0"^^ . _:b0 "8"^^ . _:b0 "9.9E0"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0036-in.jsonld0000644000076500000000000000021712716144070024404 0ustar neuronwheel00000000000000{ "@id": "http://example.com/", "ex:prop1": { "@list": [ { "@id": "_:x1" }, { "@id": "_:x2" } ] }, "ex:prop2": { "@id": "_:x3" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0036-out.nq0000644000076500000000000000056612716144070023741 0ustar neuronwheel00000000000000 _:b3 . _:b2 . _:b3 _:b0 . _:b3 _:b4 . _:b4 _:b1 . _:b4 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0041-in.jsonld0000644000076500000000000000005212716144070024375 0ustar neuronwheel00000000000000{"@id": "http://example.org/test#example"}rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0041-out.nq0000644000076500000000000000000012716144070023714 0ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0042-in.jsonld0000644000076500000000000000075612716144070024411 0ustar neuronwheel00000000000000{ "@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] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0042-out.nq0000644000076500000000000000114612716144070023731 0ustar neuronwheel00000000000000 "v1" . "v2"^^ . "v3"@en . "4"^^ . "50"^^ . "51"^^ . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0043-in.jsonld0000644000076500000000000000030512716144070024400 0ustar neuronwheel00000000000000{ "@id": "http://example.org/id", "http://example.org/property": null, "regularJson": { "nonJsonLd": "property", "deep": [{ "foo": "bar" }, { "bar": "foo" }] } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0043-out.nq0000644000076500000000000000000012716144070023716 0ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0044-in.jsonld0000644000076500000000000000152512716144070024406 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0044-out.nq0000644000076500000000000000160512716144070023733 0ustar neuronwheel00000000000000 . _:b0 . "v1" . . . _:b1 . "one item" . _:b0 "one item" . _:b0 . _:b1 "one item" . _:b1 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0045-in.jsonld0000644000076500000000000000076712716144070024416 0ustar neuronwheel00000000000000{ "@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" } ] }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0045-out.nq0000644000076500000000000000111012716144070023723 0ustar neuronwheel00000000000000 . "Alice" . . "Bob" . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0046-in.jsonld0000644000076500000000000000102712716144070024405 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0046-out.nq0000644000076500000000000000062312716144070023734 0ustar neuronwheel00000000000000 . . . "foo" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0047-in.jsonld0000644000076500000000000000063412716144070024411 0ustar neuronwheel00000000000000{ "@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" } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0047-out.nq0000644000076500000000000000053412716144070023736 0ustar neuronwheel00000000000000 "2011-01-25T00:00:00Z"^^ . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0048-in.jsonld0000644000076500000000000000037312716144070024412 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0048-out.nq0000644000076500000000000000023212716144070023732 0ustar neuronwheel00000000000000 "only value" . "test"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0049-in.jsonld0000644000076500000000000000205112716144070024406 0ustar neuronwheel00000000000000{ "@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" } } ] }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0049-out.nq0000644000076500000000000000144412716144070023741 0ustar neuronwheel00000000000000 . "Writer" . "My Book" . "Fun" . "Chapter One" . . "Jane" . "John" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0050-in.jsonld0000644000076500000000000000040612716144070024400 0ustar neuronwheel00000000000000{ "@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 }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0050-out.nq0000644000076500000000000000033412716144070023726 0ustar neuronwheel00000000000000 "true"^^ . "123"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0051-in.jsonld0000644000076500000000000000050012716144070024374 0ustar neuronwheel00000000000000{ "@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" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0051-out.nq0000644000076500000000000000027012716144070023726 0ustar neuronwheel00000000000000 . "Title" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0052-in.jsonld0000644000076500000000000000163412716144070024406 0ustar neuronwheel00000000000000{ "@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" } } ] }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0052-out.nq0000644000076500000000000000144412716144070023733 0ustar neuronwheel00000000000000 . "Writer" . "My Book" . "Fun" . "Chapter One" . . "Jane" . "John" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0053-in.jsonld0000644000076500000000000000052712716144070024407 0ustar neuronwheel00000000000000[{ "@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] }]rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0053-out.nq0000644000076500000000000000114612716144070023733 0ustar neuronwheel00000000000000 "v1" . "v2"^^ . "v3"@en . "4"^^ . "50"^^ . "51"^^ . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0054-in.jsonld0000644000076500000000000000174312716144070024411 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0054-out.nq0000644000076500000000000000117612716144070023737 0ustar neuronwheel00000000000000 . . . . "foo" . "2012-03-31"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0055-in.jsonld0000644000076500000000000000120112716144070024377 0ustar neuronwheel00000000000000{ "@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" ] } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0055-out.nq0000644000076500000000000000063512716144070023737 0ustar neuronwheel00000000000000 . "be" . "collapsed" . "hello" . "this" . "will" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0056-in.jsonld0000644000076500000000000000202312716144070024403 0ustar neuronwheel00000000000000{ "@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 ] ] } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0056-out.nq0000644000076500000000000000131212716144070023731 0ustar neuronwheel00000000000000 _:b0 . . _:b1 . . "ok" . _:b1 "2"^^ . _:b1 _:b2 . _:b2 "hi" . _:b2 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0057-in.jsonld0000644000076500000000000000211412716144070024405 0ustar neuronwheel00000000000000{ "@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" } } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0057-out.nq0000644000076500000000000000144412716144070023740 0ustar neuronwheel00000000000000 . "Writer" . "My Book" . "Fun" . "Chapter One" . . "Jane" . "John" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0058-in.jsonld0000644000076500000000000000060312716144070024407 0ustar neuronwheel00000000000000{ "@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 ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0058-out.nq0000644000076500000000000000161612716144070023742 0ustar neuronwheel00000000000000 "2"^^ . "hallo"@de . "true"^^ . "3"^^ . "false"^^ . "no language" . "1"^^ . "hello"@en . "true"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0059-in.jsonld0000644000076500000000000000015712716144070024414 0ustar neuronwheel00000000000000{ "@context": { "myproperty": "http://example.com/myproperty" }, "myproperty": { "@value" : null } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0059-out.nq0000644000076500000000000000000012716144070023725 0ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0060-in.jsonld0000644000076500000000000000235012716144070024401 0ustar neuronwheel00000000000000{ "@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" } } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0060-out.nq0000644000076500000000000000172612716144070023735 0ustar neuronwheel00000000000000 . "Writer" . "My Book" . "Fun" _:b0 . "Chapter One" _:b0 . "More fun" _:b0 . "Chapter Two" _:b0 . _:b0 . "Jane" . "John" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0061-in.jsonld0000644000076500000000000000257212716144070024410 0ustar neuronwheel00000000000000{ "@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" } } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0061-out.nq0000644000076500000000000000223312716144070023730 0ustar neuronwheel00000000000000 _:b0 . "Writer" _:b0 . "My Book" _:b0 . "Fun" _:b1 . "Chapter One" _:b1 . "More fun" _:b1 . "Chapter Two" _:b1 . "Chapter Three" _:b1 . _:b1 _:b0 . "Jane" _:b0 . "John" _:b0 . _:b0 . _:b0 "My first graph" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0062-in.jsonld0000644000076500000000000000014312716144070024401 0ustar neuronwheel00000000000000{ "@context": { "term": "http://example.com/term", "@language": "en" }, "term": "v" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0062-out.nq0000644000076500000000000000005012716144070023724 0ustar neuronwheel00000000000000_:b0 "v"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0063-in.jsonld0000644000076500000000000000204712716144070024407 0ustar neuronwheel00000000000000{ "@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"]} } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0063-out.nq0000644000076500000000000000237412716144070023740 0ustar neuronwheel00000000000000_:b0 _:b1 . _:b0 "2012-04-12"^^ . _:b0 _:b2 . _:b0 "2012-04-12"^^ . _:b0 _:b3 . _:b0 . _:b0 _:b4 . _:b0 . _:b1 "2012-04-12"^^ . _:b1 . _:b2 "2012-04-12"^^ . _:b2 . _:b3 . _:b3 . _:b4 . _:b4 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0064-in.jsonld0000644000076500000000000000063112716144070024405 0ustar neuronwheel00000000000000{ "@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" }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0064-out.nq0000644000076500000000000000061412716144070023734 0ustar neuronwheel00000000000000 "Lyon Convention Centre, Lyon, France" . "Alice Talk" . . "Alice" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0065-in.jsonld0000644000076500000000000000034612716144070024411 0ustar neuronwheel00000000000000{ "@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", "_" ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0065-out.nq0000644000076500000000000000037712716144070023743 0ustar neuronwheel00000000000000_:b0 . _:b0 . _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0066-in.jsonld0000644000076500000000000000106212716144070024406 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0066-out.nq0000644000076500000000000000061012716144070023732 0ustar neuronwheel00000000000000 . . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0067-in.jsonld0000644000076500000000000000037712716144070024417 0ustar neuronwheel00000000000000{ "@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] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0067-out.nq0000644000076500000000000000206612716144070023742 0ustar neuronwheel00000000000000 _:b0 . "1"^^ . "2"^^ . "3"^^ . _:b0 "1"^^ . _:b0 _:b1 . _:b1 "2"^^ . _:b1 _:b2 . _:b2 "2"^^ . _:b2 _:b3 . _:b3 "3"^^ . _:b3 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0068-in.jsonld0000644000076500000000000000045012716144070024410 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0068-out.nq0000644000076500000000000000104612716144070023740 0ustar neuronwheel00000000000000 "2011-01-25T00:00:00Z"^^ . . . "2012-08-01T00:00:00Z"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0069-in.jsonld0000644000076500000000000000127312716144070024415 0ustar neuronwheel00000000000000{ "@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" ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0069-out.nq0000644000076500000000000000672412716144070023751 0ustar neuronwheel00000000000000 _:b0 . . . . . . . . . . . . _:b0 . _:b0 _:b1 . _:b1 . _:b1 _:b2 . _:b10 . _:b10 . _:b2 . _:b2 _:b3 . _:b3 . _:b3 _:b4 . _:b4 . _:b4 _:b5 . _:b5 . _:b5 _:b6 . _:b6 . _:b6 _:b7 . _:b7 . _:b7 _:b8 . _:b8 . _:b8 _:b9 . _:b9 . _:b9 _:b10 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0070-in.jsonld0000644000076500000000000000042012716144070024376 0ustar neuronwheel00000000000000{ "@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" ] } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0070-out.nq0000644000076500000000000000035712716144070023735 0ustar neuronwheel00000000000000 "Die Königin"@de . "Ihre Majestät"@de . "The Queen"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0071-in.jsonld0000644000076500000000000000054312716144070024405 0ustar neuronwheel00000000000000{ "@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 } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0071-out.nq0000644000076500000000000000056012716144070023732 0ustar neuronwheel00000000000000 "true"^^ . "1.2345E2"^^ . "1"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0072-in.jsonld0000644000076500000000000000036012716144070024403 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0072-out.nq0000644000076500000000000000013012716144070023724 0ustar neuronwheel00000000000000 "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0073-in.jsonld0000644000076500000000000000046012716144070024405 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0073-out.nq0000644000076500000000000000035312716144070023734 0ustar neuronwheel00000000000000_:b0 "2012-10-28"^^ . _:b0 . _:b0 "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0074-in.jsonld0000644000076500000000000000046112716144070024407 0ustar neuronwheel00000000000000{ "@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 } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0074-out.nq0000644000076500000000000000105412716144070023734 0ustar neuronwheel00000000000000 "2"^^ . "3"^^ . "5"^^ . "four" . "value 1" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0075-in.jsonld0000644000076500000000000000056412716144070024414 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0075-out.nq0000644000076500000000000000060412716144070023735 0ustar neuronwheel00000000000000 "Die Königin"@de . "Ihre Majestät"@de . "Il re"@it . "The Queen"@en . "The king"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0076-in.jsonld0000644000076500000000000000352712716144070024417 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0076-out.nq0000644000076500000000000000503212716144070023736 0ustar neuronwheel00000000000000 "1"^^ . "3"^^ . "false"^^ . "false"^^ . "language-tagged string A"@en . "language-tagged string C"@en . "simple string A" . "simple string B" . "simple string C" . "true"^^ . "true"^^ . "typed literal A"^^ . "typed literal C"^^ . . . . . "3"^^ . "false"^^ . "language-tagged string Prop"@en . "simple string no index" . "true"^^ . "typed literal Prop"^^ . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0077-in.jsonld0000644000076500000000000000044012716144070024407 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0077-out.nq0000644000076500000000000000042412716144070023737 0ustar neuronwheel00000000000000 . "Dave Longley" . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0078-in.jsonld0000644000076500000000000000107112716144070024411 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0078-out.nq0000644000076500000000000000007612716144070023743 0ustar neuronwheel00000000000000_:b0 _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0079-in.jsonld0000644000076500000000000000046612716144070024421 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0079-out.nq0000644000076500000000000000042412716144070023741 0ustar neuronwheel00000000000000 . "Dave Longley" . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0080-in.jsonld0000644000076500000000000000060212716144070024401 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0080-out.nq0000644000076500000000000000052012716144070023726 0ustar neuronwheel00000000000000 "No" . "indexes" . . "The Queen" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0081-in.jsonld0000644000076500000000000000043212716144070024403 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0081-out.nq0000644000076500000000000000024412716144070023732 0ustar neuronwheel00000000000000_:b0 _:b1 . _:b0 "this is English"@en . _:b1 "and this is a plain string" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0082-in.jsonld0000644000076500000000000000046212716144070024407 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0082-out.nq0000644000076500000000000000042412716144070023733 0ustar neuronwheel00000000000000 . "Dave Longley" . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0083-in.jsonld0000644000076500000000000000070512716144070024410 0ustar neuronwheel00000000000000{ "@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" } ] } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0083-out.nq0000644000076500000000000000072212716144070023735 0ustar neuronwheel00000000000000 "Dave Longley" . "Gregg Kellogg" . . . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0084-in.jsonld0000644000076500000000000000067012716144070024412 0ustar neuronwheel00000000000000{ "@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" ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0084-out.nq0000644000076500000000000000043512716144070023737 0ustar neuronwheel00000000000000 "einfacher String"@de . . "simple string"@en . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0085-in.jsonld0000644000076500000000000000005012716144070024403 0ustar neuronwheel00000000000000{ "@value": "free-floating value" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0085-out.nq0000644000076500000000000000000012716144070023724 0ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0086-in.jsonld0000644000076500000000000000065012716144070024412 0ustar neuronwheel00000000000000{ "@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 ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0086-out.nq0000644000076500000000000000000012716144070023725 0ustar neuronwheel00000000000000rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0087-in.jsonld0000644000076500000000000000161412716144070024414 0ustar neuronwheel00000000000000{ "@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" } ] } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0087-out.nq0000644000076500000000000000014212716144070023735 0ustar neuronwheel00000000000000 "nodes with properties are not removed" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0088-in.jsonld0000644000076500000000000000106712716144070024417 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0088-out.nq0000644000076500000000000000102712716144070023741 0ustar neuronwheel00000000000000 "@id supports the following values: relative, absolute, and compact IRIs" . "relative IRIs get resolved against the document's base IRI" . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0089-in.jsonld0000644000076500000000000000050612716144070024415 0ustar neuronwheel00000000000000{ "@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" ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0089-out.nq0000644000076500000000000000045212716144070023743 0ustar neuronwheel00000000000000 . . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0090-in.jsonld0000644000076500000000000000030112716144070024376 0ustar neuronwheel00000000000000{ "@context": { "issue": { "@id": "http://example.com/issue/", "@type": "@id" }, "issue:raisedBy": { "@container": "@set" } }, "issue": "/issue/1", "issue:raisedBy": "Markus" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0090-out.nq0000644000076500000000000000016412716144070023733 0ustar neuronwheel00000000000000_:b0 . _:b0 "Markus" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0091-in.jsonld0000644000076500000000000000017512716144070024410 0ustar neuronwheel00000000000000{ "@context": [ { "id": "@id" }, { "url": "id" } ], "url": "/issue/1", "http://example.com/property": "ok" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0091-out.nq0000644000076500000000000000010212716144070023724 0ustar neuronwheel00000000000000 "ok" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0092-in.jsonld0000644000076500000000000000032512716144070024406 0ustar neuronwheel00000000000000{ "@context": { "@vocab": "http://example.org/", "property": "vocabRelativeProperty" }, "property": "must expand to http://example.org/vocabRelativeProperty", "http://example.org/property": "ok" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0092-out.nq0000644000076500000000000000022612716144070023734 0ustar neuronwheel00000000000000_:b0 "ok" . _:b0 "must expand to http://example.org/vocabRelativeProperty" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0093-in.jsonld0000644000076500000000000000017712716144070024414 0ustar neuronwheel00000000000000{ "@context": { "term": {"@id": "http://example.org/term", "@type": "@vocab"} }, "term": "http://example.org/enum" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0093-out.nq0000644000076500000000000000007312716144070023735 0ustar neuronwheel00000000000000_:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0094-in.jsonld0000644000076500000000000000023412716144070024407 0ustar neuronwheel00000000000000{ "@context": { "term": {"@id": "http://example.org/term", "@type": "@vocab"}, "enum": {"@id": "http://example.org/enum"} }, "term": "enum" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0094-out.nq0000644000076500000000000000007312716144070023736 0ustar neuronwheel00000000000000_:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0095-in.jsonld0000644000076500000000000000022112716144070024404 0ustar neuronwheel00000000000000{ "@context": { "@vocab": "http://example.org/", "term": {"@id": "http://example.org/term", "@type": "@vocab"} }, "term": "enum" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0095-out.nq0000644000076500000000000000007312716144070023737 0ustar neuronwheel00000000000000_:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0096-in.jsonld0000644000076500000000000000074212716144070024415 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0096-out.nq0000644000076500000000000000046512716144070023745 0ustar neuronwheel00000000000000 . . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0097-in.jsonld0000644000076500000000000000021012716144070024404 0ustar neuronwheel00000000000000{ "@context": { "term": { "@id": "http://example.org/term", "@type": "@vocab" } }, "term": "not-a-term-thus-a-relative-IRI" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0097-out.nq0000644000076500000000000000014612716144070023742 0ustar neuronwheel00000000000000_:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0098-in.jsonld0000644000076500000000000000024212716144070024412 0ustar neuronwheel00000000000000{ "@context": { "term": { "@id": "http://example.org/term", "@type": "@vocab" }, "prefix": "http://example.com/vocab#" }, "term": "prefix:suffix" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0098-out.nq0000644000076500000000000000010312716144070023734 0ustar neuronwheel00000000000000_:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0099-in.jsonld0000644000076500000000000000055312716144070024420 0ustar neuronwheel00000000000000{ "@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" } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0099-out.nq0000644000076500000000000000112312716144070023740 0ustar neuronwheel00000000000000 . . "property expanded using @vocab" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0100-in.jsonld0000644000076500000000000000131612716144070024375 0ustar neuronwheel00000000000000{ "@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" } ] } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0100-out.nq0000644000076500000000000000113112716144070023716 0ustar neuronwheel00000000000000 . . . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0101-in.jsonld0000644000076500000000000000026012716144070024373 0ustar neuronwheel00000000000000{ "@context": { "property": { "@id": "http://example.com/property", "@type": "http://example.com/datatype" } }, "property": [ 1, true, false, 5.1 ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0101-out.nq0000644000076500000000000000045312716144070023725 0ustar neuronwheel00000000000000_:b0 "1"^^ . _:b0 "5.1E0"^^ . _:b0 "false"^^ . _:b0 "true"^^ . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0102-in.jsonld0000644000076500000000000000154012716144070024376 0ustar neuronwheel00000000000000{ "@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" ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0102-out.nq0000644000076500000000000000763012716144070023732 0ustar neuronwheel00000000000000 _:b0 . . . . . . . . . . . . _:b0 . _:b0 _:b1 . _:b1 . _:b1 _:b2 . _:b10 . _:b10 _:b11 . _:b11 . _:b11 _:b12 . _:b12 . _:b12 . _:b2 . _:b2 _:b3 . _:b3 . _:b3 _:b4 . _:b4 . _:b4 _:b5 . _:b5 . _:b5 _:b6 . _:b6 . _:b6 _:b7 . _:b7 . _:b7 _:b8 . _:b8 . _:b8 _:b9 . _:b9 . _:b9 _:b10 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0103-in.jsonld0000644000076500000000000000070612716144070024402 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0103-out.nq0000644000076500000000000000072212716144070023726 0ustar neuronwheel00000000000000 . "Dave Longley" . . "Gregg Kellogg" . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0104-in.jsonld0000644000076500000000000000047612716144070024407 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0104-out.nq0000644000076500000000000000054012716144070023725 0ustar neuronwheel00000000000000 "Markus Lanthaler" . _:b0 . _:b0 "Dave Longley" . _:b1 . _:b1 "Gregg Kellogg" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0105-in.jsonld0000644000076500000000000000070112716144070024377 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0105-out.nq0000644000076500000000000000042412716144070023727 0ustar neuronwheel00000000000000 . "Dave Longley" . "Markus Lanthaler" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0106-in.jsonld0000644000076500000000000000070012716144070024377 0ustar neuronwheel00000000000000{ "@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" } } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0106-out.nq0000644000076500000000000000100212716144070023721 0ustar neuronwheel00000000000000 . "Dave Longley" . "Markus Lanthaler" . . "Compact keys using @vocab" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0107-in.jsonld0000644000076500000000000000044012716144070024401 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0107-out.nq0000644000076500000000000000036412716144070023734 0ustar neuronwheel00000000000000 "all these IRIs remain unchanged because they are interpreted as absolute IRIs" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0108-in.jsonld0000644000076500000000000000040012716144070024376 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0108-out.nq0000644000076500000000000000007612716144070023735 0ustar neuronwheel00000000000000_:b1 _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0109-in.jsonld0000644000076500000000000000042512716144070024406 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0109-out.nq0000644000076500000000000000040112716144070023726 0ustar neuronwheel00000000000000 . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0110-in.jsonld0000644000076500000000000000030012716144070024366 0ustar neuronwheel00000000000000{ "@context": { "prefix": "http://www.example.org/vocab#", "prefix:foo": "prefix:foo" }, "@id": "http://example.com/vocab#id", "@type": "prefix:Class", "prefix:foo": "bar" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0110-out.nq0000644000076500000000000000030012716144070023714 0ustar neuronwheel00000000000000 "bar" . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0111-in.jsonld0000644000076500000000000000046112716144070024377 0ustar neuronwheel00000000000000{ "@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" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0111-out.nq0000644000076500000000000000016612716144070023727 0ustar neuronwheel00000000000000_:b0 "value of v:term" . _:b0 "value of v:termId" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0112-in.jsonld0000644000076500000000000000033512716144070024400 0ustar neuronwheel00000000000000{ "@context": [ { "v": "http://example.com/vocab#", "term": "v:somethingElse" }, { "@vocab": "http://example.com/anotherVocab#", "term": "term" } ], "term": "value of term" } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0112-out.nq0000644000076500000000000000007612716144070023730 0ustar neuronwheel00000000000000_:b0 "value of term" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0113-in.jsonld0000644000076500000000000000020512716144070024375 0ustar neuronwheel00000000000000{ "@id": "http://example/g", "@graph": { "@id": "http://example/s", "http://example/p": {"@id": "http://example/o"} } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0113-out.nq0000644000076500000000000000011612716144070023724 0ustar neuronwheel00000000000000 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0114-in.jsonld0000644000076500000000000000017012716144070024377 0ustar neuronwheel00000000000000{ "@id": "_:g", "@graph": { "@id": "http://example/s", "http://example/p": {"@id": "http://example/o"} } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0114-out.nq0000644000076500000000000000010012716144070023716 0ustar neuronwheel00000000000000 _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0115-in.jsonld0000644000076500000000000000062012716144070024400 0ustar neuronwheel00000000000000{ "@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"} } }] }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0115-out.nq0000644000076500000000000000032212716144070023725 0ustar neuronwheel00000000000000 . . _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0116-in.jsonld0000644000076500000000000000027612716144070024410 0ustar neuronwheel00000000000000{ "@id": "http://example/s0", "http://example/p0": {"@id": "http://example/o0"}, "@graph": { "@id": "http://example/s1", "http://example/p1": {"@id": "http://example/o1"} } }rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0116-out.nq0000644000076500000000000000022012716144070023723 0ustar neuronwheel00000000000000 . . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0117-in.jsonld0000644000076500000000000000024112716144070024401 0ustar neuronwheel00000000000000{ "http://example/p0": {"@id": "http://example/o0"}, "@graph": { "@id": "http://example/s1", "http://example/p1": {"@id": "http://example/o1"} } } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0117-out.nq0000644000076500000000000000016212716144070023731 0ustar neuronwheel00000000000000 _:b0 . _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0118-in.jsonld0000644000076500000000000000107112716144070024404 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0118-out.nq0000644000076500000000000000044412716144070023735 0ustar neuronwheel00000000000000_:term _:term . _:term _:term "plain value" . _:term _:term . _:term _:term _:term . _:term _:term _:Bx . _:term _:term _:Cx . _:term _:term _:b3 . _:Bx _:term "term" . _:Cx _:term "termId" . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0119-in.jsonld0000644000076500000000000000030312716144070024402 0ustar neuronwheel00000000000000{ "@context": { "foo": "http://example.org/foo", "bar": { "@reverse": "http://example.org/bar", "@type": "@id" } }, "foo": "Foo", "bar": [ "http://example.org/origin", "_:b0" ] } rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-0119-out.nq0000644000076500000000000000020712716144070023733 0ustar neuronwheel00000000000000 _:b0 . _:b0 "Foo" . _:b1 _:b0 . rdflib-jsonld-0.4.0/test/test-suite/tests/toRdf-manifest.jsonld0000644000076500000000000010017612716144070025223 0ustar neuronwheel00000000000000{ "@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" } ] } rdflib-jsonld-0.4.0/test/test-suite/vocab.jsonld0000644000076500000000000003415112716144070022270 0ustar neuronwheel00000000000000{ "@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` (aliased as \"context\" in the test manifest) and optional options from `:option`. The expected results for a `PositiveEvaluationTest` MUST be compared using JSON object comparison with the processor output.", "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 `PositiveEvaluationTest` MUST be compared using JSON object comparison with the processor output.", "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 as \"context\" in the test manifest) and optional options from `:option`. The expected results for a `PositiveEvaluationTest` MUST be compared using JSON object comparison with the processor output.", "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 `:input` (aliased as \"frame\" in the test manifest) and optional options from `:option`. The expected results for a `PositiveEvaluationTest` MUST be compared using JSON object comparison with the processor output.", "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` MUST be compared using JSON object comparison with the processor output.", "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-Quads serialized in lexographical order and MUST be compared using string comparison.", "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 `PositiveEvaluationTest` are N-Quads serialized in lexographical order and MUST be compared either string comparison or Dataset as defined in [RDF11-CONCEPTS](http://www.w3.org/TR/rdf11-concepts/#section-dataset-isomorphism).", "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 optimizations. Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification.", "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" } ] }rdflib-jsonld-0.4.0/test/test-suite/vocab_context.jsonld0000644000076500000000000000103012716144070024022 0ustar neuronwheel00000000000000{ "@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"} } }rdflib-jsonld-0.4.0/test/test_api.py0000644000076500000000000000156612716144070020043 0ustar neuronwheel00000000000000from 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'))] rdflib-jsonld-0.4.0/test/test_compaction.py0000644000076500000000000001312412716144070021417 0ustar neuronwheel00000000000000# -*- coding: UTF-8 -*- from __future__ import unicode_literals import re import json import itertools from rdflib import Graph from rdflib.plugin import register, Serializer register('json-ld', Serializer, 'rdflib_jsonld.serializer', 'JsonLDSerializer') cases = [] def case(*args): cases.append(args) case(""" @prefix dc: . dc:title "Homepage"@en . """, { "@context": {"@vocab": "http://purl.org/dc/terms/", "@language": "en"}, "@id": "http://example.org/", "title": "Homepage" } ) case(""" @prefix dc: . 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(""" @prefix dc: . 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: . # # 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(""" @prefix dc: . 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(""" @prefix : . :has _:blank-1 . """, { "@context": {"has": {"@type": "@id", "@id": "http://example.org/ns#has"}}, "@id": "http://example.org/", "has": "_:blank-1" } ) case(""" @prefix rdfs: . @prefix : . :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(""" @prefix rdfs: . @prefix : . :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(""" @prefix owl: . @prefix : . :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(""" @prefix owl: . @prefix : . :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(""" @prefix owl: . @prefix : . :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"] } ) # Shorten result IRIs by using @base case(""" BASE PREFIX : a :Class . a :Class; :subClassOf . a :Thing . a :Thing . a :Thing . """, { "@context": { "@base": "http://example.org/some/path/#other", "@vocab": "http://example.org/vocab/" }, "@graph": [ { "@id": "/Thing", "@type": "Class" }, { "@id": "/Work", "@type": "Class", "subClassOf": { "@id": "/Thing" } }, { "@id": "", "@type": "Thing" }, { "@id": "/some/path/#this", "@type": "Thing" }, { "@id": "/some/path/#other", "@type": "Thing" } ] } ) json_kwargs = dict(indent=2, separators=(',', ': '), sort_keys=True, ensure_ascii=False) def run(data, expected): g = Graph().parse(data=data, format='turtle') result = g.serialize(format='json-ld', context=expected['@context']).decode('utf-8') result = json.loads(result) sort_graph(result) result = json.dumps(result, **json_kwargs) incr = itertools.count(1) result = re.sub(r'"_:[^"]+"', lambda m: '"_:blank-%s"' % incr.next(), result) sort_graph(expected) expected = json.dumps(expected, **json_kwargs) assert result == expected, "Expected not equal to result: %s" % result def sort_graph(data): if '@graph' in data: data['@graph'].sort(key=lambda node: node.get('@id')) def test_cases(): for data, expected in cases: yield run, data, expected rdflib-jsonld-0.4.0/test/test_context.py0000644000076500000000000001256712716144070020761 0ustar neuronwheel00000000000000""" JSON-LD Context Spec """ from __future__ import unicode_literals from rdflib_jsonld.context import Context, Term from rdflib_jsonld import errors # exception utility (see also nose.tools.raises) from functools import wraps def _expect_exception(expected_error): def _try_wrapper(f): @wraps(f) def _try(): try: f() assert e == expected_error except Exception as e: success = e == expected_error else: success = False assert success, "Expected %r" % expected_error return _try return _try_wrapper def test_create_context(): ctx = Context() ctx.add_term('label', 'http://example.org/ns/label') term = ctx.terms.get('label') assert term.name == 'label' assert ctx.find_term('http://example.org/ns/label') is term def test_select_term_based_on_value_characteristics(): ctx = Context() ctx.add_term('updated', 'http://example.org/ns/updated') ctx.add_term('updatedDate', 'http://example.org/ns/updated', coercion='http://www.w3.org/2001/XMLSchema#date') assert ctx.find_term('http://example.org/ns/updated').name == 'updated' assert ctx.find_term('http://example.org/ns/updated', coercion='http://www.w3.org/2001/XMLSchema#date').name == 'updatedDate' #ctx.find_term('http://example.org/ns/title_sv', language='sv') #ctx.find_term('http://example.org/ns/authorList', container='@set') #ctx.find_term('http://example.org/ns/creator', reverse=True) def test_getting_keyword_values_from_nodes(): ctx = Context() assert ctx.get_id({'@id': 'urn:x:1'}) == 'urn:x:1' assert ctx.get_language({'@language': 'en'}) == 'en' def test_parsing_a_context_expands_prefixes(): ctx = Context({ '@vocab': 'http://example.org/ns/', 'x': 'http://example.org/ns/', 'label': 'x:label', 'x:updated': {'@type': 'x:date'}}) term = ctx.terms.get('label') assert term.id == 'http://example.org/ns/label' term = ctx.terms.get('x:updated') assert term.id == 'http://example.org/ns/updated' assert term.type == 'http://example.org/ns/date' # test_expanding_terms(): assert ctx.expand('term') == 'http://example.org/ns/term' assert ctx.expand('x:term') == 'http://example.org/ns/term' # test_shrinking_iris(): assert ctx.shrink_iri('http://example.org/ns/term') == 'x:term' assert ctx.to_symbol('http://example.org/ns/term') == 'term' def test_resolving_iris(): ctx = Context({'@base': 'http://example.org/path/leaf'}) assert ctx.resolve('/') == 'http://example.org/' assert ctx.resolve('/trail') == 'http://example.org/trail' assert ctx.resolve('../') == 'http://example.org/' assert ctx.resolve('../../') == 'http://example.org/' def test_accessing_keyword_values_by_alias(): ctx = Context({'iri': '@id', 'lang': '@language'}) assert ctx.get_id({'iri': 'urn:x:1'}) == 'urn:x:1' assert ctx.get_language({'lang': 'en'}) == 'en' # test_standard_keywords_still_work(): assert ctx.get_id({'@id': 'urn:x:1'}) == 'urn:x:1' # test_representing_keywords_by_alias(): assert ctx.id_key == 'iri' assert ctx.lang_key == 'lang' def test_creating_a_subcontext(): ctx = Context() ctx4 = ctx.subcontext({'lang': '@language'}) assert ctx4.get_language({'lang': 'en'}) == 'en' # Mock external sources loading from rdflib_jsonld import context _source_to_sjon = context.source_to_json SOURCES = {} context.source_to_json = SOURCES.get def test_loading_contexts(): # Given context data: source1 = "http://example.org/base.jsonld" source2 = "http://example.org/context.jsonld" SOURCES[source1] = {'@context': {"@vocab": "http://example.org/vocab/"}} SOURCES[source2] = {'@context': [source1, {"n": "name"}]} # Create a context: ctx = Context(source2) assert ctx.expand('n') == 'http://example.org/vocab/name' # Context can be a list: ctx = Context([source2]) assert ctx.expand('n') == 'http://example.org/vocab/name' def test_use_base_in_local_context(): ctx = Context({'@base': "/local"}) assert ctx.base == '/local' def test_override_base(): ctx = Context(base="http://example.org/app/data/item", source={'@base': "http://example.org/"}) assert ctx.base == "http://example.org/" def test_resolve_relative_base(): ctx = Context(base="http://example.org/app/data/item", source={'@base': "../"}) assert ctx.base == "http://example.org/app/" assert ctx.resolve_iri("../other") == "http://example.org/other" def test_set_null_base(): ctx = Context(base="http://example.org/app/data/item", source={'@base': None}) assert ctx.base is None assert ctx.resolve_iri("../other") == "../other" def test_ignore_base_remote_context(): ctx_url = "http://example.org/remote-base.jsonld" SOURCES[ctx_url] = {'@context': {'@base': "/remote"}} ctx = Context(ctx_url) assert ctx.base == None @_expect_exception(errors.RECURSIVE_CONTEXT_INCLUSION) def test_recursive_context_inclusion_error(): ctx_url = "http://example.org/recursive.jsonld" SOURCES[ctx_url] = {'@context': ctx_url} ctx = Context(ctx_url) @_expect_exception(errors.INVALID_REMOTE_CONTEXT) def test_invalid_remote_context(): ctx_url = "http://example.org/recursive.jsonld" SOURCES[ctx_url] = {"key": "value"} ctx = Context(ctx_url) rdflib-jsonld-0.4.0/test/test_testsuite.py0000644000076500000000000002121412716144070021313 0ustar neuronwheel00000000000000from __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 import rdflib_jsonld.parser from rdflib_jsonld.parser import to_rdf from rdflib_jsonld.serializer import from_rdf from rdflib_jsonld.keys import CONTEXT, GRAPH rdflib_jsonld.parser.ALLOW_LISTS_OF_LISTS = False # 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')