Repository: terminusdb/terminusdb-client-python (language: python)

Issue:
Woql schema2
Please read https://github.com/terminusdb/terminus-client-python/blob/master/Contributing.md
before submitting a pull request.



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
index 8ff67f87..69ec0b2c 100644
--- a/.github/workflows/python.yml
+++ b/.github/workflows/python.yml
@@ -13,7 +13,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [3.6, 3.7, 3.8, 3.9]
+        python-version: [3.7, 3.8, 3.9]
 
     steps:
     - uses: actions/checkout@v2
diff --git a/makefile b/makefile
index 002d5daf..4600bd86 100644
--- a/makefile
+++ b/makefile
@@ -4,6 +4,10 @@ init:
 	pipenv install --dev
 	python -m pip install -e .
 
+#test without integration test
+unittest:
+	pytest terminusdb_client/tests --ignore=terminusdb_client/tests/integration_tests
+
 # Command to run test and generate a coverage report on terminal
 coverage:
 	pytest --cov=terminusdb_client terminusdb_client/tests/
diff --git a/setup.py b/setup.py
index af73c9e1..7d4be7aa 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@
 
 # ---
 
-requires = ["requests"]
+requires = ["requests", "numpydoc", "click", "shed"]
 
 test_requirements = [
     "pytest>=3",
@@ -56,5 +56,10 @@
     setup_requires=["pytest-runner"],
     tests_require=test_requirements,
     extras_require=extras_require,
-    python_requires=">=3.6",
+    python_requires=">=3.7",
+    entry_points={
+        "console_scripts": [
+            "terminusdb = terminusdb_client.scripts.scripts:terminusdb",
+        ],
+    },
 )
diff --git a/terminusdb_client/__init__.py b/terminusdb_client/__init__.py
index 816ee5fc..cd2f41c4 100644
--- a/terminusdb_client/__init__.py
+++ b/terminusdb_client/__init__.py
@@ -5,4 +5,5 @@
 from .woqlquery import WOQLLib  # noqa
 from .woqlquery import WOQLObj  # noqa
 from .woqlquery import WOQLQuery  # noqa
+from .woqlschema import *  # noqa
 from .woqlview import WOQLView  # noqa
diff --git a/terminusdb_client/scripts/__init__.py b/terminusdb_client/scripts/__init__.py
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/terminusdb_client/scripts/__init__.py
@@ -0,0 +1,1 @@
+
diff --git a/terminusdb_client/scripts/schema_template.py b/terminusdb_client/scripts/schema_template.py
new file mode 100644
index 00000000..9afaa482
--- /dev/null
+++ b/terminusdb_client/scripts/schema_template.py
@@ -0,0 +1,93 @@
+####
+# This is the script for storing the schema of your TerminusDB
+# database for your project.
+# Use 'terminusdb commit' to commit changes to the database and
+# use 'terminusdb sync' to change this file according to
+# the exsisting database schema
+####
+
+from typing import List, Optional, Set
+
+from terminusdb_client.woqlschema.woql_schema import (
+    DocumentTemplate,
+    EnumTemplate,
+    HashKey,
+    TaggedUnion,
+)
+
+
+class Country(DocumentTemplate):
+    """This is Country.
+
+    Country is a class object in the schema. It's class attributes will be the properties of the object. Therefore, a Country object will have a name which is string and a list of alias names that is called 'also_know_as'
+    """
+
+    _key = HashKey(["name"])  # Specifies a specific key generation method to use
+    name: str
+    also_know_as: List[str]  # Can be a list
+
+
+class Address(DocumentTemplate):
+    """This is address"""
+
+    _subdocument = (
+        []
+    )  # Subdocument means that it will not be reference when added as a property of another object
+    street: str
+    postal_code: str
+    country: Country  # Type can be a Class that is defined
+
+
+class Person(DocumentTemplate):
+    """This is a person
+
+    Can store the explanation to the attributes in the docstring. Docstrings needs to be in numpydoc format.
+
+    Attributes
+    ----------
+    name : str
+        Name of the person.
+    age : int
+        Age of the person.
+    """
+
+    name: str
+    age: int
+    friend_of: Set["Person"]  # Using quotation for future reference
+
+
+class Employee(Person):
+    """Employee will inherits the attributes from Person"""
+
+    address_of: Address
+    contact_number: Optional[str]  # if Optional is used, it can be None
+    managed_by: "Employee"
+
+
+class Coordinate(DocumentTemplate):
+    _abstract = []  # Abstract means that it cannot have any instances
+    x: float
+    y: float
+
+
+class Location(Address, Coordinate):
+    """Location is inherits from Address and Coordinate
+
+    Class can have multiple inheritance. It will inherits both the attibutes fromAddress and Coordinate.
+    """
+
+    name: str
+
+
+class Team(EnumTemplate):
+    """This is an example for Enum, if a value is not provided, the name of the Enum (e.g. Marketing) will be used as the value."""
+
+    IT = "Information Technology"
+    Marketing = ()
+
+
+class Contact(TaggedUnion):
+    """TaggedUnion allow options for types"""
+
+    local_number: int
+    international: str
diff --git a/terminusdb_client/scripts/scripts.py b/terminusdb_client/scripts/scripts.py
new file mode 100644
index 00000000..74de081b
--- /dev/null
+++ b/terminusdb_client/scripts/scripts.py
@@ -0,0 +1,268 @@
+import enum
+import os
+import shutil
+import sys
+
+import click
+from shed import shed
+
+# from terminusdb_client.woqlschema.woql_schema import TerminusClass
+import terminusdb_client.woqlschema.woql_schema as woqlschema
+from terminusdb_client.errors import DatabaseError, InterfaceError
+from terminusdb_client.woql_type import from_woql_type
+from terminusdb_client.woqlclient.woqlClient import WOQLClient
+
+
+@click.group()
+def terminusdb():
+    pass
+
+
+@click.command()
+def startproject():
+    """Copy the template files into current working directory"""
+    this_file_dir = os.path.dirname(os.path.abspath(__file__))
+    files = os.listdir(this_file_dir)
+    for file in files:
+        names = file.split("_")
+        if names[-1] == "template.py":
+            shutil.copyfile(
+                this_file_dir + "/" + file, os.getcwd() + "/" + names[0] + ".py"
+            )
+
+
+def _load_settings():
+    sys.path.append(os.getcwd())
+
+    try:
+        _temp = __import__("settings", globals(), locals(), ["SERVER", "DATABASE"], 0)
+        SERVER = _temp.SERVER
+        DATABASE = _temp.DATABASE
+        return {"SERVER": SERVER, "DATABASE": DATABASE}
+    except ImportError:
+        msg = "Cannot find settings.py"
+        raise ImportError(msg)
+
+
+def _connect(settings):
+    # SETTINGS = _load_settings()
+    SERVER = settings["SERVER"]
+    DATABASE = settings["DATABASE"]
+
+    client = WOQLClient(SERVER)
+    client.connect()
+    try:
+        client.create_database(DATABASE)
+        return client, f"{DATABASE} created."
+    except DatabaseError as error:
+        if "Database already exists." in error.message:
+            client.connect(db=DATABASE)
+            return client, f"Connected to {DATABASE}."
+        else:
+            raise InterfaceError(f"Cannot connect to {DATABASE}.")
+
+
+def _create_script(obj_list):
+    class ResultObj:
+        def __init__(self, name, parent, script=None):
+            self.name = name
+            if parent in dir(woqlschema):
+                self.parent = None
+            else:
+                self.parent = parent
+            if script is None:
+                if type(parent) == str or len(parent) == 1:
+                    self.script = f"class {name}({parent}):\n"
+                elif len(parent) > 1:
+                    self.script = f"class {name}({', '.join(parent)}):\n"
+                else:
+                    self.script = f"class {name}:\n"
+            else:
+                self.script = script
+
+        def add_key(self, key: str, fields: list = None):
+            if fields is None:
+                self.script += f"    _key = {key}Key()\n"
+            else:
+                self.script += f"    _key = {key}Key({fields})\n"
+
+        def add_subdoc(self):
+            self.script += "    _subdocument = []\n"
+
+        def add_abstract(self):
+            self.script += "    _abstract = []\n"
+
+        def add_docstring(self, obj_dict):
+            self.script += '    """'
+            if obj_dict["@documentation"].get("@comment"):
+                self.script += f'{obj_dict["@documentation"]["@comment"]}'
+            if obj_dict["@documentation"].get("@properties"):
+                self.script += "\n\n    Attributes\n    ----------\n"
+                for prop, discription in obj_dict["@documentation"][
+                    "@properties"
+                ].items():
+                    self.script += f"    {prop} : {from_woql_type(obj_dict[prop], skip_convert_error=True, as_str=True)}\n        {discription}\n"
+                self.script += "    "
+            self.script += '"""\n'
+
+    import_objs = []
+    print_script = """####
+# This is the script for storing the schema of your TerminusDB
+# database for your project.
+# Use 'terminusdb commit' to commit changes to the database and
+# use 'terminusdb sync' to change this file according to
+# the exsisting database schema
+####\n\n"""
+    for obj_str in dir(woqlschema):
+        obj = eval(f"woqlschema.{obj_str}")
+        if (
+            isinstance(obj, woqlschema.TerminusClass)
+            or isinstance(obj, enum.EnumMeta)
+            or isinstance(obj, woqlschema.TerminusKey)
+        ):
+            import_objs.append(obj_str)
+    print_script += "from typing import List, Optional, Set\n"
+    print_script += (
+        f"from terminusdb_client.woqlschema import {', '.join(import_objs)}\n"
+    )
+    # print("from typing import List, Optional, Set\n")
+    # print(f"from terminusdb_client.woqlschema import {', '.join(import_objs)}\n")
+
+    result_list = []
+    for obj in obj_list:
+        # print(obj)
+        if obj.get("@id"):
+            if obj.get("@inherits"):
+                result_obj = ResultObj(obj["@id"], obj["@inherits"])
+            elif obj["@type"] == "Class":
+                result_obj = ResultObj(obj["@id"], "DocumentTemplate")
+            elif obj["@type"] == "Enum":
+                result_obj = ResultObj(obj["@id"], "EnumTemplate")
+                for value in obj["@value"]:
+                    if " " not in value:
+                        result_obj.script += f"    {value} = ()\n"
+                    else:
+                        result_obj.script += (
+                            f"    {value.replace(' ','_')} = '{value}'\n"
+                        )
+            if obj.get("@documentation"):
+                result_obj.add_docstring(obj)
+            if obj.get("@subdocument") is not None:
+                result_obj.add_subdoc()
+            elif obj.get("@key"):
+                result_obj.add_key(obj["@key"]["@type"], obj["@key"].get("@fields"))
+
+            if obj.get("@abstract") is not None:
+                result_obj.add_abstract()
+            result_list.append(result_obj)
+
+            for key, value in obj.items():
+                if key[0] != "@":
+                    result_obj.script += f"    {key}:{from_woql_type(value, skip_convert_error=True, as_str=True)}\n"
+
+    # sorts depends on the object inherits order
+    printed = []
+    while len(result_list) > 0:
+        obj = result_list.pop(0)
+        if obj.parent is None:
+            # print(obj.script)
+            print_script += obj.script
+            printed.append(obj.name)
+        elif type(obj.parent) == str and obj.parent in printed:
+            # print(obj.script)
+            print_script += obj.script
+            printed.append(obj.name)
+        else:
+            parent_is_in = False
+            for mama in obj.parent:
+                if mama in printed:
+                    parent_is_in = True
+            if parent_is_in:
+                # print(obj.script)
+                print_script += obj.script
+                printed.append(obj.name)
+            else:
+                result_list.append(obj)
+    return print_script
+
+
+@click.command()
+def sync():
+    settings = _load_settings()
+    DATABASE = settings["DATABASE"]
+    client, msg = _connect(settings)
+    print(msg)
+    all_existing_obj = client.get_all_documents(graph_type="schema")
+    all_obj_list = []
+    for obj in all_existing_obj:
+        all_obj_list.append(obj)
+    if len(all_obj_list) > 1:
+        print_script = _create_script(all_obj_list)
+        # print(print_script)
+        file = open("schema.py", "w")
+        file.write(shed(source_code=print_script))
+        file.close()
+        print(f"schema.py is updated with {DATABASE} schema.")
+    else:
+        print(f"{DATABASE} schema is empty so schema.py has not be changed.")
+
+
+@click.command()
+def commit():
+    settings = _load_settings()
+    DATABASE = settings["DATABASE"]
+    client, msg = _connect(settings)
+    print(msg)
+    schema_plan = __import__("schema", globals(), locals(), [], 0)
+    all_existing_obj = client.get_all_documents(graph_type="schema")
+    all_existing_id = list(map(lambda x: x.get("@id"), all_existing_obj))
+    insert_schema = woqlschema.WOQLSchema()
+    update_schema = woqlschema.WOQLSchema()
+    for obj_str in dir(schema_plan):
+        obj = eval(f"schema_plan.{obj_str}")
+        if isinstance(obj, woqlschema.TerminusClass) or isinstance(obj, enum.EnumMeta):
+            if obj_str not in dir(woqlschema):
+                if obj_str in all_existing_id:
+                    obj._schema = update_schema
+                    update_schema.add_obj(obj)
+                else:
+                    obj._schema = insert_schema
+                    insert_schema.add_obj(obj)
+    # print("Update")
+    # print(update_schema.to_dict())
+    # print("Insert")
+    # print(insert_schema.to_dict())
+    client.replace_document(
+        update_schema,
+        commit_msg="Schema updated by Python client.",
+        graph_type="schema",
+    )
+    client.insert_document(
+        insert_schema,
+        commit_msg="Schema object insert by Python client.",
+        graph_type="schema",
+    )
+    print(f"{DATABASE} schema updated.")
+
+
+@click.command()
+@click.argument("database")
+def deletedb(database):
+    SETTINGS = _load_settings()
+    SERVER = SETTINGS["SERVER"]
+    DATABASE = SETTINGS["DATABASE"]
+    if database != DATABASE:
+        raise ValueError(
+            "Name provided does not match project database name. You can only delete the database in this project."
+        )
+    else:
+        client = WOQLClient(SERVER)
+        client.connect()
+        client.delete_database(database, client._account)
+        print(f"{database} deleted.")
+
+
+terminusdb.add_command(startproject)
+terminusdb.add_command(sync)
+terminusdb.add_command(commit)
+terminusdb.add_command(deletedb)
diff --git a/terminusdb_client/scripts/settings_template.py b/terminusdb_client/scripts/settings_template.py
new file mode 100644
index 00000000..008716c9
--- /dev/null
+++ b/terminusdb_client/scripts/settings_template.py
@@ -0,0 +1,7 @@
+####
+# This is the script for storing the settings to connect to TerminusDB
+# database for your project.
+####
+
+SERVER = "http://127.0.0.1:6363/"
+DATABASE = "my_project"  # change to the name of your database
diff --git a/terminusdb_client/woql_type.py b/terminusdb_client/woql_type.py
new file mode 100644
index 00000000..beb9d73c
--- /dev/null
+++ b/terminusdb_client/woql_type.py
@@ -0,0 +1,76 @@
+import datetime as dt
+from typing import ForwardRef, List, Optional, Set, Union
+
+CONVERT_TYPE = {
+    str: "xsd:string",
+    bool: "xsd:boolean",
+    float: "xsd:decimal",
+    int: "xsd:integer",
+    dt.datetime: "xsd:dataTime",
+    dt.date: "xsd:date",
+    dt.time: "xsd:time",
+    dt.timedelta: "xsd:duration",
+}
+
+
+def to_woql_type(input_type: type):
+    if input_type in CONVERT_TYPE:
+        return CONVERT_TYPE[input_type]
+    elif hasattr(input_type, "__module__") and input_type.__module__ == "typing":
+        if isinstance(input_type, ForwardRef):
+            return input_type.__forward_arg__
+        elif input_type._name:
+            return {
+                "@type": input_type._name,
+                "@class": to_woql_type(input_type.__args__[0]),
+            }
+        else:
+            return {"@type": "Optional", "@class": to_woql_type(input_type.__args__[0])}
+    else:
+        return str(input_type)
+
+
+def from_woql_type(
+    input_type: Union[str, dict], skip_convert_error=False, as_str=False
+):
+    invert_type = {v: k for k, v in CONVERT_TYPE.items()}
+    if isinstance(input_type, dict):
+        if input_type["@type"] == "List":
+            if as_str:
+                return f'List[{from_woql_type(input_type["@class"], skip_convert_error=True, as_str=True)}]'
+            else:
+                return List[
+                    from_woql_type(input_type["@class"], skip_convert_error=True)
+                ]
+        elif input_type["@type"] == "Set":
+            if as_str:
+                return f'Set[{from_woql_type(input_type["@class"], skip_convert_error=True, as_str=True)}]'
+            else:
+                return Set[
+                    from_woql_type(input_type["@class"], skip_convert_error=True)
+                ]
+        elif input_type["@type"] == "Optional":
+            if as_str:
+                return f'Optional[{from_woql_type(input_type["@class"], skip_convert_error=True, as_str=True)}]'
+            else:
+                return Optional[
+                    from_woql_type(input_type["@class"], skip_convert_error=True)
+                ]
+        else:
+            raise TypeError(
+                f"Input type {input_type} cannot be converted to Python type"
+            )
+    elif input_type in invert_type:
+        if as_str:
+            return invert_type[input_type].__name__
+        return invert_type[input_type]
+    elif skip_convert_error:
+        if as_str:
+            return f"'{input_type}'"
+        return input_type
+    else:
+        raise TypeError(f"Input type {input_type} cannot be converted to Python type")
+
+
+def convert_array(input_array: Union[list, set]):
+    pass
diff --git a/terminusdb_client/woql_utils.py b/terminusdb_client/woql_utils.py
index 3eb78565..6941865e 100644
--- a/terminusdb_client/woql_utils.py
+++ b/terminusdb_client/woql_utils.py
@@ -1,5 +1,8 @@
+import json
 import urllib.parse
 
+from .errors import DatabaseError
+
 STANDARD_URLS = {
     "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
     "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
@@ -118,3 +121,26 @@ def label_from_url(url):
         nurl = nurl[last_char + 1 :]
     nurl = nurl.replace("_", " ")
     return nurl[0].upper() + nurl[1:]
+
+
+def _result2stream(result):
+    """turning JSON string into a interable that give you a stream of dictionary"""
+    decoder = json.JSONDecoder()
+
+    idx = 0
+    result_length = len(result)
+    while True:
+        if idx >= result_length:
+            return
+        data, offset = decoder.raw_decode(result[idx:])
+        idx += offset
+        while idx < result_length and result[idx].isspace():
+            idx += 1
+        yield data
+
+
+def _finish_reponse(request_response):
+    if request_response.status_code == 200:
+        return request_response.text  # if not a json not it raises an error
+    elif request_response.status_code > 399 and request_response.status_code < 599:
+        raise DatabaseError(request_response)
diff --git a/terminusdb_client/woqlclient/woqlClient.py b/terminusdb_client/woqlclient/woqlClient.py
index 957d2cbe..ca51f0c3 100644
--- a/terminusdb_client/woqlclient/woqlClient.py
+++ b/terminusdb_client/woqlclient/woqlClient.py
@@ -5,6 +5,7 @@
 import os
 import warnings
 from base64 import b64encode
+from collections.abc import Iterable
 from datetime import datetime
 from typing import Any, Dict, List, Optional, Union
 
@@ -13,6 +14,7 @@
 
 from ..__version__ import __version__
 from ..errors import DatabaseError, InterfaceError
+from ..woql_utils import _finish_reponse, _result2stream
 from ..woqlquery.woql_query import WOQLQuery
 
 # WOQL client object
@@ -20,6 +22,19 @@
 # summary Python module for accessing the Terminus DB API
 
 
+class NoRequestWarning:
+    def __init__(self, insecure):
+        self.insecure = insecure
+
+    def __enter__(self):
+        if self.insecure:
+            warnings.simplefilter("ignore", InsecureRequestWarning)
+
+    def __exit__(self, type, value, traceback):
+        if self.insecure:
+            warnings.resetwarnings()
+
+
 class WOQLClient:
     """Client for querying a TerminusDB server using WOQL queries."""
 
@@ -95,18 +110,33 @@ def connect(
 
         self._connected = True
 
-        capabilities = self._dispatch_json("get", self._api)
-        self._uid = capabilities["@id"]
+        # capabilities = self._dispatch_json("get", self._api)
+        # self._uid = capabilities["@id"]
+        with NoRequestWarning(self.insecure):
+            try:
+                self._all_avaliable_db = json.loads(
+                    _finish_reponse(
+                        requests.get(
+                            self._api, auth=self._auth(), verify=(not self.insecure)
+                        )
+                    )
+                )
+            except Exception:
+                raise InterfaceError(
+                    f"Cannot connect to server, please make sure TerminusDB is running at {self._server_url} and the authentication details are correct."
+                ) from None
 
         #
         # Get the current user's identifier, if logged in to Hub, it will be their email otherwise it will be the user provided
-        if capabilities.get("system:user_identifier"):
-            self._author = capabilities["system:user_identifier"]["@value"]
-        else:
-            self._author = self._user
+        # if capabilities.get("system:user_identifier"):
+        #     self._author = capabilities["system:user_identifier"]["@value"]
+        # else:
+        #     self._author = self._user
 
-        if self._db is not None:
-            self._context = self._get_prefixes()
+        self._author = self._user
+
+        # if self._db is not None:
+        #     self._context = self._get_prefixes()
 
     def close(self) -> None:
         """Undo connect and close the connection.
@@ -704,6 +734,9 @@ def create_database(
         >>> client = WOQLClient("https://127.0.0.1:6363/")
         >>> client.create_database("someDB", "admin", "Database Label", "My Description")
         """
+
+        self._check_connection(check_db=False)
+
         details: Dict[str, Any] = {}
         if label:
             details["label"] = label
@@ -720,13 +753,21 @@ def create_database(
         if accountid is None:
             accountid = self._account
 
-        self._check_connection(check_db=False)
-
         self._account = accountid
         self._connected = True
         self._db = dbid
-        self._dispatch("post", self._db_url(), details)
-        self._context = self._get_prefixes()
+        # self._dispatch("post", self._db_url(), details)
+        # self._context = self._get_prefixes()
+
+        with NoRequestWarning(self.insecure):
+            _finish_reponse(
+                requests.post(
+                    self._db_url(),
+                    json=details,
+                    auth=self._auth(),
+                    verify=(not self.insecure),
+                )
+            )
 
     def delete_database(
         self,
@@ -775,7 +816,15 @@ def delete_database(
         else:
             self._account = accountid
         payload = {"force": force}
-        self._dispatch("delete", self._db_url(), payload)
+        with NoRequestWarning(self.insecure):
+            _finish_reponse(
+                requests.delete(
+                    self._db_url(),
+                    auth=self._auth(),
+                    verify=(not self.insecure),
+                )
+            )
+        # self._dispatch("delete", self._db_url(), payload)
         self._db = None
 
     def create_graph(
@@ -931,112 +980,233 @@ def insert_triples(
             commit,
         )
 
-    def get_csv(
+    def get_document(self, iri_id: str, graph_type: str = "instance", **kwargs) -> dict:
+        """Retrieves the document of the iri_id
+
+        Parameters
+        ----------
+        iri_id : str
+            Iri id for the docuemnt that is retriving
+        graph_type : str, optional
+            Graph type, either "instance" or "schema".
+        kwargs:
+            Additional boolean flags for retriving. Currently avaliable: "prefixed", "minimized", "unfold"
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
+        Returns
+        -------
+        dict
+        """
+        add_args = ["prefixed", "minimized", "unfold"]
+        self._check_connection()
+        payload = {"id": iri_id, "graph_type": graph_type}
+        for the_arg in add_args:
+            if the_arg in kwargs:
+                payload[the_arg] = kwargs[the_arg]
+
+        with NoRequestWarning(self.insecure):
+            result = requests.get(
+                self._documents_url(graph_type),
+                verify=(not self.insecure),
+                params=payload,
+                auth=self._auth(),
+            )
+        return json.loads(_finish_reponse(result))
+
+    def get_documents_by_type(
         self,
-        csv_name: str,
-        csv_directory: Optional[str] = None,
-        csv_output_name: Optional[str] = None,
-        graph_type: Optional[str] = "instance",
-        graph_id: Optional[str] = "main",
-    ):
-        """Retrieves the contents of the specified graph as a CSV
+        doc_type: str,
+        graph_type: str = "instance",
+        skip: int = 0,
+        count: Optional[int] = None,
+        **kwargs,
+    ) -> Iterable:
+        # TODO: make return iterable
+        """Retrieves the documents by type
 
         Parameters
         ----------
-        csv_name : str
-            Name of csv to dump from the specified database to extract.
-        csv_directory : str, optional
-            CSV output directory path. (defaults to current directory).
-        csv_output_name: str, optional
-            CSV output file name. (defaults to same csv name).
-        graph_type : str
-            Graph type, either "inference", "instance" or "schema". Default to be "instance"
-        graph_id : str, optional
-            Graph identifier. Default to be "main"
+        doc_type : str
+            Specific type for the docuemnts that is retriving
+        graph_type : str, optional
+            Graph type, either "instance" or "schema".
+        skip: int
+            The starting posiion of the returning results, default to be 0
+        count: int or None
+            The maximum number of returned result, if None (default) it will return all of the avalible result.
+        kwargs:
+            Additional boolean flags for retriving. Currently avaliable: "prefixed", "unfold"
 
         Raises
         ------
         InterfaceError
             if the client does not connect to a database
+
+        Returns
+        -------
+        iterable
+            Stream of dictionaries
         """
+        add_args = ["prefixed", "unfold"]
         self._check_connection()
-        options = {}
-        if csv_directory is None:
-            csv_directory = os.getcwd()
-        if csv_output_name is None:
-            csv_output_name = csv_name
-        options["name"] = csv_name
-
-        result = self._dispatch(
-            "get",
-            self._csv_url(graph_type, graph_id),
-            options,
-        )
+        payload = {"type": doc_type, "graph_type": graph_type}
+        if count is None:
+            count = "unlimited"
+        payload["skip"] = skip
+        payload["count"] = count
+        for the_arg in add_args:
+            if the_arg in kwargs:
+                payload[the_arg] = kwargs[the_arg]
+        with NoRequestWarning(self.insecure):
+            result = requests.get(
+                self._documents_url(graph_type),
+                verify=(not self.insecure),
+                params=payload,
+                auth=self._auth(),
+            )
+        return _result2stream(_finish_reponse(result))
 
-        stream = open(f"{csv_directory}/{csv_output_name}", "w")
-        stream.write(result)
-        stream.close()
+    def get_all_documents(
+        self,
+        graph_type: str = "instance",
+        skip: int = 0,
+        count: Optional[int] = None,
+        **kwargs,
+    ) -> Iterable:
+        # TODO: make return iterable
+        """Retrieves all avalibale the documents
 
-    def update_csv(
+        Parameters
+        ----------
+        graph_type : str, optional
+            Graph type, either "instance" or "schema".
+        skip: int
+            The starting posiion of the returning results, default to be 0
+        count: int or None
+            The maximum number of returned result, if None (default) it will return all of the avalible result.
+        kwargs:
+            Additional boolean flags for retriving. Currently avaliable: "prefixed", "unfold"
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
+        Returns
+        -------
+        iterable
+            Stream of dictionaries
+        """
+        add_args = ["prefixed", "unfold"]
+        self._check_connection()
+        payload = {"graph_type": graph_type}
+        payload["skip"] = skip
+        if count is not None:
+            payload["count"] = count
+        for the_arg in add_args:
+            if the_arg in kwargs:
+                payload[the_arg] = kwargs[the_arg]
+        with NoRequestWarning(self.insecure):
+            result = requests.get(
+                self._documents_url(),
+                verify=(not self.insecure),
+                params=payload,
+                auth=self._auth(),
+            )
+        return _result2stream(_finish_reponse(result))
+
+    def insert_document(
         self,
-        csv_paths: Union[str, List[str]],
+        document: Union[
+            dict, List[dict], "WOQLSchema", "ObjectTemplate", List["ObjectTemplate"]
+        ],
+        graph_type: str = "instance",
         commit_msg: Optional[str] = None,
-        graph_type: Optional[str] = "instance",
-        graph_id: Optional[str] = "main",
     ) -> None:
-        """Updates the contents of the specified graph with the csv. Replaces the entire file contents
+        """Inserts the specified document(s)
 
         Parameters
         ----------
-        csv_paths : str or list of str
-            csv path or list of csv paths to load. (required)
+        document: dict or list of dict
+            Document(s) to be inserted.
+        graph_type : str
+            Graph type, either "inference", "instance" or "schema".
         commit_msg : str
             Commit message.
-        graph_type : str
-            Graph type, either "inference", "instance" or "schema". Default to be "instance"
-        graph_id : str, optional
-            Graph identifier. Default to be "main"
 
         Raises
         ------
         InterfaceError
             if the client does not connect to a database
+
+        Returns
+        -------
+        list
+            list of ids of the inseted docuemnts
         """
         self._check_connection()
-        if commit_msg is None:
-            commit_msg = f"Update csv from {csv_paths} by python client {__version__}"
-        commit = self._generate_commit(commit_msg)
-        if isinstance(csv_paths, str):
-            csv_paths_list = [csv_paths]
+        params = self._generate_commit(commit_msg)["commit_info"]
+        params["graph_type"] = graph_type
+
+        def conv_to_dict(object):
+            if isinstance(object, dict):
+                return object
+            elif hasattr(object, "to_dict"):
+                return object.to_dict()
+            elif hasattr(object, "_obj_to_dict"):
+                if (
+                    not hasattr(object, "_id")
+                    and not hasattr(object.__class__, "_subdocument")
+                    and hasattr(object.__class__._key, "idgen")
+                ):
+                    object._id = object.__class__._key.idgen(object)
+                return object._obj_to_dict()
+            else:
+                raise ValueError("Object cannot convert to dictionary")
+
+        if isinstance(document, list):
+            new_doc = []
+            for item in document:
+                # while document:
+                #     item = document.pop()
+                item_dict = conv_to_dict(item)
+                new_doc.append(item_dict)
+                # id_list.append(item_dict['@id'])
+            document = new_doc
         else:
-            csv_paths_list = csv_paths
-
-        self._dispatch(
-            "post",
-            self._csv_url(graph_type, graph_id),
-            commit,
-            file_list=csv_paths_list,
-        )
+            document = conv_to_dict(document)
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._documents_url(),
+                params=params,
+                json=document,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+        return json.loads(_finish_reponse(result))
 
-    def insert_csv(
+    def replace_document(
         self,
-        csv_paths: Union[str, List[str]],
+        document: Union[
+            dict, List[dict], "WOQLSchema", "ObjectTemplate", List["ObjectTemplate"]
+        ],
+        graph_type: str,
         commit_msg: Optional[str] = None,
-        graph_type: Optional[str] = "instance",
-        graph_id: Optional[str] = "main",
     ) -> None:
-        """Inserts into the specified graph with the csv.
+        """Updates the specified document(s)
 
         Parameters
         ----------
-        csv_paths : str or list
-            CSV or list of csvs to upload
+        document: dict or list of dict
+            Document(s) to be updated.
+        graph_type : str
+            Graph type, either "inference", "instance" or "schema".
         commit_msg : str
             Commit message.
-        graph_type : str
-            Graph type, either "inference", "instance" or "schema". Default to be "instance"
-        graph_id : str, optional
-            Graph identifier. Default to be "main"
 
         Raises
         ------
@@ -1044,20 +1214,210 @@ def insert_csv(
             if the client does not connect to a database
         """
         self._check_connection()
-        if commit_msg is None:
-            commit_msg = f"Insert csv from {csv_paths} by python client {__version__}"
-        commit = self._generate_commit(commit_msg)
-        if isinstance(csv_paths, str):
-            csv_paths_list = [csv_paths]
+        params = self._generate_commit(commit_msg)["commit_info"]
+        params["graph_type"] = graph_type
+
+        def conv_to_dict(object):
+            if isinstance(object, dict):
+                return object
+            elif hasattr(object, "to_dict"):
+                return object.to_dict()
+            elif hasattr(object, "_obj_to_dict"):
+                if (
+                    not hasattr(object, "_id")
+                    and not hasattr(object.__class__, "_subdocument")
+                    and hasattr(object.__class__._key, "idgen")
+                ):
+                    object._id = object.__class__._key.idgen(object)
+                return object._obj_to_dict()
+            else:
+                raise ValueError("Object cannot convert to dictionary")
+
+        if isinstance(document, list):
+            new_doc = []
+            for item in document:
+                # while document:
+                #     item = document.pop()
+                item_dict = conv_to_dict(item)
+                new_doc.append(item_dict)
+                # id_list.append(item_dict['@id'])
+            document = new_doc
         else:
-            csv_paths_list = csv_paths
+            document = conv_to_dict(document)
+        with NoRequestWarning(self.insecure):
+            _finish_reponse(
+                requests.put(
+                    self._documents_url(),
+                    params=params,
+                    json=document,
+                    auth=self._auth(),
+                    verify=(not self.insecure),
+                )
+            )
 
-        self._dispatch(
-            "put",
-            self._csv_url(graph_type, graph_id),
-            commit,
-            file_list=csv_paths_list,
-        )
+    def delete_document(
+        self,
+        doc_id: Union[str, List[str]],
+        graph_type: str,
+        commit_msg: Optional[str] = None,
+    ) -> None:
+        """Delete the specified document(s)
+
+        Parameters
+        ----------
+        doc_id: str or list of str
+            Id(s) of document(s) to be updated.
+        graph_type : str
+            Graph type, either "inference", "instance" or "schema".
+        commit_msg : str
+            Commit message.
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+        """
+        self._check_connection()
+        params = self._generate_commit(commit_msg)["commit_info"]
+        params["graph_type"] = graph_type
+        with NoRequestWarning(self.insecure):
+            _finish_reponse(
+                requests.delete(
+                    self._documents_url(),
+                    params=params,
+                    json=doc_id,
+                    auth=self._auth(),
+                    verify=(not self.insecure),
+                )
+            )
+
+    # def get_csv(
+    #     self,
+    #     csv_name: str,
+    #     csv_directory: Optional[str] = None,
+    #     csv_output_name: Optional[str] = None,
+    #     graph_type: Optional[str] = "instance",
+    #     graph_id: Optional[str] = "main",
+    # ):
+    #     """Retrieves the contents of the specified graph as a CSV
+    #
+    #     Parameters
+    #     ----------
+    #     csv_name : str
+    #         Name of csv to dump from the specified database to extract.
+    #     csv_directory : str, optional
+    #         CSV output directory path. (defaults to current directory).
+    #     csv_output_name: str, optional
+    #         CSV output file name. (defaults to same csv name).
+    #     graph_type : str
+    #         Graph type, either "inference", "instance" or "schema". Default to be "instance"
+    #     graph_id : str, optional
+    #         Graph identifier. Default to be "main"
+    #
+    #     Raises
+    #     ------
+    #     InterfaceError
+    #         if the client does not connect to a database
+    #     """
+    #     self._check_connection()
+    #     options = {}
+    #     if csv_directory is None:
+    #         csv_directory = os.getcwd()
+    #     if csv_output_name is None:
+    #         csv_output_name = csv_name
+    #     options["name"] = csv_name
+    #
+    #     result = self._dispatch(
+    #         "get",
+    #         self._csv_url(graph_type, graph_id),
+    #         options,
+    #     )
+    #
+    #     stream = open(f"{csv_directory}/{csv_output_name}", "w")
+    #     stream.write(result)
+    #     stream.close()
+    #
+    # def update_csv(
+    #     self,
+    #     csv_paths: Union[str, List[str]],
+    #     commit_msg: Optional[str] = None,
+    #     graph_type: Optional[str] = "instance",
+    #     graph_id: Optional[str] = "main",
+    # ) -> None:
+    #     """Updates the contents of the specified graph with the csv. Replaces the entire file contents
+    #
+    #     Parameters
+    #     ----------
+    #     csv_paths : str or list of str
+    #         csv path or list of csv paths to load. (required)
+    #     commit_msg : str
+    #         Commit message.
+    #     graph_type : str
+    #         Graph type, either "inference", "instance" or "schema". Default to be "instance"
+    #     graph_id : str, optional
+    #         Graph identifier. Default to be "main"
+    #
+    #     Raises
+    #     ------
+    #     InterfaceError
+    #         if the client does not connect to a database
+    #     """
+    #     self._check_connection()
+    #     if commit_msg is None:
+    #         commit_msg = f"Update csv from {csv_paths} by python client {__version__}"
+    #     commit = self._generate_commit(commit_msg)
+    #     if isinstance(csv_paths, str):
+    #         csv_paths_list = [csv_paths]
+    #     else:
+    #         csv_paths_list = csv_paths
+    #
+    #     self._dispatch(
+    #         "post",
+    #         self._csv_url(graph_type, graph_id),
+    #         commit,
+    #         file_list=csv_paths_list,
+    #     )
+    #
+    # def insert_csv(
+    #     self,
+    #     csv_paths: Union[str, List[str]],
+    #     commit_msg: Optional[str] = None,
+    #     graph_type: Optional[str] = "instance",
+    #     graph_id: Optional[str] = "main",
+    # ) -> None:
+    #     """Inserts into the specified graph with the csv.
+    #
+    #     Parameters
+    #     ----------
+    #     csv_paths : str or list
+    #         CSV or list of csvs to upload
+    #     commit_msg : str
+    #         Commit message.
+    #     graph_type : str
+    #         Graph type, either "inference", "instance" or "schema". Default to be "instance"
+    #     graph_id : str, optional
+    #         Graph identifier. Default to be "main"
+    #
+    #     Raises
+    #     ------
+    #     InterfaceError
+    #         if the client does not connect to a database
+    #     """
+    #     self._check_connection()
+    #     if commit_msg is None:
+    #         commit_msg = f"Insert csv from {csv_paths} by python client {__version__}"
+    #     commit = self._generate_commit(commit_msg)
+    #     if isinstance(csv_paths, str):
+    #         csv_paths_list = [csv_paths]
+    #     else:
+    #         csv_paths_list = csv_paths
+    #
+    #     self._dispatch(
+    #         "put",
+    #         self._csv_url(graph_type, graph_id),
+    #         commit,
+    #         file_list=csv_paths_list,
+    #     )
 
     def commit(self):
         """Not implementated: open transactions currently not suportted. Please check back later."""
@@ -1066,7 +1426,7 @@ def query(
         self,
         woql_query: Union[dict, WOQLQuery],
         commit_msg: Optional[str] = None,
-        file_dict: Optional[dict] = None,
+        # file_dict: Optional[dict] = None,
     ) -> Union[dict, str]:
         """Updates the contents of the specified graph with the triples encoded in turtle format Replaces the entire graph contents
 
@@ -1076,7 +1436,7 @@ def query(
             A woql query as an object or dict
         commit_mg : str
             A message that will be written to the commit log to describe the change
-        file_dict:
+        file_dict: **deprecated**
             File dictionary to be associated with post name => filename, for multipart POST
 
         Raises
@@ -1098,37 +1458,55 @@ def query(
             request_woql_query = woql_query.to_dict()
         else:
             request_woql_query = woql_query
-        request_woql_query["@context"] = self._context
+        # if request_woql_query.get("@context") and isinstance(
+        #     request_woql_query.get("@context"), dict
+        # ):
+        #     request_woql_query["@context"].update(self._context)
+        # else:
+        #     request_woql_query["@context"] = self._context
         query_obj["query"] = request_woql_query
         # request_file_dict: Optional[Dict[str, Tuple[str, Union[str, BinaryIO], str]]]
-        if file_dict is not None and type(file_dict) is dict:
-            request_file_dict = {}
-            for name in query_obj:
-                query_obj_value = query_obj[name]
-                request_file_dict[name] = (
-                    name,
-                    json.dumps(query_obj_value),
-                    "application/json",
-                )
-            file_list = []
-            for name in file_dict:
-                file_list.append(os.path.join(file_dict[name], name))
-                # path = file_dict[name]
-                # request_file_dict[name] = (name, open(path, "rb"), "application/binary")
-            payload = None
-        else:
-            file_list = None
-            payload = query_obj
+        # if file_dict is not None and type(file_dict) is dict:
+        #     request_file_dict = {}
+        #     for name in query_obj:
+        #         query_obj_value = query_obj[name]
+        #         request_file_dict[name] = (
+        #             name,
+        #             json.dumps(query_obj_value),
+        #             "application/json",
+        #         )
+        #     file_list = []
+        #     for name in file_dict:
+        #         file_list.append(os.path.join(file_dict[name], name))
+        #         # path = file_dict[name]
+        #         # request_file_dict[name] = (name, open(path, "rb"), "application/binary")
+        #     payload = None
+        # else:
+        #     file_list = None
+        #     payload = query_obj
+
+        # result = self._dispatch_json(
+        #     "post",
+        #     self._query_url(),
+        #     payload,
+        #     file_list,
+        # )
+        # if result.get("inserts") or result.get("deletes"):
+        #     return "Commit successfully made."
+        # return result
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._query_url(),
+                json=query_obj,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+        fin_reqult = json.loads(_finish_reponse(result))
 
-        result = self._dispatch_json(
-            "post",
-            self._query_url(),
-            payload,
-            file_list,
-        )
-        if result.get("inserts") or result.get("deletes"):
+        if fin_reqult.get("inserts") or fin_reqult.get("deletes"):
             return "Commit successfully made."
-        return result
+        return fin_reqult
 
     def branch(self, new_branch_id: str, empty: bool = False) -> None:
         """Create a branch starting from the current branch.
@@ -1157,7 +1535,15 @@ def branch(self, new_branch_id: str, empty: bool = False) -> None:
                 "origin": f"{self._account}/{self._db}/{self._repo}/branch/{self._branch}"
             }
 
-        self._dispatch("post", self._branch_url(new_branch_id), source)
+        # self._dispatch("post", self._branch_url(new_branch_id), source)
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._branch_url(new_branch_id),
+                json=source,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
 
     def pull(
         self,
@@ -1209,11 +1595,21 @@ def pull(
             "message": message,
         }
 
-        return self._dispatch_json(
-            "post",
-            self._pull_url(),
-            rc_args,
-        )
+        # return self._dispatch_json(
+        #     "post",
+        #     self._pull_url(),
+        #     rc_args,
+        # )
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._pull_url(),
+                json=rc_args,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+
+        return json.loads(_finish_reponse(result))
 
     def fetch(self, remote_id: str) -> dict:
         """Fatch the brach from a remote
@@ -1228,7 +1624,16 @@ def fetch(self, remote_id: str) -> dict:
         InterfaceError
             if the client does not connect to a database"""
         self._check_connection()
-        return self._dispatch_json("post", self._fetch_url(remote_id))
+        # return self._dispatch_json("post", self._fetch_url(remote_id))
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._fetch_url(remote_id),
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+
+        return json.loads(_finish_reponse(result))
 
     def push(
         self,
@@ -1278,7 +1683,17 @@ def push(
             "author": author,
             "message": message,
         }
-        return self._dispatch_json("post", self._push_url(), rc_args)
+        # return self._dispatch_json("post", self._push_url(), rc_args)
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._push_url(),
+                json=rc_args,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+
+        return json.loads(_finish_reponse(result))
 
     def rebase(
         self,
@@ -1322,7 +1737,17 @@ def rebase(
         if message is None:
             message = f"Rebase from {rebase_source} by Python client {__version__}"
         rc_args = {"rebase_from": rebase_source, "author": author, "message": message}
-        return self._dispatch_json("post", self._rebase_url(), rc_args)
+        # return self._dispatch_json("post", self._rebase_url(), rc_args)
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._rebase_url(),
+                json=rc_args,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+
+        return json.loads(_finish_reponse(result))
 
     def reset(self, commit: str, use_path: bool = False) -> None:
         """Reset the current branch HEAD to the specified commit path. Doing it will reset the internal commit counter (self._commit_made) back to zero.
@@ -1356,11 +1781,19 @@ def reset(self, commit: str, use_path: bool = False) -> None:
             commit_path = commit
         else:
             commit_path = f"{self._account}/{self._db}/{self._repo}/commit/{commit}"
-        self._dispatch(
-            "post",
-            self._reset_url(),
-            {"commit_descriptor": commit_path},
-        )
+        # self._dispatch(
+        #     "post",
+        #     self._reset_url(),
+        #     {"commit_descriptor": commit_path},
+        # )
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._reset_url(),
+                json={"commit_descriptor": commit_path},
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
 
     def optimize(self, path: str) -> None:
         """Optimize the specified path.
@@ -1385,7 +1818,14 @@ def optimize(self, path: str) -> None:
         >>> client.optimize('admin/database/_meta')
         """
         self._check_connection()
-        self._dispatch("post", self._optimize_url(path))
+        # self._dispatch("post", self._optimize_url(path))
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._optimize_url(path),
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
 
     def squash(
         self, message: Optional[str] = None, author: Optional[str] = None
@@ -1424,8 +1864,18 @@ def squash(
         >>> client.squash('This is a squash commit message!')
         """
         self._check_connection()
-        commit_object = self._generate_commit(message, author)
-        return self._dispatch_json("post", self._squash_url(), commit_object)
+        # commit_object = self._generate_commit(message, author)
+        # return self._dispatch_json("post", self._squash_url(), commit_object)
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._squash_url(),
+                json=self._generate_commit(message, author),
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
+
+        return json.loads(_finish_reponse(result))
 
     def clonedb(
         self, clone_source: str, newid: str, description: Optional[str] = None
@@ -1455,7 +1905,15 @@ def clonedb(
         if description is None:
             description = f"New database {newid}"
         rc_args = {"remote_url": clone_source, "label": newid, "comment": description}
-        self._dispatch("post", self._clone_url(newid), rc_args)
+        # self._dispatch("post", self._clone_url(newid), rc_args)
+
+        with NoRequestWarning(self.insecure):
+            result = requests.post(
+                self._clone_url(newid),
+                json=rc_args,
+                auth=self._auth(),
+                verify=(not self.insecure),
+            )
 
     def _generate_commit(
         self, msg: Optional[str] = None, author: Optional[str] = None
@@ -1517,12 +1975,18 @@ def _dispatch_json(
         result = self._dispatch(action, url, payload, file_list)
         return json.loads(result)
 
+    def _auth(self):
+        if self._connected and self._key and self._user:
+            return (self._user, self._key)
+        # TODO: remote_auth
+
     def _dispatch(
         self,
         action: str,  # get, post, put, delete
         url: str,
         payload: Optional[dict] = None,
         file_list: Optional[list] = None,
+        data: Optional[list] = None,
     ) -> str:
         """Directly dispatch to a TerminusDB database.
 
@@ -1652,7 +2116,7 @@ def _dispatch(
         elif request_response.status_code > 399 and request_response.status_code < 599:
             raise DatabaseError(request_response)
 
-    def get_database(self, dbid: str, account: str) -> Optional[dict]:
+    def get_database(self, dbid: str) -> Optional[dict]:
         """
         Returns metadata (id, organization, label, comment) about the requested database
         Parameters
@@ -1672,34 +2136,12 @@ def get_database(self, dbid: str, account: str) -> Optional[dict]:
         dict or None if not found
         """
         self._check_connection(check_db=False)
-        db_ids = []
-        all_dbs = []
         for this_db in self.get_databases():
-            if this_db["system:resource_name"]["@value"] == dbid:
-                db_ids.append(this_db["@id"])
-                all_dbs.append(this_db)
-
-        resources_ids = []
-        for scope in self._dispatch_json("get", self._api)["system:role"][
-            "system:capability"
-        ]["system:capability_scope"]:
-            if (
-                scope["@type"] == "system:Organization"
-                and scope["system:organization_name"]["@value"] == account
-            ):
-                if type(scope["system:resource_includes"]) is list:
-                    for resource in scope["system:resource_includes"]:
-                        resources_ids.append(resource["@id"])
-
-        target_db = None
-        for target in set(db_ids).intersection(set(resources_ids)):
-            target_db = target
-
-        for this_db in all_dbs:
-            if this_db["@id"] == target_db:
+            if this_db["name"] == dbid:
                 return this_db
+        return None
 
-    def get_databases(self) -> List[Dict]:
+    def get_databases(self) -> List[dict]:
         """
         Returns a list of database metadata records for all databases the user has access to
 
@@ -1713,13 +2155,14 @@ def get_databases(self) -> List[Dict]:
         list of dicts
         """
         self._check_connection(check_db=False)
-        all_dbs = []
-        for scope in self._dispatch_json("get", self._api)["system:role"][
-            "system:capability"
-        ]["system:capability_scope"]:
-            if scope["@type"] == "system:Database":
-                all_dbs.append(scope)
-        return all_dbs
+
+        with NoRequestWarning(self.insecure):
+            result = requests.get(
+                self._api,
+                verify=(not self.insecure),
+                auth=self._auth(),
+            )
+        return json.loads(_finish_reponse(result))
 
     def list_databases(self) -> List[Dict]:
         """
@@ -1735,10 +2178,9 @@ def list_databases(self) -> List[Dict]:
         list of dicts
         """
         self._check_connection(check_db=False)
-        all_data = self.get_databases()
         all_dbs = []
-        for data in all_data:
-            all_dbs.append(data["system:resource_name"]["@value"])
+        for data in self.get_databases():
+            all_dbs.append(data["name"])
         return all_dbs
 
     def get_metadata(self, dbid: str, account):
@@ -1819,6 +2261,13 @@ def _csv_url(self, graph_type="instance", graph_id="main"):
             base_url = self._branch_base("csv")
         return f"{base_url}/{graph_type}/{graph_id}"
 
+    def _documents_url(self):
+        if self._db == "_system":
+            base_url = self._db_base("document")
+        else:
+            base_url = self._branch_base("document")
+        return base_url
+
     def _triples_url(self, graph_type="instance", graph_id="main"):
         if self._db == "_system":
             base_url = self._db_base("triples")
diff --git a/terminusdb_client/woqlquery/woql_core.py b/terminusdb_client/woqlquery/woql_core.py
index 62bc875c..04f15780 100644
--- a/terminusdb_client/woqlquery/woql_core.py
+++ b/terminusdb_client/woqlquery/woql_core.py
@@ -69,35 +69,35 @@ def _tokens_to_json(seq, query):
         left = seq[: seq.index("|")]
         right = seq[seq.index("|") + 1 :]
         return {
-            "@type": "woql:PathOr",
-            "woql:path_left": _tokens_to_json(left, query),
-            "woql:path_right": _tokens_to_json(right, query),
+            "@type": "PathOr",
+            "or" : [_tokens_to_json(left, query),
+                    _tokens_to_json(right, query)],
         }
     elif "," in seq:  # binds tighter
         first = seq[: seq.index(",")]
         second = seq[seq.index(",") + 1 :]
         return {
-            "@type": "woql:PathSequence",
-            "woql:path_first": _tokens_to_json(first, query),
-            "woql:path_second": _tokens_to_json(second, query),
+            "@type": "PathSequence",
+            "sequence": [_tokens_to_json(first, query),
+                         _tokens_to_json(second, query)],
         }
     elif seq[1] == "+":  # binds tightest of all
         return {
-            "@type": "woql:PathPlus",
-            "woql:path_pattern": _tokens_to_json([seq[0]], query),
+            "@type": "PathPlus",
+            "pattern": _tokens_to_json([seq[0]], query),
         }
     elif seq[1][0] == "{":  # binds tightest of all
         meat = seq[1][1:-1].split(",")
         return {
-            "@type": "woql:PathTimes",
-            "woql:path_minimum": {"@type": "xsd:positiveInteger", "@value": meat[0]},
-            "woql:path_maximum": {"@type": "xsd:positiveInteger", "@value": meat[1]},
-            "woql:path_pattern": _tokens_to_json([seq[0]], query),
+            "@type": "PathTimes",
+            "minimum": meat[0],
+            "maximum": meat[1],
+            "pattern": _tokens_to_json([seq[0]], query),
         }
     else:
         query._parameter_error("Pattern error - could not be parsed " + seq[0])
         return {
-            "@type": "woql:PathPredicate",
+            "@type": "PathPredicate",
             "rdfs:label": "failed to parse query " + seq[0],
         }
 
@@ -111,15 +111,17 @@ def _compile_predicate(pp, query):
             else query._clean_path_predicate(pred)
         )
         return {
-            "@type": "woql:PathOr",
-            "woql:path_left": {
-                "@type": "woql:InvertedPathPredicate",
-                "woql:path_predicate": {"@id": cleaned},
-            },
-            "woql:path_right": {
-                "@type": "woql:PathPredicate",
-                "woql:path_predicate": {"@id": cleaned},
-            },
+            "@type": "PathOr",
+            "or": [
+                {
+                    "@type": "InversePathPredicate",
+                    "predicate": cleaned,
+                },
+                {
+                    "@type": "PathPredicate",
+                    "predicate": cleaned,
+                },
+            ]
         }
     elif "<" in pp:
         pred = pp[1:]
@@ -129,8 +131,8 @@ def _compile_predicate(pp, query):
             else query._clean_path_predicate(pred)
         )
         return {
-            "@type": "woql:InvertedPathPredicate",
-            "woql:path_predicate": {"@id": cleaned},
+            "@type": "InversePathPredicate",
+            "predicate": cleaned,
         }
     elif ">" in pp:
         pred = pp[:-1]
@@ -139,28 +141,33 @@ def _compile_predicate(pp, query):
             if pred == "*"
             else query._clean_path_predicate(pred)
         )
-        return {"@type": "woql:PathPredicate", "woql:path_predicate": {"@id": cleaned}}
+        return {"@type": "PathPredicate", "predicate": cleaned}
     else:
         pred = "owl:topObjectProperty" if pp == "*" else query._clean_path_predicate(pp)
-        return {"@type": "woql:PathPredicate", "woql:path_predicate": {"@id": pred}}
+        return {"@type": "PathPredicate", "predicate": pred}
 
 
 def _copy_dict(orig, rollup=None):
     if type(orig) is list:
         return orig
     if rollup:
-        if orig.get("@type") in ["woql:And", "woql:Or"]:
-            if not orig.get("woql:query_list") or not len(orig["woql:query_list"]):
+        if orig.get("@type") == "And":
+            if not orig.get("and") or not len(orig["and"]):
                 return {}
-            if len(orig["woql:query_list"]) == 1:
-                return _copy_dict(orig["woql:query_list"][0]["woql:query"], rollup)
-        if "woql:query" in orig and orig["@type"] != "woql:Comment":
-            if type(orig["woql:query"]) is tuple:
-                orig["woql:query"] = orig["woql:query"][0].to_dict()
-            if not orig["woql:query"].get("@type"):
+            if len(orig["and"]) == 1:
+                return _copy_dict(orig["and"][0], rollup)
+        if orig.get("@type") == "Or":
+            if not orig.get("or") or not len(orig["or"]):
                 return {}
-        if "woql:consequent" in orig:
-            if not orig["woql:consequent"].get("@type"):
+            if len(orig["or"]) == 1:
+                return _copy_dict(orig["or"][0], rollup)
+        if "query" in orig and orig["@type"] != "Comment":
+            if type(orig["query"]) is tuple:
+                orig["query"] = orig["query"][0].to_dict()
+            if not orig["query"].get("@type"):
+                return {}
+        if "consequent" in orig:
+            if not orig["consequent"].get("@type"):
                 return {}
     nuj = {}
     for key, part in orig.items():
@@ -172,7 +179,7 @@ def _copy_dict(orig, rollup=None):
                     if sub:
                         nupart.append(sub)
                 else:
-                    nupart = nupart.append(item)
+                    nupart.append(item)
             nuj[key] = nupart
         elif type(part) is dict:
             query = _copy_dict(part, rollup)
diff --git a/terminusdb_client/woqlquery/woql_library.py b/terminusdb_client/woqlquery/woql_library.py
index 952d2bba..7475fd05 100644
--- a/terminusdb_client/woqlquery/woql_library.py
+++ b/terminusdb_client/woqlquery/woql_library.py
@@ -14,7 +14,7 @@ def __init__(self, mode=None):
         self._user_values = []
         self._default_variables = []
         self._parameters = []
-        self._default_schema_resource = "schema/main"
+        self._default_schema_resource = "schema"
         self._default_commit_resource = "_commits"
         self._default_meta_resource = "_meta"
         self._masterdb_resource = "terminus"
diff --git a/terminusdb_client/woqlquery/woql_query.py b/terminusdb_client/woqlquery/woql_query.py
index 1187dd49..f03f297d 100644
--- a/terminusdb_client/woqlquery/woql_query.py
+++ b/terminusdb_client/woqlquery/woql_query.py
@@ -20,12 +20,12 @@
     "limit",
 ]
 UPDATE_OPERATORS = [
-    "woql:AddTriple",
-    "woql:DeleteTriple",
-    "woql:AddQuad",
-    "woql:DeleteQuad",
-    "woql:DeleteObject",
-    "woql:UpdateObject",
+    "AddTriple",
+    "DeleteTriple",
+    "AddQuad",
+    "DeleteQuad",
+    "DeleteObject",
+    "UpdateObject",
 ]
 
 SHORT_NAME_MAPPING = {
@@ -55,7 +55,7 @@
 
 
 class WOQLQuery:
-    def __init__(self, query=None, graph="schema/main"):
+    def __init__(self, query=None, graph="schema"):
         """defines the internal functions of the woql query object - the language API is defined in WOQLQuery
 
         Parameters
@@ -72,24 +72,6 @@ def __init__(self, query=None, graph="schema/main"):
         self._chain_ended = False
         self._contains_update = False
         self._triple_builder_context = {}
-        # operators which preserve global paging
-        # self._paging_transitive_properties = [
-        #     "select",
-        #     "from",
-        #     "start",
-        #     "when",
-        #     "opt",
-        #     "limit",
-        # ]
-        # self._update_operators = [
-        #     "woql:AddTriple",
-        #     "woql:DeleteTriple",
-        #     "woql:AddQuad",
-        #     "woql:DeleteQuad",
-        #     "woql:DeleteObject",
-        #     "woql:UpdateObject",
-        # ]
-
         self._vocab = SHORT_NAME_MAPPING
 
         # alias
@@ -157,10 +139,10 @@ def __or__(self, other):
     def _add_sub_query(self, sub_query=None):
         """Internal library function which adds a subquery and sets the cursor"""
         if sub_query:
-            self._cursor["woql:query"] = self._coerce_to_dict(sub_query)
+            self._cursor["query"] = self._coerce_to_dict(sub_query)
         else:
             initial_object = {}
-            self._cursor["woql:query"] = initial_object
+            self._cursor["query"] = initial_object
             self._cursor = initial_object
         return self
 
@@ -172,16 +154,21 @@ def _contains_update_check(self, json=None):
             return False
         if json["@type"] in self._update_operators:
             return True
-        if json.get("woql:consequent") and self._contains_update_check(
-            json["woql:consequent"]
+        if json.get("consequent") and self._contains_update_check(
+            json["consequent"]
         ):
             return True
-        if json.get("woql:query"):
-            return self._contains_update_check(json["woql:query"])
-        if json.get("woql:query_list"):
-            for item in json["woql:query_list"]:
+        if json.get("query"):
+            return self._contains_update_check(json["query"])
+        if json.get("and"):
+            for item in json["and"]:
+                if self._contains_update_check(item):
+                    return True
+        if json.get("or"):
+            for item in json["or"]:
                 if self._contains_update_check(item):
                     return True
+
         return False
 
     def _updated(self):
@@ -204,8 +191,8 @@ def _varj(self, varb):
             varb = varb[2:]
         if type(varb) is str:
             return {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": varb, "@type": "xsd:string"},
+                "@type": "Value",
+                "variable": varb
             }
         return varb
 
@@ -214,45 +201,71 @@ def _coerce_to_dict(self, qobj):
         if hasattr(qobj, "to_dict"):
             return qobj.to_dict()
         if qobj is True:
-            return {"@type": "woql:True"}
+            return {"@type": "True"}
         return qobj
 
+    def _raw_var(self,varb):
+        if varb[:2] == "v:":
+            return varb[2:]
+        return varb
+
+    def _raw_var_list(self,vl):
+        ret = []
+        for v in vl:
+            ret.append(self._raw_var(v))
+        return ret
+
+    def _data_list(self, wvar):
+        # TODO: orig is Nonetype
+        """takes input that can be either a string (variable name)
+        or an array - each element of the array is a member of the list"""
+        if type(wvar) is str:
+            return self._expand_data_variable(wvar, True)
+        if type(wvar) is list:
+            ret = []
+            for item in wvar:
+                co_item = self._clean_data_value(item)
+                ret.append(co_item)
+            return ret
+
+    def _value_list(self, wvar):
+        # TODO: orig is Nonetype
+        """takes input that can be either a string (variable name)
+        or an array - each element of the array is a member of the list"""
+        if type(wvar) is str:
+            return self._expand_value_variable(wvar, True)
+        if type(wvar) is list:
+            ret = []
+            for item in wvar:
+                co_item = self._clean_object(item)
+                ret.append(co_item)
+            return ret
+
     def _asv(self, colname_or_index, vname, obj_type=None):
         """Wraps the elements of an AS variable in the appropriate json-ld"""
         asvar = {}
         if type(colname_or_index) is int:
-            asvar["@type"] = "woql:IndexedAsVar"
-            asvar["woql:index"] = self._jlt(colname_or_index, "xsd:nonNegativeInteger")
+            asvar["@type"] = "Column"
+            asvar["indicator"] = {"@type" : "Indicator", "index" : colname_or_index}
         elif type(colname_or_index) is str:
-            asvar["@type"] = "woql:NamedAsVar"
-            asvar["woql:identifier"] = self._jlt(colname_or_index)
+            asvar["@type"] = "Column"
+            asvar["indicator"] = {"@type" : "Indicator", "name" : colname_or_index}
         if vname[:2] == "v:":
             vname = vname[2:]
-        asvar["woql:variable_name"] = {"@type": "xsd:string", "@value": vname}
+        asvar["variable"] = vname
         if obj_type:
-            asvar["woql:var_type"] = obj_type
+            asvar["type"] = obj_type
         return asvar
 
-    def _add_asv(self, cursor, asv):
-        """Adds a variable to a json-ld as variable list"""
-        if asv["@type"] == "woql:IndexedAsVar":
-            if not cursor["woql:indexed_as_var"]:
-                cursor["woql:indexed_as_var"] = []
-                cursor["woql:indexed_as_var"].append(asv)
-        else:
-            if not cursor["woql:named_as_var"]:
-                cursor["woql:named_as_var"] = []
-                cursor["woql:named_as_var"].append(asv)
-
     def _wfrom(self, opts):
         """JSON LD Format Descriptor"""
         if opts and opts.get("format"):
-            self._cursor["woql:format"] = {
-                "@type": "woql:Format",
-                "woql:format_type": {"@value": opts["format"], "@type": "xsd:string"},
+            self._cursor["format"] = {
+                "@type": "Format",
+                "format_type": {"@value": opts["format"], "@type": "xsd:string"},
             }
             if opts.get("format_header"):
-                self._cursor["woql:format"]["woql:format_header"] = {
+                self._cursor["format"]["format_header"] = {
                     "@value": True,
                     "@type": "xsd:boolean",
                 }
@@ -265,47 +278,23 @@ def _arop(self, arg):
                 return arg.to_dict()
             else:
                 return arg
-        var = self._clean_object(arg, "xsd:decimal")
+        var = self._clean_arithmetic_value(arg, "xsd:decimal")
         return var
 
     def _vlist(self, target_list):
         """Wraps value lists in the appropriate json-ld"""
-        vobj = {"@type": "woql:Array", "woql:array_element": []}
-        if type(target_list) is str:
-            target_list = [target_list]
-        for idx, item in enumerate(target_list):
-            co_item = self._clean_object(item)
-            co_item["@type"] = "woql:ArrayElement"
-            co_item["woql:index"] = self._jlt(idx, "xsd:nonNegativeInteger")
-            vobj["woql:array_element"].append(co_item)
-        return vobj
-
-    def _wlist(self, wvar):
-        # TODO: orig is Nonetype
-        """takes input that can be either a string (variable name)
-        or an array - each element of the array is a member of the list"""
-        if type(wvar) is str:
-            return self._expand_variable(wvar, True)
-        if type(wvar) is list:
-            ret = {"@type": "woql:Array", "woql:array_element": []}
-            for idx, item in enumerate(wvar):
-                co_item = self._clean_object(item)
-                if type(co_item) is str:
-                    co_item = {"node": co_item}
-                co_item["@type"] = "woql:ArrayElement"
-                co_item["woql:index"] = self._jlt(idx, "xsd:nonNegativeInteger")
-                ret["woql:array_element"].append(co_item)
-            return ret
-
-    def _qle(self, query, idx):
-        """Query List Element Constructor"""
-        qobj = self._coerce_to_dict(query)
-        iqle = {
-            "@type": "woql:QueryListElement",
-            "woql:index": self._jlt(idx, "nonNegativeInteger"),
-            "woql:query": qobj,
-        }
-        return iqle
+        vl = []
+        for item in target_list:
+            v = self._expand_value_variable(item)
+            vl.append(v)
+        return vl
+
+    def _data_value_list(self, target_list):
+        dvl = []
+        for item in target_list:
+            o = self.clean_data_value(item)
+            dvl.append(o)
+        return dvl
 
     def _clean_subject(self, obj):
         """Transforms whatever is passed in as the subject into the appropriate json-ld for variable or id"""
@@ -318,8 +307,8 @@ def _clean_subject(self, obj):
             elif self._vocab and (obj in self._vocab):
                 subj = self._vocab[obj]
             else:
-                subj = "doc:" + obj
-            return self._expand_variable(subj)
+                subj = obj
+            return self._expand_node_variable(subj)
         raise ValueError("Subject must be a URI string")
 
     def _clean_predicate(self, predicate):
@@ -335,8 +324,8 @@ def _clean_predicate(self, predicate):
         elif self._vocab and (predicate in self._vocab):
             pred = self._vocab[predicate]
         else:
-            pred = "scm:" + predicate
-        return self._expand_variable(pred)
+            pred = predicate
+        return self._expand_node_variable(pred)
 
     def _clean_path_predicate(self, predicate=None):
         pred = False
@@ -346,66 +335,129 @@ def _clean_path_predicate(self, predicate=None):
             elif self._vocab and (predicate in self._vocab):
                 pred = self._vocab[predicate]
             else:
-                pred = "scm:" + predicate
+                pred = predicate
         return pred
 
     def _clean_object(self, user_obj, target=None):
         """Transforms whatever is passed in as the object of a triple into the appropriate json-ld form (variable, literal or id)"""
-        obj = {"@type": "woql:Datatype"}
+        obj = {"@type": "Value"}
         if type(user_obj) is str:
-            if self._looks_like_class(user_obj):
-                return self._clean_class(user_obj)
-            elif self._vocab and (user_obj in self._vocab):
-                return self._clean_class(self._vocab[user_obj])
+            if user_obj[:2] == "v:":
+                return self._expand_value_variable(user_obj)
             else:
-                obj["woql:datatype"] = self._jlt(user_obj, target)
+                obj["node"] = user_obj
         elif type(user_obj) is float:
             if not target:
                 target = "xsd:decimal"
-            obj["woql:datatype"] = self._jlt(user_obj, target)
+            obj["data"] = self._jlt(user_obj, target)
         elif type(user_obj) is int:
             if not target:
                 target = "xsd:integer"
-            obj["woql:datatype"] = self._jlt(user_obj, target)
+            obj["data"] = self._jlt(user_obj, target)
         elif type(user_obj) is bool:
             if not target:
                 target = "xsd:boolean"
-            obj["woql:datatype"] = self._jlt(user_obj, target)
+            obj["data"] = self._jlt(user_obj, target)
         elif isinstance(user_obj, dt.date):
             if not target:
                 target = "xsd:dateTime"
-            obj["woql:datatype"] = self._jlt(user_obj.isoformat(), target)
+            obj["data"] = self._jlt(user_obj.isoformat(), target)
         elif type(user_obj) is dict:
             if "@value" in user_obj:
-                obj["woql:datatype"] = user_obj
+                obj["data"] = user_obj
             else:
                 return user_obj
         else:
-            obj["woql:datatype"] = self._jlt(str(user_obj))
+            obj["data"] = self._jlt(str(user_obj))
         return obj
 
-    def _looks_like_class(self, cstring):
-        if ":" not in cstring:
-            return False
-        pref = cstring.split(":")[0]
-        if (
-            pref == "v"
-            or pref == "scm"
-            or pref == "doc"
-            or pref == "terminusdb"
-            or pref == "http"
-            or pref == "https"
-        ):
-            return True
-        if utils.STANDARD_URLS.get(pref):
-            return True
-        return False
+    def _clean_data_value(self, user_obj, target=None):
+        """Transforms whatever is passed in as the object of a triple into the appropriate json-ld form (variable, literal or id)"""
+        obj = {"@type": "DataValue"}
+        if type(user_obj) is str:
+            if user_obj[:2] == "v:":
+                return self._expand_data_variable(user_obj)
+            else:
+                if not target:
+                    target = "xsd:string"
+                obj["data"] = self._jlt(user_obj, target)
+        elif type(user_obj) is float:
+            if not target:
+                target = "xsd:decimal"
+            obj["data"] = self._jlt(user_obj, target)
+        elif type(user_obj) is int:
+            if not target:
+                target = "xsd:integer"
+            obj["data"] = self._jlt(user_obj, target)
+        elif type(user_obj) is bool:
+            if not target:
+                target = "xsd:boolean"
+            obj["data"] = self._jlt(user_obj, target)
+        elif isinstance(user_obj, dt.date):
+            if not target:
+                target = "xsd:dateTime"
+            obj["data"] = self._jlt(user_obj.isoformat(), target)
+        elif type(user_obj) is dict:
+            if "@value" in user_obj:
+                obj["data"] = user_obj
+            else:
+                return user_obj
+        else:
+            obj["data"] = self._jlt(str(user_obj))
+        return obj
+
+    def _clean_arithmetic_value(self, user_obj, target=None):
+        """Transforms whatever is passed in as the object of a triple into the appropriate json-ld form (variable, literal or id)"""
+        obj = {"@type": "ArithmeticValue"}
+        if type(user_obj) is str:
+            if user_obj[:2] == "v:":
+                return self._expand_arithmetic_variable(user_obj)
+            else:
+                obj["data"] = self._jlt(user_obj, target)
+        elif type(user_obj) is float:
+            if not target:
+                target = "xsd:decimal"
+            obj["data"] = self._jlt(user_obj, target)
+        elif type(user_obj) is int:
+            if not target:
+                target = "xsd:integer"
+            obj["data"] = self._jlt(user_obj, target)
+        elif type(user_obj) is bool:
+            if not target:
+                target = "xsd:boolean"
+            obj["data"] = self._jlt(user_obj, target)
+        elif isinstance(user_obj, dt.date):
+            if not target:
+                target = "xsd:dateTime"
+            obj["data"] = self._jlt(user_obj.isoformat(), target)
+        elif type(user_obj) is dict:
+            if "@value" in user_obj:
+                obj["data"] = user_obj
+            else:
+                return user_obj
+        else:
+            obj["data"] = self._jlt(str(user_obj))
+        return obj
+
+    def _clean_node_value(self, user_obj, target=None):
+        """Transforms whatever is passed in as the object of a triple into the appropriate json-ld form (variable, literal or id)"""
+        obj = {"@type": "NodeValue"}
+        if type(user_obj) is str:
+            if user_obj[:2] == "v:":
+                return self._expand_node_variable(user_obj)
+            else:
+                obj["node"] = user_obj
+        elif type(user_obj) is dict:
+            return user_obj
+        else:
+            obj["node"] = user_obj
+        return obj
 
     def _clean_graph(self, graph):
-        """Transforms a graph filter or graph id into the proper json-ld form"""
-        return {"@type": "xsd:string", "@value": graph}
+        """Transforms a graph filter by doing nothing"""
+        return graph
 
-    def _expand_variable(self, varname, always=False):
+    def _expand_variable(self, varname, target_type, always=False):
         """Transforms strings that start with v: into variable json-ld structures
 
         Parameters
@@ -419,48 +471,23 @@ def _expand_variable(self, varname, always=False):
             if varname[:2] == "v:":
                 varname = varname[2:]
             return {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": varname, "@type": "xsd:string"},
+                "@type": target_type,
+                "variable": varname
             }
         else:
-            return {"@type": "woql:Node", "woql:node": varname}
-
-    def _clean_class(self, user_class=None, string_only=None):
-        if type(user_class) != str:
-            return ""
-        if ":" not in user_class:
-            if self._vocab and (user_class in self._vocab):
-                user_class = self._vocab[user_class]
-            else:
-                user_class = "scm:" + user_class
-        if string_only:
-            return user_class
-        else:
-            return self._expand_variable(user_class)
-
-    def _clean_type(self, user_type=None, string_only=None):
-        return self._clean_class(user_type, string_only)
-
-    def _default_context(self, db_iri):
-        default = copy.copy(utils.STANDARD_URLS)
-        default["scm"] = db_iri + "/schema#"
-        default["doc"] = db_iri + "/data/"
-        return default
-
-    def _get_context(self, query=None):
-        """Retrieves the value of the current json-ld context"""
-        if not query:
-            query = self._query
-        for prop in query:
-            if prop in self._paging_transitive_properties:
-                native_query = query[prop][1]
-                native_context = self._get_context(native_query)
-                if native_context:
-                    return native_context
-
-    def _context(self, current_context):
-        """Retrieves the value of the current json-ld context"""
-        self._cursor["@context"] = current_context
+            return {"@type": target_type, "node": varname}
+
+    def _expand_value_variable(self,varname,always=False):
+        return self._expand_variable(varname,'Value',always)
+
+    def _expand_node_variable(self,varname,always=False):
+        return self._expand_variable(varname,'NodeValue',always)
+
+    def _expand_data_variable(self,varname,always=False):
+        return self._expand_variable(varname,'DataValue',always)
+
+    def _expand_arithmetic_variable(self,varname,always=False):
+        return self._expand_variable(varname,'ArithmeticValue',always)
 
     def execute(self, client, commit_msg=None, file_dict=None):
         """Executes the query using the passed client to connect to a server
@@ -508,56 +535,68 @@ def from_dict(self, dictdata):
         return self
 
     def _find_last_subject(self, json):
-        """Finds the last woql element that has a woql:subject in it and returns the json for that
+        """Finds the last woql element that has a subject in it and returns the json for that
         used for triplebuilder to chain further calls - when they may be inside ands or ors or subqueries
 
         Parameters
         ----------
         json : dict
                dictionary that representing the query in josn-ld"""
-        if "woql:query_list" in json:
-            for item in json["woql:query_list"][::-1]:
+        if "and" in json:
+            for item in json["and"][::-1]:
+                subitem = self._find_last_subject(item)
+                if subitem:
+                    return subitem
+        if "or" in json:
+            for item in json["or"][::-1]:
                 subitem = self._find_last_subject(item)
                 if subitem:
                     return subitem
-        if "woql:query" in json:
-            item = self._find_last_subject(json["woql:query"])
+
+        if "query" in json:
+            item = self._find_last_subject(json["query"])
             if item:
                 return item
-        if "woql:subject" in json:
+        if "subject" in json:
             return json
         return False
 
     def _find_last_property(self, json):
-        """Finds the last woql property that has a woql:subject in it and returns the json for that
+        """Finds the last woql property that has a subject in it and returns the json for that
         used for triplebuilder to chain further calls - when they may be inside ands or ors or subqueries
 
         Parameters
         ----------
         json : dict
                dictionary that representing the query in josn-ld"""
-        if "woql:query_list" in json:
-            for item in json["woql:query_list"][::-1]:
+        if "and" in json:
+            for item in json["and"][::-1]:
+                subitem = self._find_last_property(item)
+                if subitem:
+                    return subitem
+        if "or" in json:
+            for item in json["or"][::-1]:
                 subitem = self._find_last_property(item)
                 if subitem:
                     return subitem
-        if "woql:query" in json:
-            item = self._find_last_property(json["woql:query"])
+
+        if "query" in json:
+            item = self._find_last_property(json["query"])
             if item:
                 return item
-        if "woql:subject" in json and self._is_property_triple(
-            json.get("woql:predicate"), json.get("woql:object")
+        if "subject" in json and self._is_property_triple(
+            json.get("predicate"), json.get("object")
         ):
             return json
         return False
 
     def _is_property_triple(self, pred, obj):
         if isinstance(pred, dict):
-            p = pred.get("woql:node")
+            p = pred.get("node")
         else:
             p = pred
         if isinstance(obj, dict):
-            o = obj.get("woql:node")
+            o = obj.get("node")
         else:
             o = obj
         if o == "owl:ObjectProperty" or o == "owl:DatatypeProperty":
@@ -577,7 +616,7 @@ def _compile_path_pattern(self, pat):
     def load_vocabulary(self, client):
         """Queries the schema graph and loads all the ids found there as vocabulary that can be used without prefixes
         ignoring blank node ids"""
-        new_woql = WOQLQuery().quad("v:S", "v:P", "v:O", "schema/*")
+        new_woql = WOQLQuery().quad("v:S", "v:P", "v:O", "schema")
         result = new_woql.execute(client)
         bindings = result.get("bindings", [])
         for each_result in bindings:
@@ -588,30 +627,29 @@ def load_vocabulary(self, client):
                         self._vocab[spl[0]] = spl[1]
 
     def _wrap_cursor_with_and(self):
-        if self._cursor.get("@type") == "woql:And" and self._cursor.get(
-            "woql:query_list"
+        if self._cursor.get("@type") == "And" and self._cursor.get(
+            "and"
         ):
-            next_item = len(self._cursor.get("woql:query_list"))
+            next_item = len(self._cursor.get("and"))
             self.woql_and({})
-            self._cursor = self._cursor["woql:query_list"][next_item]["woql:query"]
+            self._cursor = self._cursor["and"][next_item]
         else:
             new_json = WOQLQuery().from_dict(self._cursor)
             self._cursor.clear()
             self.woql_and(new_json, {})
-            self._cursor = self._cursor["woql:query_list"][1]["woql:query"]
+            self._cursor = self._cursor["and"][1]
 
     def using(self, collection, subq=None):
-        if collection and collection == "woql:args":
-            return ["woql:collection", "woql:query"]
+        if collection and collection == "args":
+            return ["collection", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Using"
+        self._cursor["@type"] = "Using"
         if not collection or type(collection) != str:
             raise ValueError(
                 "The first parameter to using must be a Collection ID (string)"
             )
-        self._cursor["woql:collection"] = self._jlt(collection)
-        self._cursor["@context"] = "/api/prefixes/" + collection
+        self._cursor["collection"] = collection
         return self._add_sub_query(subq)
 
     def comment(self, comment, subq=None):
@@ -626,12 +664,12 @@ def comment(self, comment, subq=None):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if comment and comment == "woql:args":
-            return ["woql:comment", "woql:query"]
+        if comment and comment == "args":
+            return ["comment", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Comment"
-        self._cursor["woql:comment"] = self._jlt(comment)
+        self._cursor["@type"] = "Comment"
+        self._cursor["comment"] = self._jlt(comment)
         return self._add_sub_query(subq)
 
     def select(self, *args):
@@ -649,11 +687,11 @@ def select(self, *args):
         """
         """Select the set of variables that the result will return"""
         queries = list(args)
-        if queries and queries[0] == "woql:args":
-            return ["woql:variable_list", "woql:query"]
+        if queries and queries[0] == "args":
+            return ["variables", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Select"
+        self._cursor["@type"] = "Select"
         if queries != [] and not queries:
             raise ValueError("Select must be given a list of variable names")
         if queries == []:
@@ -662,12 +700,7 @@ def select(self, *args):
             embedquery = queries.pop()
         else:
             embedquery = False
-        self._cursor["woql:variable_list"] = []
-        for idx, item in enumerate(queries):
-            onevar = self._varj(item)
-            onevar["@type"] = "woql:VariableListElement"
-            onevar["woql:index"] = self._jlt(idx, "nonNegativeInteger")
-            self._cursor["woql:variable_list"].append(onevar)
+        self._cursor["variables"] = self._raw_var_list(queries)
         return self._add_sub_query(embedquery)
 
     def distinct(self, *args):
@@ -685,11 +718,11 @@ def distinct(self, *args):
         """
         """Select the set of variables that the result will return"""
         queries = list(args)
-        if queries and queries[0] == "woql:args":
-            return ["woql:variable_list", "woql:query"]
+        if queries and queries[0] == "args":
+            return ["variables", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Distinct"
+        self._cursor["@type"] = "Distinct"
         if queries != [] and not queries:
             raise ValueError("Distinct must be given a list of variable names")
         if queries == []:
@@ -698,12 +731,7 @@ def distinct(self, *args):
             embedquery = queries.pop()
         else:
             embedquery = False
-        self._cursor["woql:variable_list"] = []
-        for idx, item in enumerate(queries):
-            onevar = self._varj(item)
-            onevar["@type"] = "woql:VariableListElement"
-            onevar["woql:index"] = self._jlt(idx, "nonNegativeInteger")
-            self._cursor["woql:variable_list"].append(onevar)
+        self._cursor["variables"] = self._raw_var_list(queries)
         return self._add_sub_query(embedquery)
 
     def woql_and(self, *args):
@@ -719,32 +747,28 @@ def woql_and(self, *args):
             query object that can be chained and/or execute
         """
         queries = list(args)
-        if self._cursor.get("@type") and self._cursor["@type"] != "woql:And":
+        if self._cursor.get("@type") and self._cursor["@type"] != "And":
             new_json = WOQLQuery().from_dict(self._cursor)
             self._cursor.clear()
             queries = [new_json] + queries
-        if queries and queries[0] == "woql:args":
-            return ["woql:query_list"]
-        self._cursor["@type"] = "woql:And"
-        if "woql:query_list" not in self._cursor:
-            self._cursor["woql:query_list"] = []
+        if queries and queries[0] == "args":
+            return ["and"]
+        self._cursor["@type"] = "And"
+        if "and" not in self._cursor:
+            self._cursor["and"] = []
         for item in queries:
-            index = len(self._cursor["woql:query_list"])
-            onevar = self._qle(item, index)
+            onevar = self._coerce_to_dict(item)
             if (
-                "woql:query" in onevar
-                and "@type" in onevar["woql:query"]
-                and "woql:query_list" in onevar["woql:query"]
-                and onevar["woql:query"]["@type"] == "woql:And"
+                "@type" in onevar
+                and onevar["@type"] == "And"
+                and onevar['and']
             ):
-                for each in onevar["woql:query"]["woql:query_list"]:
-                    qjson = each["woql:query"]
-                    if qjson:
-                        index = len(self._cursor["woql:query_list"])
-                        subvar = self._qle(qjson, index)
-                        self._cursor["woql:query_list"].append(subvar)
+                for each in onevar["and"]:
+                    if each:
+                        subvar = self._coerce_to_dict(each)
+                        self._cursor["and"].append(subvar)
             else:
-                self._cursor["woql:query_list"].append(onevar)
+                self._cursor["and"].append(onevar)
         return self
 
     def woql_or(self, *args):
@@ -760,16 +784,16 @@ def woql_or(self, *args):
             query object that can be chained and/or execute
         """
         queries = list(args)
-        if queries and queries[0] == "woql:args":
-            return ["woql:query_list"]
+        if queries and queries[0] == "args":
+            return ["or"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Or"
-        if "woql:query_list" not in self._cursor:
-            self._cursor["woql:query_list"] = []
-        for idx, item in enumerate(queries):
-            onevar = self._qle(item, idx)
-            self._cursor["woql:query_list"].append(onevar)
+        self._cursor["@type"] = "Or"
+        if "or" not in self._cursor:
+            self._cursor["or"] = []
+        for item in queries:
+            onevar = self._coerce_to_dict(item)
+            self._cursor["or"].append(onevar)
         return self
 
     def woql_from(self, graph_filter, query=None):
@@ -786,16 +810,16 @@ def woql_from(self, graph_filter, query=None):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if graph_filter and graph_filter == "woql:args":
-            return ["woql:graph_filter", "woql:query"]
+        if graph_filter and graph_filter == "args":
+            return ["graph_filter", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:From"
+        self._cursor["@type"] = "From"
         if not graph_filter or type(graph_filter) != str:
             raise ValueError(
                 "The first parameter to from must be a Graph Filter Expression (string)"
             )
-        self._cursor["woql:graph_filter"] = self._jlt(graph_filter)
+        self._cursor["graph_filter"] = graph_filter
         return self._add_sub_query(query)
 
     def into(self, graph_descriptor, query):
@@ -812,16 +836,16 @@ def into(self, graph_descriptor, query):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if graph_descriptor and graph_descriptor == "woql:args":
-            return ["woql:graph", "woql:query"]
+        if graph_descriptor and graph_descriptor == "args":
+            return ["graph", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Into"
+        self._cursor["@type"] = "Into"
         if not graph_descriptor or type(graph_descriptor) != str:
             raise ValueError(
                 "The first parameter to from must be a Graph Filter Expression (string)"
             )
-        self._cursor["woql:graph"] = self._jlt(graph_descriptor)
+        self._cursor["graph"] = graph_descriptor
         return self._add_sub_query(query)
 
     def triple(self, sub, pred, obj, opt=False):
@@ -830,11 +854,11 @@ def triple(self, sub, pred, obj, opt=False):
         Parameters
         ----------
         sub : str
-            Subject
+            Subject, has to be a node (URI)
         pred : str
-            Predicate
+            Predicate, can be variable (prefix with "v:") or node
         obj : str
-            Object
+            Object, can be variable or node or value
         opt : bool
             weather or not this triple is optional, default to be False
 
@@ -847,10 +871,10 @@ def triple(self, sub, pred, obj, opt=False):
             return self.opt().triple(sub, pred, obj)
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Triple"
-        self._cursor["woql:subject"] = self._clean_subject(sub)
-        self._cursor["woql:predicate"] = self._clean_predicate(pred)
-        self._cursor["woql:object"] = self._clean_object(obj)
+        self._cursor["@type"] = "Triple"
+        self._cursor["subject"] = self._clean_subject(sub)
+        self._cursor["predicate"] = self._clean_predicate(pred)
+        self._cursor["object"] = self._clean_object(obj)
         return self
 
     def added_triple(self, sub, pred, obj, opt=False):
@@ -876,10 +900,10 @@ def added_triple(self, sub, pred, obj, opt=False):
             return self.opt().triple(sub, pred, obj)
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:AddedTriple"
-        self._cursor["woql:subject"] = self._clean_subject(sub)
-        self._cursor["woql:predicate"] = self._clean_predicate(pred)
-        self._cursor["woql:object"] = self._clean_object(obj)
+        self._cursor["@type"] = "AddedTriple"
+        self._cursor["subject"] = self._clean_subject(sub)
+        self._cursor["predicate"] = self._clean_predicate(pred)
+        self._cursor["object"] = self._clean_object(obj)
         return self
 
     def removed_triple(self, sub, pred, obj, opt=False):
@@ -905,10 +929,10 @@ def removed_triple(self, sub, pred, obj, opt=False):
             return self.opt().triple(sub, pred, obj)
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:RemovedTriple"
-        self._cursor["woql:subject"] = self._clean_subject(sub)
-        self._cursor["woql:predicate"] = self._clean_predicate(pred)
-        self._cursor["woql:object"] = self._clean_object(obj)
+        self._cursor["@type"] = "RemovedTriple"
+        self._cursor["subject"] = self._clean_subject(sub)
+        self._cursor["predicate"] = self._clean_predicate(pred)
+        self._cursor["object"] = self._clean_object(obj)
         return self
 
     def quad(self, sub, pred, obj, graph, opt=False):
@@ -937,14 +961,14 @@ def quad(self, sub, pred, obj, graph, opt=False):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         arguments = self.triple(sub, pred, obj)
-        if sub and sub == "woql:args":
-            return arguments.append("woql:graph_filter")
+        if sub and sub == "args":
+            return arguments.append("graph_filter")
         if not graph:
             raise ValueError(
                 "Quad takes four parameters, the last should be a graph filter"
             )
-        self._cursor["@type"] = "woql:Quad"
-        self._cursor["woql:graph_filter"] = self._clean_graph(graph)
+        self._cursor["@type"] = "Triple"
+        self._cursor["graph_filter"] = self._clean_graph(graph)
         return self
 
     def added_quad(self, sub, pred, obj, graph, opt=False):
@@ -973,14 +997,14 @@ def added_quad(self, sub, pred, obj, graph, opt=False):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         arguments = self.triple(sub, pred, obj)
-        if sub and sub == "woql:args":
-            return arguments.append("woql:graph_filter")
+        if sub and sub == "args":
+            return arguments.append("graph_filter")
         if not graph:
             raise ValueError(
                 "Quad takes four parameters, the last should be a graph filter"
             )
-        self._cursor["@type"] = "woql:AddedQuad"
-        self._cursor["woql:graph_filter"] = self._clean_graph(graph)
+        self._cursor["@type"] = "AddedTriple"
+        self._cursor["graph_filter"] = self._clean_graph(graph)
         return self
 
     def removed_quad(self, sub, pred, obj, graph, opt=False):
@@ -1009,14 +1033,14 @@ def removed_quad(self, sub, pred, obj, graph, opt=False):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         arguments = self.triple(sub, pred, obj)
-        if sub and sub == "woql:args":
-            return arguments.append("woql:graph_filter")
+        if sub and sub == "args":
+            return arguments.append("graph_filter")
         if not graph:
             raise ValueError(
                 "Quad takes four parameters, the last should be a graph filter"
             )
-        self._cursor["@type"] = "woql:RemovedQuad"
-        self._cursor["woql:graph_filter"] = self._clean_graph(graph)
+        self._cursor["@type"] = "DeletedTriple"
+        self._cursor["graph_filter"] = self._clean_graph(graph)
         return self
 
     def string(self, input_str):
@@ -1076,8 +1100,8 @@ def literal(self, input_val, input_type):
 
     def iri(self, varname):
         return {
-            "@type": "woql:Node",
-            "woql:node": varname,
+            "@type": "NodeValue",
+            "node": varname,
         }
 
     def sub(self, parent, child):
@@ -1094,15 +1118,15 @@ def sub(self, parent, child):
         -------
         bool
         """
-        if parent and parent == "woql:args":
-            return ["woql:parent", "woql:child"]
+        if parent and parent == "args":
+            return ["parent", "child"]
         if parent is None or child is None:
             raise ValueError("Subsumption takes two parameters, both URIs")
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Subsumption"
-        self._cursor["woql:parent"] = self._clean_class(parent)
-        self._cursor["woql:child"] = self._clean_class(child)
+        self._cursor["@type"] = "Subsumption"
+        self._cursor["parent"] = self._clean_node_value(parent)
+        self._cursor["child"] = self._clean_node_value(child)
         return self
 
     def eq(self, left, right):
@@ -1118,25 +1142,25 @@ def eq(self, left, right):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if left and left == "woql:args":
-            return ["woql:left", "woql:right"]
+        if left and left == "args":
+            return ["left", "right"]
         if left is None or right is None:
             raise ValueError("Equals takes two parameters")
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Equals"
-        self._cursor["woql:left"] = self._clean_object(left)
-        self._cursor["woql:right"] = self._clean_object(right)
+        self._cursor["@type"] = "Equals"
+        self._cursor["left"] = self._clean_object(left)
+        self._cursor["right"] = self._clean_object(right)
         return self
 
     def substr(self, string, length, substring, before=0, after=0):
-        if string and string == "woql:args":
+        if string and string == "args":
             return [
-                "woql:string",
-                "woql:before",
-                "woql:length",
-                "woql:after",
-                "woql:substring",
+                "string",
+                "before",
+                "length",
+                "after",
+                "substring",
             ]
         if not substring:
             substring = length
@@ -1147,83 +1171,87 @@ def substr(self, string, length, substring, before=0, after=0):
             )
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Substring"
-        self._cursor["woql:string"] = self._clean_object(string)
-        self._cursor["woql:before"] = self._clean_object(
+        self._cursor["@type"] = "Substring"
+        self._cursor["string"] = self._clean_data_value(string, "xsd:string")
+        self._cursor["before"] = self._clean_data_value(
             before, "xsd:nonNegativeInteger"
         )
-        self._cursor["woql:length"] = self._clean_object(
+        self._cursor["length"] = self._clean_data_value(
             length, "xsd:nonNegativeInteger"
         )
-        self._cursor["woql:after"] = self._clean_object(after, "xsd:nonNegativeInteger")
-        self._cursor["woql:substring"] = self._clean_object(substring)
+        self._cursor["after"] = self._clean_data_value(after, "xsd:nonNegativeInteger")
+        self._cursor["substring"] = self._clean_datat_value(substring, "xsd:string")
         return self
 
     def update_object(self, docjson):
-        if docjson and docjson == "woql:args":
-            return ["woql:document"]
+        if docjson and docjson == "args":
+            return ["document"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:UpdateObject"
-        self._cursor["woql:document"] = docjson
+        self._cursor["@type"] = "UpdateObject"
+        if isinstance(input_obj, str):
+            doc = self._expand_data_value(input_obj)
+        else:
+            doc = input_obj
+        self._cursor["document"] = doc
         return self._updated()
 
     def delete_object(self, json_or_iri):
-        if json_or_iri and json_or_iri == "woql:args":
-            return ["woql:document"]
+        if json_or_iri and json_or_iri == "args":
+            return ["document"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:DeleteObject"
-        self._cursor["woql:document_uri"] = json_or_iri
+        self._cursor["@type"] = "DeleteObject"
+        self._cursor["document_uri"] = self._clean_node_value(json_or_iri)
         return self._updated()
 
     def read_object(self, iri, output_var):
-        if iri and iri == "woql:args":
-            return ["woql:document"]
+        if iri and iri == "args":
+            return ["document"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:ReadObject"
-        self._cursor["woql:document_uri"] = iri
-        self._cursor["woql:document"] = self._expand_variable(output_var)
+        self._cursor["@type"] = "ReadObject"
+        self._cursor["document_uri"] = iri
+        self._cursor["document"] = self._expand_data_variable(output_var)
         return self
 
     def get(self, as_vars, query_resource=None):
         """Takes an as structure"""
-        if as_vars and as_vars == "woql:args":
-            return ["woql:as_vars", "woql:query_resource"]
-        self._cursor["@type"] = "woql:Get"
+        if as_vars and as_vars == "args":
+            return ["columns", "resource"]
+        self._cursor["@type"] = "Get"
         if hasattr(as_vars, "to_dict"):
-            self._cursor["woql:as_vars"] = as_vars.to_dict()
+            self._cursor["columns"] = as_vars.to_dict()
         else:
-            self._cursor["woql:as_vars"] = WOQLQuery().woql_as(*as_vars).to_dict()
+            self._cursor["columns"] = WOQLQuery().woql_as(*as_vars).to_dict()
         if query_resource:
-            self._cursor["woql:query_resource"] = self._coerce_to_dict(query_resource)
+            self._cursor["resource"] = self._coerce_to_dict(query_resource)
         else:
-            self._cursor["woql:query_resource"] = {}
-        self._cursor = self._cursor["woql:query_resource"]
+            self._cursor["resource"] = {}
+        self._cursor = self._cursor["resource"]
         return self
 
     def put(self, as_vars, query, query_resource=None):
         """Takes an array of variables, an optional array of column names"""
-        if as_vars and as_vars == "woql:args":
-            return ["woql:as_vars", "woql:query", "woql:query_resource"]
+        if as_vars and as_vars == "args":
+            return ["columns", "query", "resource"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Put"
+        self._cursor["@type"] = "Put"
         if hasattr(as_vars, "to_dict"):
-            self._cursor["woql:as_vars"] = as_vars.to_dict()
+            self._cursor["columns"] = as_vars.to_dict()
         else:
-            self._cursor["woql:as_vars"] = WOQLQuery().woql_as(*as_vars).to_dict()
-        self._cursor["woql:query"] = self._coerce_to_dict(query)
+            self._cursor["columns"] = WOQLQuery().woql_as(*as_vars).to_dict()
+        self._cursor["query"] = self._coerce_to_dict(query)
         if query_resource:
-            self._cursor["woql:query_resource"] = self._coerce_to_dict(query_resource)
+            self._cursor["resource"] = self._coerce_to_dict(query_resource)
         else:
-            self._cursor["woql:query_resource"] = {}
+            self._cursor["resource"] = {}
         return self
 
     def woql_as(self, *args):
-        if args and args[0] == "woql:args":
-            return [["woql:indexed_as_var", "woql:named_as_var"]]
+        if args and args[0] == "args":
+            return [["indexed_as_var", "named_as_var"]]
         if type(self._query) is not list:
             self._query = []
         if type(args[0]) is list:
@@ -1282,12 +1310,16 @@ def file(self, fpath, opts=None):
         """
         if opts is None:
             opts = []
-        if fpath and fpath == "woql:args":
-            return ["woql:file", "woql:format"]
+        if fpath and fpath == "args":
+            return ["source", "format"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:FileResource"
-        self._cursor["woql:file"] = fpath
+        self._cursor["@type"] = "QueryResource"
+        fpath['@type'] = 'Source'
+        self._cursor["source"] = fpath
+        self._cursor["format"] = "csv"
+        if opts:
+            self._cursor["options"] = opts
         return self._wfrom(opts)
 
     def once(self, query=None):
@@ -1302,20 +1334,22 @@ def once(self, query=None):
         WOQLQuery object
             query object that can be chained and/or executed
         """
-        if query and query == "woql:args":
-            return ["woql:query"]
+        if query and query == "args":
+            return ["query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Once"
+        self._cursor["@type"] = "Once"
         return self._add_sub_query(query)
 
-    def remote(self, uri, opts=None):
+    def remote(self, uri, fmt="csv", opts=None):
         """Provides details of a remote data source in a JSON format that includes a URL property
 
         Parameters
         ----------
         uri : str
             remote data source
+        fmt : str
+            file format, one of ["csv"]
         opts : input options
             optional
 
@@ -1341,22 +1375,30 @@ def remote(self, uri, opts=None):
         file
             If your csv file is local then use :meth:`.file` instead of `.remote`.
         """
-        if uri and uri == "woql:args":
-            return ["woql:remote_uri", "woql:format"]
+        if uri and uri == "args":
+            return ["source", "format", "options"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:RemoteResource"
-        self._cursor["woql:remote_uri"] = {"@type": "xsd:anyURI", "@value": uri}
-        return self._wfrom(opts)
+        self._cursor["@type"] = "QueryResource"
+        uri['@type'] = 'Source'
+        self._cursor['source'] = uri
+        self._cursor['format'] = "csv"
+        if opts:
+            self._cursor['options'] = opts
+        return self
 
-    def post(self, fpath, opts=None):
-        if fpath and fpath == "woql:args":
-            return ["woql:file", "woql:format"]
+    def post(self, fpath, fmt="csv", opts=None):
+        if fpath and fpath == "args":
+            return ["source", "format", "options"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:PostResource"
-        self._cursor["woql:file"] = {"@type": "xsd:string", "@value": fpath}
-        return self._wfrom(opts)
+        self._cursor["@type"] = "QueryResource"
+        fpath['@type'] = 'Source'
+        self._cursor['source'] = fpath
+        self._cursor['format'] = fmt
+        if opts:
+            self._cursor['options'] = opts
+        return self
 
     def delete_triple(self, subject, predicate, object_or_literal):
         """Deletes any triples that match the rule [subject, predicate, object]
@@ -1393,9 +1435,9 @@ def delete_triple(self, subject, predicate, object_or_literal):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         triple_args = self.triple(subject, predicate, object_or_literal)
-        if subject and subject == "woql:args":
+        if subject and subject == "args":
             return triple_args
-        self._cursor["@type"] = "woql:DeleteTriple"
+        self._cursor["@type"] = "DeleteTriple"
         return self._updated()
 
     def add_triple(self, subject, predicate, object_or_literal):
@@ -1436,9 +1478,9 @@ def add_triple(self, subject, predicate, object_or_literal):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         triple_args = self.triple(subject, predicate, object_or_literal)
-        if subject and subject == "woql:args":
+        if subject and subject == "args":
             return triple_args
-        self._cursor["@type"] = "woql:AddTriple"
+        self._cursor["@type"] = "AddTriple"
         return self._updated()
 
     def update_triple(self, subject, predicate, new_object):
@@ -1475,14 +1517,14 @@ def delete_quad(self, subject, predicate, object_or_literal, graph=None):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         triple_args = self.triple(subject, predicate, object_or_literal)
-        if subject and subject == "woql:args":
-            return triple_args.append("woql:graph")
+        if subject and subject == "args":
+            return triple_args.append("graph")
         if not graph:
             raise ValueError(
                 "Delete Quad takes four parameters, the last should be a graph id"
             )
-        self._cursor["@type"] = "woql:DeleteQuad"
-        self._cursor["woql:graph"] = self._clean_graph(graph)
+        self._cursor["@type"] = "DeleteTriple"
+        self._cursor["graph"] = self._clean_graph(graph)
         return self._updated()
 
     def add_quad(self, subject, predicate, object_or_literal, graph):
@@ -1507,14 +1549,14 @@ def add_quad(self, subject, predicate, object_or_literal, graph):
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
         triple_args = self.triple(subject, predicate, object_or_literal)
-        if subject and subject == "woql:args":
-            return triple_args.concat(["woql:graph"])
+        if subject and subject == "args":
+            return triple_args.concat(["graph"])
         if not graph:
             raise ValueError(
                 "Delete Quad takes four parameters, the last should be a graph id"
             )
-        self._cursor["@type"] = "woql:AddQuad"
-        self._cursor["woql:graph"] = self._clean_graph(graph)
+        self._cursor["@type"] = "AddTriple"
+        self._cursor["graph"] = self._clean_graph(graph)
         return self._updated()
 
     def update_quad(self, subject, predicate, new_object, graph):
@@ -1529,38 +1571,6 @@ def update_quad(self, subject, predicate, new_object, graph):
             WOQLQuery().add_quad(subject, predicate, new_object, graph),
         )
 
-    def when(self, query, consequent=None):
-        """When the sub-query in Condition is met, the Update query is executed
-
-        Parameters
-        ----------
-        query : WOQLQuery object or bool
-        consequent : WOQLQuery object, optional
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-
-        Notes
-        -----
-        Functions which take a query as an argument advance the cursor to make the chaining of queries fall
-        into the corrent place in the encompassing json
-        """
-        if query and query == "woql:args":
-            return ["woql:query", "woql:consequent"]
-        if self._cursor.get("@type"):
-            self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:When"
-        self._add_sub_query(query)
-        if consequent:
-            newv = self._coerce_to_dict(consequent)
-        else:
-            newv = {}
-        self._cursor["woql:consequent"] = newv
-        self._cursor = newv
-        return self
-
     def trim(self, untrimmed, trimmed):
         """A trimmed version of untrimmed (with leading and trailing whitespace removed) is copied into trimmed
 
@@ -1576,13 +1586,13 @@ def trim(self, untrimmed, trimmed):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if untrimmed and untrimmed == "woql:args":
-            return ["woql:untrimmed", "woql:trimmed"]
+        if untrimmed and untrimmed == "args":
+            return ["untrimmed", "trimmed"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Trim"
-        self._cursor["woql:untrimmed"] = self._clean_object(untrimmed)
-        self._cursor["woql:trimmed"] = self._clean_object(trimmed)
+        self._cursor["@type"] = "Trim"
+        self._cursor["untrimmed"] = self._clean_data_value(untrimmed)
+        self._cursor["trimmed"] = self._clean_data_value(trimmed)
         return self
 
     def eval(self, arith, res):
@@ -1600,16 +1610,16 @@ def eval(self, arith, res):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if arith and arith == "woql:args":
-            return ["woql:expression", "woql:result"]
+        if arith and arith == "args":
+            return ["expression", "result"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Eval"
+        self._cursor["@type"] = "Eval"
         if hasattr(arith, "to_dict"):
-            self._cursor["woql:expression"] = arith.to_dict()
+            self._cursor["expression"] = arith.to_dict()
         else:
-            self._cursor["woql:expression"] = arith
-        self._cursor["woql:result"] = self._clean_object(res)
+            self._cursor["expression"] = arith
+        self._cursor["result"] = self._clean_arithmetic_value(res)
         return self
 
     def plus(self, *args):
@@ -1626,16 +1636,16 @@ def plus(self, *args):
             query object that can be chained and/or execute
         """
         new_args = list(args)
-        if new_args and new_args[0] == "woql:args":
-            return ["woql:first", "woql:second"]
+        if new_args and new_args[0] == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Plus"
-        self._cursor["woql:first"] = self._arop(new_args.pop(0))
+        self._cursor["@type"] = "Plus"
+        self._cursor["left"] = self._arop(new_args.pop(0))
         if len(new_args) > 1:
             self._cursor = self._coerce_to_dict(WOQLQuery().plus(*new_args))
         else:
-            self._cursor["woql:second"] = self._arop(new_args[0])
+            self._cursor["right"] = self._arop(new_args[0])
         return self
 
     def minus(self, *args):
@@ -1652,18 +1662,18 @@ def minus(self, *args):
             query object that can be chained and/or execute
         """
         new_args = list(args)
-        if new_args and new_args[0] == "woql:args":
-            return ["woql:first", "woql:second"]
+        if new_args and new_args[0] == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Minus"
-        self._cursor["woql:first"] = self._arop(new_args.pop(0))
+        self._cursor["@type"] = "Minus"
+        self._cursor["left"] = self._arop(new_args.pop(0))
         if len(new_args) > 1:
-            self._cursor["woql:second"] = self._coerce_to_dict(
+            self._cursor["right"] = self._coerce_to_dict(
                 WOQLQuery().minus(*new_args)
             )
         else:
-            self._cursor["woql:second"] = self._arop(new_args[0])
+            self._cursor["right"] = self._arop(new_args[0])
         return self
 
     def times(self, *args):
@@ -1680,18 +1690,18 @@ def times(self, *args):
             query object that can be chained and/or execute
         """
         new_args = list(args)
-        if new_args and new_args[0] == "woql:args":
-            return ["woql:first", "woql:second"]
+        if new_args and new_args[0] == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Times"
-        self._cursor["woql:first"] = self._arop(new_args.pop(0))
+        self._cursor["@type"] = "Times"
+        self._cursor["left"] = self._arop(new_args.pop(0))
         if len(new_args) > 1:
-            self._cursor["woql:second"] = self._coerce_to_dict(
+            self._cursor["right"] = self._coerce_to_dict(
                 WOQLQuery().times(*new_args)
             )
         else:
-            self._cursor["woql:second"] = self._arop(new_args[0])
+            self._cursor["right"] = self._arop(new_args[0])
         return self
 
     def divide(self, *args):
@@ -1708,18 +1718,18 @@ def divide(self, *args):
             query object that can be chained and/or execute
         """
         new_args = list(args)
-        if new_args and new_args[0] == "woql:args":
-            return ["woql:first", "woql:second"]
+        if new_args and new_args[0] == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Divide"
-        self._cursor["woql:first"] = self._arop(new_args.pop(0))
+        self._cursor["@type"] = "Divide"
+        self._cursor["left"] = self._arop(new_args.pop(0))
         if len(new_args) > 1:
-            self._cursor["woql:second"] = self._coerce_to_dict(
+            self._cursor["right"] = self._coerce_to_dict(
                 WOQLQuery().divide(*new_args)
             )
         else:
-            self._cursor["woql:second"] = self._arop(new_args[0])
+            self._cursor["right"] = self._arop(new_args[0])
         return self
 
     def div(self, *args):
@@ -1736,18 +1746,18 @@ def div(self, *args):
             query object that can be chained and/or execute
         """
         new_args = list(args)
-        if new_args and new_args[0] == "woql:args":
-            return ["woql:first", "woql:second"]
+        if new_args and new_args[0] == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Div"
-        self._cursor["woql:first"] = self._arop(new_args.pop(0))
+        self._cursor["@type"] = "Div"
+        self._cursor["left"] = self._arop(new_args.pop(0))
         if len(new_args) > 1:
-            self._cursor["woql:second"] = self._coerce_to_dict(
+            self._cursor["right"] = self._coerce_to_dict(
                 WOQLQuery().div(*new_args)
             )
         else:
-            self._cursor["woql:second"] = self._arop(new_args[0])
+            self._cursor["right"] = self._arop(new_args[0])
         return self
 
     def exp(self, first, second):
@@ -1765,13 +1775,13 @@ def exp(self, first, second):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if first and first == "woql:args":
-            return ["woql:first", "woql:second"]
+        if first and first == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Exp"
-        self._cursor["woql:first"] = self._arop(first)
-        self._cursor["woql:second"] = self._arop(second)
+        self._cursor["@type"] = "Exp"
+        self._cursor["left"] = self._arop(first)
+        self._cursor["right"] = self._arop(second)
         return self
 
     def floor(self, user_input):
@@ -1787,12 +1797,12 @@ def floor(self, user_input):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if user_input and user_input == "woql:args":
-            return ["woql:argument"]
+        if user_input and user_input == "args":
+            return ["argument"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Floor"
-        self._cursor["woql:argument"] = self._arop(user_input)
+        self._cursor["@type"] = "Floor"
+        self._cursor["argument"] = self._arop(user_input)
         return self
 
     def isa(self, element, of_type):
@@ -1809,25 +1819,25 @@ def isa(self, element, of_type):
         -------
         bool
         """
-        if element and element == "woql:args":
-            return ["woql:element", "woql:of_type"]
+        if element and element == "args":
+            return ["element", "type"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:IsA"
-        self._cursor["woql:element"] = self._clean_subject(element)
-        self._cursor["woql:of_type"] = self._clean_class(of_type)
+        self._cursor["@type"] = "IsA"
+        self._cursor["element"] = self._clean_node_value(element)
+        self._cursor["type"] = self._clean_node_value(of_type)
         return self
 
     def like(self, left, right, dist):
-        if left and left == "woql:args":
-            return ["woql:left", "woql:right", "woql:like_similarity"]
+        if left and left == "args":
+            return ["left", "right", "like_similarity"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Like"
-        self._cursor["woql:left"] = self._clean_object(left)
-        self._cursor["woql:right"] = self._clean_object(right)
+        self._cursor["@type"] = "Like"
+        self._cursor["left"] = self._clean_data_value(left, 'xsd:string')
+        self._cursor["right"] = self._clean_data_value(right, 'xsd:string')
         if dist:
-            self._cursor["woql:like_similarity"] = self._clean_object(
+            self._cursor["like_similarity"] = self._clean_object(
                 dist, "xsd:decimal"
             )
         return self
@@ -1847,13 +1857,13 @@ def less(self, left, right):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if left and left == "woql:args":
-            return ["woql:left", "woql:right"]
+        if left and left == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Less"
-        self._cursor["woql:left"] = self._clean_object(left)
-        self._cursor["woql:right"] = self._clean_object(right)
+        self._cursor["@type"] = "Less"
+        self._cursor["left"] = self._clean_object(left)
+        self._cursor["right"] = self._clean_object(right)
         return self
 
     def greater(self, left, right):
@@ -1871,13 +1881,13 @@ def greater(self, left, right):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if left and left == "woql:args":
-            return ["woql:left", "woql:right"]
+        if left and left == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Greater"
-        self._cursor["woql:left"] = self._clean_object(left)
-        self._cursor["woql:right"] = self._clean_object(right)
+        self._cursor["@type"] = "Greater"
+        self._cursor["left"] = self._clean_object(left)
+        self._cursor["right"] = self._clean_object(right)
         return self
 
     def opt(self, query=None):
@@ -1900,11 +1910,11 @@ def opt(self, query=None):
         ... 'v:OptionalValue'))
         ... )
         """
-        if query and query == "woql:args":
-            return ["woql:query"]
+        if query and query == "args":
+            return ["query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Optional"
+        self._cursor["@type"] = "Optional"
         self._add_sub_query(query)
         return self
 
@@ -1930,14 +1940,14 @@ def unique(self, prefix, key_list, uri):
         >>> WOQLQuery().unique("https://base.url",["page","1"],"v:obj_id").execute(client)
         {'@type': 'api:WoqlResponse', 'api:status': 'api:success', 'api:variable_names': ['obj_id'], 'bindings': [{'obj_id': 'https://base.urlacd150a6885f609532931d89844070b1'}], 'deletes': 0, 'inserts': 0, 'transaction_retry_count': 0}
         """
-        if prefix and prefix == "woql:args":
-            return ["woql:base", "woql:key_list", "woql:uri"]
+        if prefix and prefix == "args":
+            return ["base", "key_list", "uri"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Unique"
-        self._cursor["woql:base"] = self._clean_object(prefix)
-        self._cursor["woql:key_list"] = self._vlist(key_list)
-        self._cursor["woql:uri"] = self._clean_class(uri)
+        self._cursor["@type"] = "HashKey"
+        self._cursor["base"] = self._clean_data_value(prefix)
+        self._cursor["key_list"] = self._data_list(key_list)
+        self._cursor["uri"] = self._clean_node_value(uri)
         return self
 
     def idgen(self, prefix, input_var_list, output_var):
@@ -1962,14 +1972,14 @@ def idgen(self, prefix, input_var_list, output_var):
         >>> WOQLQuery().idgen("https://base.url",["page","1"],"v:obj_id").execute(client)
         {'@type': 'api:WoqlResponse', 'api:status': 'api:success', 'api:variable_names': ['obj_id'], 'bindings': [{'obj_id': 'https://base.url_page_1'}], 'deletes': 0, 'inserts': 0, 'transaction_retry_count': 0}
         """
-        if prefix and prefix == "woql:args":
-            return ["woql:base", "woql:key_list", "woql:uri"]
+        if prefix and prefix == "args":
+            return ["base", "key_list", "uri"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:IDGenerator"
-        self._cursor["woql:base"] = self._clean_object(self.iri(prefix))
-        self._cursor["woql:key_list"] = self._vlist(input_var_list)
-        self._cursor["woql:uri"] = self._clean_class(output_var)
+        self._cursor["@type"] = "LexicalKey"
+        self._cursor["base"] = self._clean_data_value(prefix)
+        self._cursor["key_list"] = self._data_list(input_var_list)
+        self._cursor["uri"] = self._clean_node_value(output_var)
         return self
 
     def random_idgen(self, prefix, key_list, uri):
@@ -1994,24 +2004,24 @@ def random_idgen(self, prefix, key_list, uri):
         >>> WOQLQuery().random_idgen("https://base.url",["page","1"],"v:obj_id").execute(client)
         {'@type': 'api:WoqlResponse', 'api:status': 'api:success', 'api:variable_names': ['obj_id'], 'bindings': [{'obj_id': 'http://base.url_page_1_rv1mfa59ekisdutnxx6zdt2fkockgah'}], 'deletes': 0, 'inserts': 0, 'transaction_retry_count': 0}
         """
-        if prefix and prefix == "woql:args":
-            return ["woql:base", "woql:key_list", "woql:uri"]
+        if prefix and prefix == "args":
+            return ["base", "key_list", "uri"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:RandomIDGenerator"
-        self._cursor["woql:base"] = self._clean_object(prefix)
-        self._cursor["woql:key_list"] = self._vlist(key_list)
-        self._cursor["woql:uri"] = self._clean_class(uri)
+        self._cursor["@type"] = "RandomKey"
+        self._cursor["base"] = self._clean_data_value(prefix)
+        self._cursor["key_list"] = self._data_list(key_list)
+        self._cursor["uri"] = self._clean_node_value(uri)
         return self
 
     def upper(self, left, right):
-        if left and left == "woql:args":
-            return ["woql:left", "woql:right"]
+        if left and left == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Upper"
-        self._cursor["woql:left"] = self._clean_object(left)
-        self._cursor["woql:right"] = self._clean_object(right)
+        self._cursor["@type"] = "Upper"
+        self._cursor["left"] = self._clean_data_value(left, "xsd:string")
+        self._cursor["right"] = self._clean_data_value(right, "xsd:string")
         return self
 
     def lower(self, left, right):
@@ -2029,13 +2039,13 @@ def lower(self, left, right):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if left and left == "woql:args":
-            return ["woql:left", "woql:right"]
+        if left and left == "args":
+            return ["left", "right"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Lower"
-        self._cursor["woql:left"] = self._clean_object(left)
-        self._cursor["woql:right"] = self._clean_object(right)
+        self._cursor["@type"] = "Lower"
+        self._cursor["left"] = self._clean_data_value(left, "xsd:string")
+        self._cursor["right"] = self._clean_data_value(right, "xsd:string")
         return self
 
     def pad(self, user_input, pad, length, output):
@@ -2058,20 +2068,20 @@ def pad(self, user_input, pad, length, output):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if user_input and user_input == "woql:args":
+        if user_input and user_input == "args":
             return [
-                "woql:pad_string",
-                "woql:pad_char",
-                "woql:pad_times",
-                "woql:pad_result",
+                "string",
+                "char",
+                "times",
+                "result",
             ]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Pad"
-        self._cursor["woql:pad_string"] = self._clean_object(user_input)
-        self._cursor["woql:pad_char"] = self._clean_object(pad)
-        self._cursor["woql:pad_times"] = self._clean_object(length, "xsd:integer")
-        self._cursor["woql:pad_result"] = self._clean_object(output)
+        self._cursor["@type"] = "Pad"
+        self._cursor["string"] = self._clean_data_value(user_input)
+        self._cursor["char"] = self._clean_data_value(pad)
+        self._cursor["times"] = self._clean_data_value(length, "xsd:integer")
+        self._cursor["result"] = self._clean_data_value(output)
         return self
 
     def split(self, user_input, glue, output):
@@ -2091,14 +2101,14 @@ def split(self, user_input, glue, output):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if user_input and user_input == "woql:args":
-            return ["woql:split_string", "woql:split_pattern", "woql:split_list"]
+        if user_input and user_input == "args":
+            return ["string", "pattern", "list"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Split"
-        self._cursor["woql:split_string"] = self._clean_object(user_input)
-        self._cursor["woql:split_pattern"] = self._clean_object(glue)
-        self._cursor["woql:split_list"] = self._wlist(output)
+        self._cursor["@type"] = "Split"
+        self._cursor["string"] = self._clean_data_value(user_input)
+        self._cursor["pattern"] = self._clean_data_value(glue)
+        self._cursor["list"] = self._data_list(output)
         return self
 
     def member(self, member, mem_list):
@@ -2116,13 +2126,13 @@ def member(self, member, mem_list):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if member and member == "woql:args":
-            return ["woql:member", "woql:member_list"]
+        if member and member == "args":
+            return ["member", "list"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Member"
-        self._cursor["woql:member"] = self._clean_object(member)
-        self._cursor["woql:member_list"] = self._wlist(mem_list)
+        self._cursor["@type"] = "Member"
+        self._cursor["member"] = self._clean_object(member)
+        self._cursor["list"] = self._value_list(mem_list)
         return self
 
     def concat(self, concat_list, result):
@@ -2140,8 +2150,8 @@ def concat(self, concat_list, result):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if concat_list and concat_list == "woql:args":
-            return ["woql:concat_list", "woql:concatenated"]
+        if concat_list and concat_list == "args":
+            return ["list", "concatenated"]
         if type(concat_list) is str:
             slist = re.split("(v:)", concat_list)
             nlist = []
@@ -2159,9 +2169,9 @@ def concat(self, concat_list, result):
         if type(concat_list) is list:
             if self._cursor.get("@type"):
                 self._wrap_cursor_with_and()
-            self._cursor["@type"] = "woql:Concatenate"
-            self._cursor["woql:concat_list"] = self._wlist(concat_list)
-            self._cursor["woql:concatenated"] = self._clean_object(result)
+            self._cursor["@type"] = "Concatenate"
+            self._cursor["list"] = self._data_list(concat_list)
+            self._cursor["result"] = self._clean_data_value(result)
         return self
 
     def join(self, user_input, glue, output):
@@ -2182,14 +2192,14 @@ def join(self, user_input, glue, output):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if user_input and user_input == "woql:args":
-            return ["woql:join_list", "woql:join_separator", "woql:join"]
+        if user_input and user_input == "args":
+            return ["list", "separator", "join"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Join"
-        self._cursor["woql:join_list"] = self._wlist(user_input)
-        self._cursor["woql:join_separator"] = self._clean_object(glue)
-        self._cursor["woql:join"] = self._clean_object(output)
+        self._cursor["@type"] = "Join"
+        self._cursor["list"] = self._data_list(user_input)
+        self._cursor["separator"] = self._clean_data_value(glue)
+        self._cursor["result"] = self._clean_data_value(output)
         return self
 
     def sum(self, user_input, output):
@@ -2209,13 +2219,13 @@ def sum(self, user_input, output):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if user_input and user_input == "woql:args":
-            return ["woql:sum_list", "woql:sum"]
+        if user_input and user_input == "args":
+            return ["list", "sum"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Sum"
-        self._cursor["woql:sum_list"] = self._wlist(user_input)
-        self._cursor["woql:sum"] = self._clean_object(output)
+        self._cursor["@type"] = "Sum"
+        self._cursor["list"] = self._data_list(user_input)
+        self._cursor["sum"] = self._clean_data_value(output)
         return self
 
     def start(self, start, query=None):
@@ -2232,12 +2242,12 @@ def start(self, start, query=None):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if start and start == "woql:args":
-            return ["woql:start", "woql:query"]
+        if start and start == "args":
+            return ["start", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Start"
-        self._cursor["woql:start"] = self._clean_object(start, "xsd:nonNegativeInteger")
+        self._cursor["@type"] = "Start"
+        self._cursor["start"] = start
         return self._add_sub_query(query)
 
     def limit(self, limit, query=None):
@@ -2254,12 +2264,12 @@ def limit(self, limit, query=None):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if limit and limit == "woql:args":
-            return ["woql:limit", "woql:query"]
+        if limit and limit == "args":
+            return ["limit", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Limit"
-        self._cursor["woql:limit"] = self._clean_object(limit, "xsd:nonNegativeInteger")
+        self._cursor["@type"] = "Limit"
+        self._cursor["limit"] = limit
         return self._add_sub_query(query)
 
     def re(self, pattern, reg_str, reg_list):
@@ -2281,29 +2291,29 @@ def re(self, pattern, reg_str, reg_list):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if pattern and pattern == "woql:args":
-            return ["woql:pattern", "woql:regexp_string", "woql:regexp_list"]
+        if pattern and pattern == "args":
+            return ["pattern", "string", "result"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Regexp"
-        self._cursor["woql:pattern"] = self._clean_object(pattern)
-        self._cursor["woql:regexp_string"] = self._clean_object(reg_str)
-        self._cursor["woql:regexp_list"] = self._wlist(reg_list)
+        self._cursor["@type"] = "Regexp"
+        self._cursor["pattern"] = self._clean_data_value(pattern, 'xsd:string')
+        self._cursor["string"] = self._clean_data_value(reg_str, 'xsd:string')
+        self._cursor["result"] = self._data_list(reg_list)
         return self
 
     def length(self, var_list, var_len):
-        if var_list and var_list == "woql:args":
-            return ["woql:length_list", "woql:length"]
+        if var_list and var_list == "args":
+            return ["list", "length"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Length"
-        self._cursor["woql:length_list"] = self._vlist(var_list)
+        self._cursor["@type"] = "Length"
+        self._cursor["list"] = self._clean_data_list(var_list)
         if type(var_len) is float:
-            self._cursor["woql:length"] = self._clean_object(
+            self._cursor["length"] = self._clean_object(
                 var_len, "xsd:nonNegativeInteger"
             )
         elif type(var_len) is str:
-            self._cursor["woql:length"] = self._varj(var_len)
+            self._cursor["length"] = self._varj(var_len)
         return self
 
     def woql_not(self, query=None):
@@ -2318,11 +2328,11 @@ def woql_not(self, query=None):
         WOQLQuery object
             query object that can be chained and/or executed
         """
-        if query and query == "woql:args":
-            return ["woql:query"]
+        if query and query == "args":
+            return ["query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Not"
+        self._cursor["@type"] = "Not"
         return self._add_sub_query(query)
 
     def immediately(self, query=None):
@@ -2337,11 +2347,11 @@ def immediately(self, query=None):
         WOQLQuery object
             query object that can be chained and/or executed
         """
-        if query and query == "woql:args":
-            return ["woql:query"]
+        if query and query == "args":
+            return ["query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Immediately"
+        self._cursor["@type"] = "Immediately"
         return self._add_sub_query(query)
 
     def count(self, countvar, query=None):
@@ -2357,12 +2367,12 @@ def count(self, countvar, query=None):
         WOQLQuery object
            query object that can be chained and/or executed
         """
-        if countvar and countvar == "woql:args":
-            return ["woql:count", "woql:query"]
+        if countvar and countvar == "args":
+            return ["count", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Count"
-        self._cursor["woql:count"] = self._clean_object(countvar)
+        self._cursor["@type"] = "Count"
+        self._cursor["count"] = self._clean_data_value(countvar)
         return self._add_sub_query(query)
 
     def cast(self, val, user_type, result, literal_type=None):
@@ -2378,7 +2388,7 @@ def cast(self, val, user_type, result, literal_type=None):
             save the return variable
         literal_type: str, optional
             literal type of`val`, can be used to treat `val` as a literal rather than an object or variable in the WOQL query.
-            If literal type is "owl:Thing" or "woql:node", `val` will be treated as object in the graph
+            If literal type is "owl:Thing" or "node", `val` will be treated as object in the graph
 
         Returns
         -------
@@ -2386,30 +2396,30 @@ def cast(self, val, user_type, result, literal_type=None):
             query object that can be chained and/or execute
         """
         if literal_type is not None:
-            if literal_type == "owl:Thing" or literal_type == "woql:node":
-                return self.cast(self.iri(val), user_type, result)
+            if (literal_type == "owl:Thing" or literal_type == "node") and isinstance(val, str) :
+                return self.cast({"@type": "Value", "node": val}, user_type, result)
             else:
                 return self.cast(self.literal(val, literal_type), user_type, result)
-        if val and val == "woql:args":
-            return ["woql:typecast_value", "woql:typecast_type", "woql:typecast_result"]
+        if val and val == "args":
+            return ["value", "type", "result"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Typecast"
-        self._cursor["woql:typecast_value"] = self._clean_object(val)
-        self._cursor["woql:typecast_type"] = self._clean_object(user_type)
-        self._cursor["woql:typecast_result"] = self._clean_object(result)
+        self._cursor["@type"] = "Typecast"
+        self._cursor["value"] = self._clean_object(val)
+        self._cursor["type"] = self._clean_node_value(user_type)
+        self._cursor["result"] = self._clean_object(result)
         return self
 
     def type_of(self, value, vtype):
-        if value and value == "woql:args":
-            return ["woql:value", "woql:type"]
+        if value and value == "args":
+            return ["value", "type"]
         if not value or not vtype:
             raise ValueError("type_of takes two parameters, both values")
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:TypeOf"
-        self._cursor["woql:value"] = self._clean_object(value)
-        self._cursor["woql:type"] = self._clean_object(vtype)
+        self._cursor["@type"] = "TypeOf"
+        self._cursor["value"] = self._clean_object(value)
+        self._cursor["type"] = self._clean_node_value(vtype)
         return self
 
     def order_by(self, *args, order="asc"):
@@ -2447,12 +2457,12 @@ def order_by(self, *args, order="asc"):
         """
 
         ordered_varlist = list(args)
-        if ordered_varlist and ordered_varlist == "woql:args":
-            return ["woql:variable_ordering", "woql:query"]
+        if ordered_varlist and ordered_varlist == "args":
+            return ["ordering", "query"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:OrderBy"
-        self._cursor["woql:variable_ordering"] = []
+        self._cursor["@type"] = "OrderBy"
+        self._cursor["ordering"] = []
 
         if not ordered_varlist or len(ordered_varlist) == 0:
             raise ValueError(
@@ -2470,30 +2480,16 @@ def order_by(self, *args, order="asc"):
             if len(args) != len(order):
                 raise ValueError("Order array must be same length as variable array")
 
-        for idx, item in enumerate(ordered_varlist):
+        for item in ordered_varlist:
             if type(item) is str:
                 obj = {
-                    "@type": "woql:VariableOrdering",
-                    "woql:index": self._jlt(idx, "xsd:nonNegativeInteger"),
+                    "@type": "OrderTemplate",
+                    "variable" : self._raw_var(item),
+                    "order": "asc"
                 }
-                if isinstance(order, str):
-                    iorder = order
-                if isinstance(order, list):
-                    iorder = order[idx]
-                    if iorder is None:
-                        iorder = "asc"
-                if isinstance(order, dict):
-                    iorder = order.get(item)
-                    if iorder is None:
-                        iorder = "asc"
-                if iorder == "desc":
-                    obj["woql:ascending"] = self._jlt(False, "xsd:boolean")
-                else:
-                    obj["woql:ascending"] = self._jlt(True, "xsd:boolean")
-                obj["woql:variable"] = self._varj(item)
-                self._cursor["woql:variable_ordering"].append(obj)
+                self._cursor["ordering"].append(obj)
             else:
-                self._cursor["woql:variable_ordering"].append(ordered_varlist[idx])
+                self._cursor["ordering"].append(item)
         return self._add_sub_query(embedquery)
 
     def group_by(self, gvarlist, groupedvar, output, groupquery=None):
@@ -2515,38 +2511,27 @@ def group_by(self, gvarlist, groupedvar, output, groupquery=None):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if gvarlist and gvarlist == "woql:args":
+        if gvarlist and gvarlist == "args":
             return [
-                "woql:group_by",
-                "woql:group_template",
-                "woql:grouped",
-                "woql:query",
+                "group_by",
+                "template",
+                "grouped",
+                "query",
             ]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:GroupBy"
-        self._cursor["woql:group_by"] = []
+        self._cursor["@type"] = "GroupBy"
         if type(gvarlist) is str:
             gvarlist = [gvarlist]
-        for idx, item in enumerate(gvarlist):
-            onevar = self._varj(item)
-            onevar["@type"] = "woql:VariableListElement"
-            onevar["woql:index"] = self._jlt(idx, "nonNegativeInteger")
-            self._cursor["woql:group_by"].append(onevar)
+        self._cursor["group_by"] = self._raw_var_list(gvarlist)
         if type(groupedvar) is str:
-            self._cursor["woql:group_template"] = self._varj(groupedvar)
-        else:
-            self._cursor["woql:group_template"] = []
-            for idx, item in enumerate(groupedvar):
-                onevar = self._varj(item)
-                onevar["@type"] = "woql:VariableListElement"
-                onevar["woql:index"] = self._jlt(idx, "nonNegativeInteger")
-                self._cursor["woql:group_template"].append(onevar)
-        self._cursor["woql:grouped"] = self._varj(output)
+            groupedvar = [groupedvar]
+        self._cursor["template"] = self._raw_var_list(groupedvar)
+        self._cursor["grouped"] = self._clean_object(output)
         return self._add_sub_query(groupquery)
 
     def true(self):
-        self._cursor["@type"] = "woql:True"
+        self._cursor["@type"] = "True"
         return self
 
     def path(self, subject, pattern, obj, path):
@@ -2574,37 +2559,37 @@ def path(self, subject, pattern, obj, path):
         WOQLQuery object
             query object that can be chained and/or execute
         """
-        if subject and subject == "woql:args":
-            return ["woql:subject", "woql:path_pattern", "woql:object", "woql:path"]
+        if subject and subject == "args":
+            return ["subject", "pattern", "object", "path"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Path"
-        self._cursor["woql:subject"] = self._clean_subject(subject)
+        self._cursor["@type"] = "Path"
+        self._cursor["subject"] = self._clean_subject(subject)
         if type(pattern) is str:
             pattern = self._compile_path_pattern(pattern)
-        self._cursor["woql:path_pattern"] = pattern
-        self._cursor["woql:object"] = self._clean_object(obj)
-        self._cursor["woql:path"] = self._varj(path)
+        self._cursor["pattern"] = pattern
+        self._cursor["object"] = self._clean_object(obj)
+        self._cursor["path"] = self._varj(path)
         return self
 
     def size(self, graph, size):
-        if graph and graph == "woql:args":
-            return ["woql:resource", "woql:size"]
+        if graph and graph == "args":
+            return ["resource", "size"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:Size"
-        self._cursor["woql:resource"] = self._clean_graph(graph)
-        self._cursor["woql:size"] = self._varj(size)
+        self._cursor["@type"] = "Size"
+        self._cursor["resource"] = self._clean_graph(graph)
+        self._cursor["size"] = self._varj(size)
         return self
 
     def triple_count(self, graph, triple_count):
-        if graph and graph == "woql:args":
-            return ["woql:resource", "woql:triple_count"]
+        if graph and graph == "args":
+            return ["resource", "triple_count"]
         if self._cursor.get("@type"):
             self._wrap_cursor_with_and()
-        self._cursor["@type"] = "woql:TripleCount"
-        self._cursor["woql:resource"] = self._clean_graph(graph)
-        self._cursor["woql:triple_count"] = self._varj(triple_count)
+        self._cursor["@type"] = "TripleCount"
+        self._cursor["resource"] = self._clean_graph(graph)
+        self._cursor["triple_count"] = self._varj(triple_count)
         return self
 
     def star(self, graph=None, subj=None, pred=None, obj=None):
@@ -2647,180 +2632,6 @@ def lib(self):
         # return WOQLLibrary()
         pass
 
-    def abstract(self, graph=None, subj=None):
-        """
-        Internal Triple-builder functions which allow chaining of partial queries
-        """
-        return self._add_partial(subj, "terminus:tag", "terminus:abstract", graph)
-
-    def node(self, node, node_type=None):
-        """
-        Selects nodes with the ID NodeID as the subject of subsequent sub-queries. The second argument PatternType specifies what type of sub-queries are being constructed, options are: triple, quad, update_triple, update_quad, delete_triple, delete_quad
-
-        Parameters
-        ----------
-        node : str
-            node to be selected
-        node_type : str
-            pattern type, optional (default is triple)
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if node_type == "add_quad":
-            node_type = "AddQuad"
-        elif node_type == "delete_quad":
-            node_type = "DeleteQuad"
-        elif node_type == "add_triple":
-            node_type = "AddTriple"
-        elif node_type == "delete_triple":
-            node_type = "DeleteTriple"
-        elif node_type == "quad":
-            node_type = "Quad"
-        elif node_type == "triple":
-            node_type = "Triple"
-        if ":" not in node_type:
-            node_type = "woql:" + node_type
-        ctxt = {"subject": node}
-        if node_type is not None:
-            ctxt["action"] = node_type
-        self._set_context(ctxt)
-        return self
-
-    def property(self, pro_id, property_type, label=None, description=None):
-        """
-        Add a property at the current class/document
-
-        A range could be another class/document or an "xsd":"http://www.w3.org/2001/XMLSchema#" type
-        like string|integer|datatime|nonNegativeInteger|positiveInteger etc ..
-        (you don't need the prefix xsd for specific a type)
-
-        Parameters
-        ----------
-        pro_id : str
-                 property ID
-        property_type : str
-                        property type (range)
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if label is None and description is None:
-            if self._adding_class() is not None:
-                part = self._find_last_subject(self._cursor)
-                if part:
-                    gpart = (
-                        part["woql:graph_filter"]
-                        if part.get("woql:graph_filter")
-                        else part["woql:graph"]
-                    )
-                else:
-                    gpart = None
-                if gpart:
-                    gpart["@value"]
-                nprop = (
-                    WOQLQuery()
-                    .add_property(pro_id, property_type)
-                    .domain(self._adding_class())
-                )
-                self.woql_and(nprop)
-            else:
-                self._add_partial(None, pro_id, property_type)
-            return self
-        else:
-            self.property(pro_id, property_type)
-            if label:
-                self.label(label)
-            if description:
-                self.description(description)
-            return self
-
-    def insert(
-        self, insert_id, insert_type, ref_graph=None, label=None, description=None
-    ):
-        """Inserts a new node of a specified type in a graph
-
-        Parameters
-        ----------
-        insert_id : str
-            ID of the node to be inserted
-        insert_type : str
-            The rdf type of the node. This should be defined in your schema.
-        ref_graph : str, optional
-            target graph
-        label : str, optional
-            label for the insert object
-        description : str, optional
-            description for the insert object
-
-        Returns
-        -------
-        WOQLQuery object
-            a query object that can be chained and/or execute
-
-        Notes
-        --------
-        If graph parameter is None then this is a shorthand for calling :meth:`add_triple` with
-        rdf:type as predicate: ``.add_triple(subject, 'rdf:type', type).``
-        Otherwise :meth:`add_quad` will be called.
-        It will yield a json object like follows: ``{'add_triple': ['doc:subject', 'rdf:type', 'scm:type']}``
-
-        Examples
-        --------
-        >>> update = WOQLQuery().insert("Dog", "scm:Animal").label('Dog')
-        >>> qry = WOQLQuery().when(True, update)
-        >>> client.update(qry.json(), 'MyDatabaseId')
-
-        See Also
-        --------
-        add_triple
-        add_quad
-        """
-        if label is None and description is None:
-            insert_type = self._clean_type(insert_type, True)
-            if ref_graph:
-                self.add_quad(insert_id, "type", insert_type, ref_graph)
-            else:
-                self.add_triple(insert_id, "type", insert_type)
-        else:
-            self.insert(insert_id, insert_type, ref_graph)
-            if label:
-                self.label(label)
-            if description:
-                self.description(description)
-        return self
-
-    def insert_data(self, data, ref_graph):
-        """Creates a new node of the specified type in a graph, with description and label.
-
-        Parameters
-        ----------
-        data : dict
-            dictionary with id, label, description attributes.
-        ref_graph : str
-            target graph
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if data.get("type") and data.get("id"):
-            data_type = self._clean_type(data["type"], True)
-            self.insert(data["id"], data_type, ref_graph)
-            if data.get("label"):
-                self.label(data["label"])
-            if data.get("description"):
-                self.description(data["description"])
-            for k in data:
-                if k not in ["id", "label", "type", "description"]:
-                    self.property(k, data[k])
-        return self
-
     def graph(self, g):
         """Used to specify that the rest of the query should use the graph g in calls to add_quad, quad, etc
         Parameters
@@ -2834,188 +2645,14 @@ def graph(self, g):
         """
         return self._set_context({"graph": g})
 
-    def domain(self, d):
-        """Specifies the domain of a new property
-        Parameters
-        ----------
-        d : str
-            target domain
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        d = self._clean_class(d)
-        return self._add_partial(None, "rdfs:domain", d)
-
-    def label(self, lab, lang="en"):
-        """Depending on context, either adds a label match to a triple/quad or adds a label create to add_quad, add_triple
-        The triple/quad that will get created will be for the rdfs:label predicate.
-        Parameters
-        ----------
-        lan : str
-            label to add
-        lang : str, optional
-            language, default is English "en"
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if lab[:2] == "v:":
-            d = lab
-        else:
-            d = {"@value": lab, "@type": "xsd:string", "@language": lang}
-        return self._add_partial(None, "rdfs:label", d)
-
-    def description(self, desc, lang="en"):
-        """Adds or matches a rdfs:comment field in a query
-        Parameters
-        ----------
-        c : str
-            description to be added
-        lang : str, optional
-            language, default is English "en"
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if desc[:2] == "v:":
-            d = desc
-        else:
-            d = {"@value": desc, "@type": "xsd:string", "@language": lang}
-        return self._add_partial(None, "rdfs:comment", d)
-
-    def parent(self, *args):
-        """Specifies that a new class should have parents listed in *args - (short hand for (a, rdfs:subClassOf b)
-
-        Parameters
-        ----------
-        args : list
-            parent classes
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        for ipl in args:
-            pn = self._clean_class(ipl)
-            self._add_partial(None, "rdfs:subClassOf", pn)
-        return self
-
-    def max(self, m):
-        """Sets the maximum cardinality for a property to m
-
-        Parameters
-        ----------
-        m : int
-            maximum cardinality
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        self._card(m, "max")
-        return self
-
-    def cardinality(self, m):
-        """Sets the cardinality of a property to be precisely m
-
-        Parameters
-        ----------
-        m : int
-            cardinality
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        self._card(m, "cardinality")
-        return self
-
-    def min(self, m):
-        """Sets the minimum cardinality for a property to m
-
-        Parameters
-        ----------
-        m : int
-            minimum cardinality
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        self._card(m, "min")
-        return self
-
-    def _card(self, n, which):
-        ctxt = self._triple_builder_context
-        s = ctxt.get("subject")
-        g = ctxt.get("graph")
-        lastsubj = self._find_last_subject(self._cursor)
-        if lastsubj is not None and s is None:
-            s = lastsubj.get("woql:subject")
-        if type(s) is dict:
-            s = s.get("woql:node")
-        else:
-            return
-        if lastsubj is not None and g is None:
-            gobj = lastsubj.get("woql:graph_filter")
-            if gobj is None:
-                gobj = lastsubj.get("woql:graph")
-            if gobj is not None:
-                g = gobj.get("@value")
-        newid = s + "_" + which
-        self.woql_and(
-            WOQLQuery().add_quad(newid, "type", "owl:Restriction", g),
-            WOQLQuery().add_quad(newid, "owl:onProperty", s, g),
-        )
-        if which == "max":
-            self.woql_and(
-                WOQLQuery().add_quad(
-                    newid,
-                    "owl:maxCardinality",
-                    WOQLQuery().literal(n, "xsd:nonNegativeInteger"),
-                    g,
-                )
-            )
-        elif which == "min":
-            self.woql_and(
-                WOQLQuery().add_quad(
-                    newid,
-                    "owl:minCardinality",
-                    WOQLQuery().literal(n, "xsd:nonNegativeInteger"),
-                    g,
-                )
-            )
-        else:
-            self.woql_and(
-                WOQLQuery().add_quad(
-                    newid,
-                    "owl:cardinality",
-                    WOQLQuery().literal(n, "xsd:nonNegativeInteger"),
-                    g,
-                )
-            )
-
-        od = self._get_object(s, "rdfs:domain")
-        if od is not None:
-            self.woql_and(WOQLQuery().add_quad(od, "rdfs:subClassOf", newid, g))
-        return self
-
     def _get_object(self, s, p):
-        if self._cursor.get("@type") == "woql:And":
-            for item in self._cursor["woql:query_list"]:
-                subq = item.get("woql:query")
-                if self._same_entry(subq.get("woql:subject"), s) and self._same_entry(
-                    subq.get("woql:predicate"), p
+        if self._cursor.get("@type") == "And":
+            for item in self._cursor["query_list"]:
+                subq = item.get("query")
+                if self._same_entry(subq.get("subject"), s) and self._same_entry(
+                    subq.get("predicate"), p
                 ):
-                    return subq.get("woql:object")
+                    return subq.get("object")
         return None
 
     def _same_entry(self, a, b):
@@ -3060,13 +2697,13 @@ def _string_matches_object(self, s, obj):
         -------
         bool
         """
-        n = obj.get("woql:node")
+        n = obj.get("node")
         if n is not None:
             return s == n
         v = obj.get("@value")
         if v is not None:
             return s == v
-        vn = obj.get("woql:variable_name")
+        vn = obj.get("variable")
         if vn is not None:
             return s == "v:" + vn
         return False
@@ -3079,903 +2716,33 @@ def _add_partial(self, s, p, o, g=None):
             g = ctxt.get("graph")
         lastsubj = self._find_last_subject(self._cursor)
         if s is None and lastsubj:
-            s = lastsubj.get("woql:subject")
+            s = lastsubj.get("subject")
         t = ctxt.get("action")
         if t is None:
             t = lastsubj.get("@type")
         if g is None and lastsubj:
-            gobj = lastsubj.get("woql:graph_filter")
+            gobj = lastsubj.get("graph_filter")
             if gobj is None:
-                gobj = lastsubj.get("woql:graph")
+                gobj = lastsubj.get("graph")
             if gobj is not None:
-                g = gobj.get("@value")
+                g = gobj
         if g is None:
-            g = "schema/main"
+            g = "schema"
 
-        if t == "woql:AddTriple":
+        if t == "AddTriple":
             self.woql_and(WOQLQuery().add_triple(s, p, o))
-        elif t == "woql:DeleteTriple":
+        elif t == "DeleteTriple":
             self.woql_and(WOQLQuery().delete_triple(s, p, o))
-        elif t == "woql:AddQuad":
+        elif t == "AddTriple":
             self.woql_and(WOQLQuery().add_quad(s, p, o, g))
-        elif t == "woql:DeleteQuad":
+        elif t == "DeleteTriple":
             self.woql_and(WOQLQuery().delete_quad(s, p, o, g))
-        elif t == "woql:Quad":
+        elif t == "Triple":
             self.woql_and(WOQLQuery().quad(s, p, o, g))
         else:
             self.woql_and(WOQLQuery().triple(s, p, o))
         return self
 
-    def _adding_class(self, string_only=False):
-        ac = self._triple_builder_context.get("adding_class")
-        if ac and string_only and type(ac) is dict:
-            return ac.get("woql:node")
-        return ac
-
-    def _set_adding_class(self, c):
-        self._triple_builder_context["adding_class"] = c
-        return self
-
-    def _set_context(self, ctxt):
-        for i in ctxt.keys():
-            self._triple_builder_context[i] = ctxt[i]
-        return self
-
-    def add_class(self, c, graph=None):
-        """Generates a new Class with the given ClassID and writes it to the DB schema
-
-        Parameters
-        ----------
-        classid : str
-            class to be added
-        graph : str, optional
-            target graph
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if not graph:
-            graph = self._graph
-        if c:
-            c = self._clean_class(c, True)
-            self.add_quad(c, "rdf:type", "owl:Class", graph)
-            self._set_adding_class(c)
-        return self
-
-    def insert_class_data(self, data, ref_graph):
-        """Adds a bunch of class data in one go"""
-        if data.get("id"):
-            self.add_class(data["id"], ref_graph)
-            if data.get("label"):
-                self.label(data["label"])
-            if data.get("description"):
-                self.description(data["description"])
-            if data.get("parent"):
-                if not isinstance(data["parent"], list):
-                    data["parent"] = [data["parent"]]
-                self.parent(*data["parent"])
-            for k in data:
-                if k not in ["id", "label", "description", "parent"]:
-                    data[k]["domain"] = data["id"]
-                    self.insert_property_data(data[k], ref_graph)
-        return self
-
-    def insert_doctype_data(self, data, ref_graph):
-        if not data.get("parent"):
-            data["parent"] = []
-        if not isinstance(data["parent"], list):
-            data["parent"] = [data["parent"]]
-        data["parent"].append("Document")
-        return self.insert_class_data(data, ref_graph)
-
-    def insert_property_data(self, data, ref_graph):
-        """A function to insert the passed property data
-
-        Parameters
-        ----------
-        data : str
-            class to be deleted
-        ref_graph : str
-            target graph
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if data.get("id"):
-            self.add_property(data["id"], ref_graph)
-            if data.get("label"):
-                self.label(data["label"])
-            if data.get("description"):
-                self.description(data["description"])
-            if data.get("domain"):
-                self.domain(data["domain"])
-            if data.get("max"):
-                self.max(data["max"])
-            if data.get("min"):
-                self.min(data["min"])
-            if data.get("cardinality"):
-                self.cardinality(data["cardinality"])
-        return self
-
-    def delete_class(self, classid, graph=None):
-        """Deletes the Class with the passed ID form the schema (and all references to it)
-
-        Parameters
-        ----------
-        classid : str
-            class to be deleted
-        graph : str, optional
-            target graph
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if not graph:
-            graph = self._graph
-        ap = WOQLQuery()
-        if classid:
-            classid = ap._clean_class(classid, True)
-            ap.woql_and(
-                WOQLQuery().delete_quad(classid, "v:Outgoing", "v:Value", graph),
-                WOQLQuery().opt().delete_quad("v:Other", "v:Incoming", classid, graph),
-            )
-            ap._updated()
-        return ap
-
-    def add_property(self, p, t, graph=None):
-        """Generates a new Property with the given PropertyID and a range of type PropType and writes it to the DB schema
-
-        Parameters
-        ----------
-        p : str
-            property id to be added
-        t : str
-            type of the proerty
-        graph : str, optional
-            target graph
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if not graph:
-            graph = self._graph
-        t = self._clean_type(t, True) if t else "xsd:string"
-        if p:
-            p = self._clean_path_predicate(p)
-            # TODO: cleaning
-            if utils.is_data_type(t):
-                self.woql_and(
-                    WOQLQuery().add_quad(p, "rdf:type", "owl:DatatypeProperty", graph),
-                    WOQLQuery().add_quad(p, "rdfs:range", t, graph),
-                )
-            else:
-                self.woql_and(
-                    WOQLQuery().add_quad(p, "rdf:type", "owl:ObjectProperty", graph),
-                    WOQLQuery().add_quad(p, "rdfs:range", t, graph),
-                )
-            self._updated()
-        return self
-
-    def delete_property(self, p, graph=None):
-        """Deletes the property with the passed ID from the schema (and all references to it)
-
-        Parameters
-        ----------
-        p : str
-            property id to be deleted
-        graph : str
-            target graph ,optional
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if not graph:
-            graph = self._graph
-        ap = WOQLQuery()
-        if p:
-            p = ap._clean_path_predicate(p)
-            ap.woql_and(
-                WOQLQuery().delete_quad(p, "v:All", "v:Al2", graph),
-                WOQLQuery().delete_quad("v:Al3", "v:Al4", p, graph),
-            )
-            ap._updated()
-        return ap
-
-    def box_classes(self, classes, excepts, prefix=None, graph=None):
-        if not graph:
-            graph = self._graph
-        if not prefix:
-            prefix = "scm:"
-        subs = []
-        for i in classes.keys():
-            subs.append(WOQLQuery().sub(classes[i], "v:Cid"))
-        nsubs = []
-        for i in excepts.keys():
-            nsubs.append(WOQLQuery().woql_not().sub(excepts[i], "v:Cid"))
-        idgens = [
-            WOQLQuery().re("#(.)(.*)", "v:Cid", ["v:AllB", "v:FirstB", "v:RestB"]),
-            WOQLQuery().lower("v:FirstB", "v:Lower"),
-            WOQLQuery().concat(["v:Lower", "v:RestB"], "v:Propname"),
-            WOQLQuery().concat(["Scoped", "v:FirstB", "v:RestB"], "v:Cname"),
-            WOQLQuery().idgen(prefix, ["v:Cname"], "v:ClassID"),
-            WOQLQuery().idgen(prefix, ["v:Propname"], "v:PropID"),
-        ]
-        woql_filter = WOQLQuery().woql_and(
-            WOQLQuery().quad("v:Cid", "rdf:type", "owl:Class", graph),
-            WOQLQuery().woql_not().node("v:Cid").abstract(graph),
-            WOQLQuery().woql_and(*idgens),
-            WOQLQuery().quad("v:Cid", "label", "v:Label", graph),
-            WOQLQuery().concat("Box Class generated for class v:Cid", "v:CDesc"),
-            WOQLQuery().concat(
-                "Box Property generated to link box v:ClassID to class v:Cid", "v:PDesc"
-            ),
-        )
-        if subs:
-            if len(subs) == 1:
-                woql_filter.woql_and(subs[0])
-            else:
-                woql_filter.woql_and(WOQLQuery().woql_or(*subs))
-        if nsubs:
-            woql_filter.woql_and(WOQLQuery().woql_and(*nsubs))
-        cls = (
-            WOQLQuery(graph=graph)
-            .add_class("v:ClassID")
-            .label("v:Label")
-            .description("v:CDesc")
-        )
-        prop = (
-            WOQLQuery(graph=graph)
-            .add_property("v:PropID", "v:Cid")
-            .label("v:Label")
-            .description("v:PDesc")
-            .domain("v:ClassID")
-        )
-        nq = WOQLQuery().when(woql_filter).woql_and(cls, prop)
-        return nq._updated()
-
-    def generate_choice_list(
-        self,
-        cls=None,
-        clslabel=None,
-        clsdesc=None,
-        choices=None,
-        graph=None,
-        parent=None,
-    ):
-        if not graph:
-            graph = self._graph
-        clist = []
-        if ":" not in cls:
-            listid = "_:" + cls
-        else:
-            listid = "_:" + cls.split(":")[1]
-        lastid = listid
-        wq = WOQLQuery().add_class(cls, graph).label(clslabel)
-        if clsdesc:
-            wq.description(clsdesc)
-        if parent:
-            wq.parent(parent)
-        confs = [wq]
-        for i in choices:
-            if not choices[i]:
-                continue
-            if type(choices[i]) is list:
-                chid = choices[i][0]
-                clab = choices[i][1]
-                desc = choices[i][2] if len(choices[i]) >= 3 else False
-            else:
-                chid = choices[i]
-                clab = utils.label_from_url(chid)
-                desc = False
-            cq = WOQLQuery().insert(chid, cls, graph).label(clab)
-            if desc:
-                cq.description(desc)
-            confs.append(cq)
-            if i < len(choices) - 1:
-                nextid = listid + "_" + i
-            else:
-                nextid = "rdf:nil"
-            clist.append(WOQLQuery().add_quad(lastid, "rdf:first", chid, graph))
-            clist.append(WOQLQuery().add_quad(lastid, "rdf:rest", nextid, graph))
-            lastid = nextid
-        oneof = WOQLQuery().woql_and(
-            WOQLQuery().add_quad(cls, "owl:oneOf", listid, graph), *clist
-        )
-        return WOQLQuery().woql_and(*confs, oneof)
-
-    def libs(self, libs, parent, graph, prefix):
-        bits = []
-        if "xdd" in libs:
-            bits.append(self._load_xdd(graph))
-            if "box" in libs:
-                bits.append(self._load_xdd_boxes(parent, graph, prefix))
-                bits.append(self._load_xsd_boxes(parent, graph, prefix))
-        elif "box" in libs:
-            bits.append(self._load_xsd_boxes(parent, graph, prefix))
-        if len(bits) > 1:
-            return WOQLQuery().woql_and(*bits)
-        return bits[0]
-
-    def _load_xdd(self, graph=None):
-        """
-        A function to generate a query for all of the xdd datatypes.
-
-        Parameters
-        ----------
-        graph : str, optional
-            Graph
-
-        Returns
-        -------
-        WOQLQuery object
-            a query object that can be chained and/or execute
-        """
-        if not graph:
-            graph = self._graph
-        return WOQLQuery().woql_and(
-            # geographic datatypes
-            self.add_datatype(
-                "xdd:coordinate",
-                "Coordinate",
-                "A latitude / longitude pair making up a coordinate, encoded as: [lat,long]",
-                graph,
-            ),
-            self.add_datatype(
-                "xdd:coordinatePolygon",
-                "Coordinate Polygon",
-                "A JSON list of [[lat,long]] coordinates forming a closed polygon.",
-                graph,
-            ),
-            self.add_datatype(
-                "xdd:coordinatePolyline",
-                "Coordinate Polyline",
-                "A JSON list of [[lat,long]] coordinates.",
-                graph,
-            ),
-            # uncertainty range datatypes
-            self.add_datatype(
-                "xdd:dateRange",
-                "Date Range",
-                "A date (YYYY-MM-DD) or an uncertain date range [YYYY-MM-DD1,YYYY-MM-DD2]. "
-                + "Enables uncertainty to be encoded directly in the data",
-                graph,
-            ),
-            self.add_datatype(
-                "xdd:decimalRange",
-                "Decimal Range",
-                "Either a decimal value (e.g. 23.34) or an uncertain range of decimal values "
-                + "(e.g.[23.4, 4.143]. Enables uncertainty to be encoded directly in the data",
-                graph,
-            ),
-            self.add_datatype(
-                "xdd:integerRange",
-                "Integer Range",
-                "Either an integer (e.g. 30) or an uncertain range of integers [28,30]. "
-                + "Enables uncertainty to be encoded directly in the data",
-                graph,
-            ),
-            self.add_datatype(
-                "xdd:gYearRange",
-                "Year Range",
-                "A year (e.g. 1999) or an uncertain range of years: (e.g. [1999,2001])."
-                + "Enables uncertainty to be encoded directly in the data",
-                graph,
-            ),
-            # string refinement datatypes
-            self.add_datatype("xdd:email", "Email", "A valid email address", graph),
-            self.add_datatype("xdd:html", "HTML", "A string with embedded HTML", graph),
-            self.add_datatype("xdd:json", "JSON", "A JSON encoded string", graph),
-            self.add_datatype("xdd:url", "URL", "A valid http(s) URL", graph),
-        )
-
-    def add_datatype(self, d_id, label, descr, graph=None):
-        """
-        A utility function for creating a datatype in woql.
-
-        Parameters
-        ----------
-        d_id : str
-            the datatype id
-        label : str
-            label for the datatype
-        descr : str
-            description for the datatype
-        graph : str, optional
-            Graph
-
-        Returns
-        -------
-        WOQLQuery object
-            a query object that can be chained and/or execute
-        """
-        if not graph:
-            graph = self._graph
-        dt = WOQLQuery().insert(d_id, "rdfs:Datatype", graph).label(label)
-        if descr:
-            dt.description(descr)
-        return dt
-
-    def _load_xsd_boxes(self, parent, graph, prefix):
-        """
-        A function to load box classes for all of the useful xsd classes.
-        The format is to generate the box classes for xsd:anyGivenType as:
-         class(prefix:AnyGivenType) -> property(prefix:anyGivenType) -> datatype(xsd:anyGivenType)
-
-        Parameters
-        ----------
-        parent : str, optional
-            the parent class of the box_class
-        graph : str, optional
-            Graph
-        prefix : str, optional
-            prefix for the box_class_id
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        return WOQLQuery().woql_and(
-            self.box_datatype(
-                "xsd:anySimpleType",
-                "Any Simple Type",
-                "Any basic data type such as string or integer. An xsd:anySimpleType value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:string",
-                "String",
-                "Any text or sequence of characters",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:boolean",
-                "Boolean",
-                "A true or false value. An xsd:boolean value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:decimal",
-                "Decimal",
-                "A decimal number. An xsd:decimal value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:double",
-                "Double",
-                "A double-precision decimal number. An xsd:double value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:float",
-                "Float",
-                "A floating-point number. An xsd:float value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:time",
-                "Time",
-                "A time. An xsd:time value. hh:mm:ss.ssss",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:date",
-                "Date",
-                "A date. An xsd:date value. YYYY-MM-DD",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:dateTime",
-                "Date Time",
-                "A date and time. An xsd:dateTime value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:dateTimeStamp",
-                "Date-Time Stamp",
-                "An xsd:dateTimeStamp value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:gYear",
-                "Year",
-                " A particular 4 digit year YYYY - negative years are BCE.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:gMonth",
-                "Month",
-                "A particular month. An xsd:gMonth value. --MM",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:gDay",
-                "Day",
-                "A particular day. An xsd:gDay value. ---DD",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:gYearMonth",
-                "Year / Month",
-                "A year and a month. An xsd:gYearMonth value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:gMonthDay",
-                "Month / Day",
-                "A month and a day. An xsd:gMonthDay value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:duration",
-                "Duration",
-                "A period of time. An xsd:duration value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:yearMonthDuration",
-                "Year / Month Duration",
-                "A duration measured in years and months. An xsd:yearMonthDuration value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:dayTimeDuration",
-                "Day / Time Duration",
-                "A duration measured in days and time. An xsd:dayTimeDuration value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:byte", "Byte", "An xsd:byte value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:short", "Short", "An xsd:short value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:integer",
-                "Integer",
-                "A simple number. An xsd:integer value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:long", "Long", "An xsd:long value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:unsignedByte",
-                "Unsigned Byte",
-                "An xsd:unsignedByte value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:unsignedInt",
-                "Unsigned Integer",
-                "An xsd:unsignedInt value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:unsignedLong",
-                "Unsigned Long Integer",
-                "An xsd:unsignedLong value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:positiveInteger",
-                "Positive Integer",
-                "A simple number greater than 0. An xsd:positiveInteger value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:nonNegativeInteger",
-                "Non-Negative Integer",
-                "A simple number that can't be less than 0. An xsd:nonNegativeInteger value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:negativeInteger",
-                "Negative Integer",
-                "A negative integer. An xsd:negativeInteger value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:nonPositiveInteger",
-                "Non-Positive Integer",
-                "A number less than or equal to zero. An xsd:nonPositiveInteger value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:base64Binary",
-                "Base 64 Binary",
-                "An xsd:base64Binary value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:anyURI",
-                "Any URI",
-                "Any URl. An xsd:anyURI value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:language",
-                "Language",
-                "A natural language identifier as defined by by [RFC 3066] . An xsd:language value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:normalizedString",
-                "Normalized String",
-                "An xsd:normalizedString value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:token", "Token", "An xsd:token value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:NMTOKEN", "NMTOKEN", "An xsd:NMTOKEN value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:Name", "Name", "An xsd:Name value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:NCName", "NCName", "An xsd:NCName value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:NOTATION",
-                "NOTATION",
-                "An xsd:NOTATION value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xsd:QName", "QName", "An xsd:QName value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:ID", "ID", "An xsd:ID value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:IDREF", "IDREF", "An xsd:IDREF value.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xsd:ENTITY", "ENTITY", "An xsd:ENTITY value.", parent, graph, prefix
-            ),
-        )
-
-    def _load_xdd_boxes(self, parent, graph, prefix):
-        """A function to generate a query to create box classes for all of the xdd datatypes.
-        The format is to generate the box classes for xdd:anyGivenType as:
-         class(prefix:AnyGivenType) -> property(prefix:anyGivenType) -> datatype(xdd:anyGivenType)
-
-        Parameters
-        ----------
-        parent : str, optional
-            the parent class of the box_class
-        graph : str, optional
-            Graph
-        prefix : str, optional
-            prefix for the box_class_id
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        return WOQLQuery().woql_and(
-            self.box_datatype(
-                "xdd:coordinate",
-                "Coordinate",
-                "A particular location on the surface of the earth, defined by latitude and longitude . An xdd:coordinate value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xdd:coordinatePolygon",
-                "Geographic Area",
-                "A shape on a map which defines an area. within the defined set of coordinates   An xdd:coordinatePolygon value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xdd:coordinatePolyline",
-                "Coordinate Path",
-                "A set of coordinates forming a line on a map, representing a route. An xdd:coordinatePolyline value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype("xdd:url", "URL", "A valid url.", parent, graph, prefix),
-            self.box_datatype(
-                "xdd:email", "Email", "A valid email address.", parent, graph, prefix
-            ),
-            self.box_datatype(
-                "xdd:html", "HTML", "A safe HTML string", parent, graph, prefix
-            ),
-            self.box_datatype("xdd:json", "JSON", "A JSON Encoded String"),
-            self.box_datatype(
-                "xdd:gYearRange",
-                "Year",
-                "A 4-digit year, YYYY, or if uncertain, a range of years. An xdd:gYearRange value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xdd:integerRange",
-                "Integer",
-                "A simple number or range of numbers. An xdd:integerRange value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xdd:decimalRange",
-                "Decimal Number",
-                "A decimal value or, if uncertain, a range of decimal values. An xdd:decimalRange value.",
-                parent,
-                graph,
-                prefix,
-            ),
-            self.box_datatype(
-                "xdd:dateRange",
-                "Date Range",
-                "A date or a range of dates YYYY-MM-DD",
-                parent,
-                graph,
-                prefix,
-            ),
-        )
-
-    def box_datatype(
-        self,
-        datatype=None,
-        label=None,
-        descr=None,
-        parent=None,
-        graph=None,
-        prefix=None,
-    ):
-        """A utility function for boxing a datatype in woql.
-        The format is (predicate) prefix:datatype (domain) prefix:Datatype (range) xsd:datatype.
-
-        Parameters
-        ----------
-        datatype : str, optional
-            the datatype
-        label : str, optional
-            label for the data type
-        descr : str, optional
-            description for the datatype
-        parent : str, optional
-            the parent class of the box_class
-        graph : str, optional
-            Graph
-        prefix : str, optional
-            prefix for the box_class_id
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-
-        if not graph:
-            graph = self._graph
-        prefix = prefix if prefix else "scm:"
-        ext = datatype.split(":")[1]
-        box_class_id = prefix + ext[0].upper() + ext[1:]
-        box_prop_id = prefix + ext[0].lower() + ext[1:]
-        box_class = self.add_class(box_class_id, graph).label(label)
-        box_class.description("Boxed Class for " + datatype)
-        if parent:
-            box_class.parent(parent)
-        box_prop = (
-            self.add_property(box_prop_id, datatype, graph)
-            .label(label)
-            .domain(box_class_id)
-        )
-        if descr:
-            box_prop.description(descr)
-        return WOQLQuery().woql_and(box_class, box_prop)
-
-    def doctype(self, user_type, graph=None, label=None, description=None):
-        """Creates a new document class in the schema - equivalent to: add_quad(type, "rdf:type", "owl:Class", graph), add_quad(type, subclassof, tcs:Document, graph)
-
-        Parameters
-        ----------
-        user_type : str
-            type of the document
-        graph : str, optional
-            target graph
-        label : str, optional
-            label for the doctype
-        description : str, optional
-            description for the doctype
-
-        Returns
-        -------
-        WOQLQuery object
-            query object that can be chained and/or execute
-        """
-        if label is None and description is None:
-            return WOQLQuery().add_class(user_type, graph).parent("Document")
-
-        result_obj = WOQLQuery().doctype(user_type, graph)
-        if isinstance(label, str) and label:
-            result_obj = result_obj.label(label)
-        if isinstance(description, str) and description:
-            result_obj = result_obj.description(description)
-        return result_obj
-
     def vars(self, *args):
         """Generate variables to be used in WOQLQueries
         Parameters
diff --git a/terminusdb_client/woqlschema/__init__.py b/terminusdb_client/woqlschema/__init__.py
new file mode 100644
index 00000000..1b1d8f23
--- /dev/null
+++ b/terminusdb_client/woqlschema/__init__.py
@@ -0,0 +1,1 @@
+from .woql_schema import *  # noqa
diff --git a/terminusdb_client/woqlschema/woql_schema.py b/terminusdb_client/woqlschema/woql_schema.py
new file mode 100644
index 00000000..de180fc4
--- /dev/null
+++ b/terminusdb_client/woqlschema/woql_schema.py
@@ -0,0 +1,279 @@
+from copy import deepcopy
+from enum import Enum
+from hashlib import sha256
+from typing import Optional, Union
+from urllib.parse import quote
+from uuid import uuid4
+
+from numpydoc.docscrape import ClassDoc
+
+from .. import woql_type as wt
+from ..woql_type import CONVERT_TYPE
+from ..woqlclient.woqlClient import WOQLClient
+
+# from typeguard import check_type
+
+
+class TerminusKey(type):
+    pass
+
+
+class HashKey(metaclass=TerminusKey):
+    """Generating ID with SHA256 using provided keys"""
+
+    at_type = "Hash"
+
+    def __init__(self, keys: Union[str, list]):
+        self._keys = keys
+
+    def idgen(self, obj: "DocumentTemplate"):
+        key_list = []
+        for item in self._keys:
+            key_item = eval(f"obj.{item}")
+            if isinstance(key_item, tuple(CONVERT_TYPE.keys())):
+                key_list.append(str(key_item))
+            else:
+                raise ValueError("Keys need to be datatype object")
+        if hasattr(obj.__class__, "_base"):
+            prefix = obj.__class__._base
+        else:
+            prefix = obj.__class__.__name__ + "_"
+        return prefix + sha256((quote("_".join(key_list))).encode("utf-8")).hexdigest()
+
+
+class LexicalKey(metaclass=TerminusKey):
+    """Generating ID with urllib.parse.quote using provided keys"""
+
+    at_type = "Lexical"
+
+    def __init__(self, keys: Union[str, list]):
+        self._keys = keys
+
+    def idgen(self, obj: "DocumentTemplate"):
+        key_list = []
+        for item in self._keys:
+            key_item = eval(f"obj.{item}")
+            if isinstance(key_item, tuple(CONVERT_TYPE.keys())):
+                key_list.append(str(key_item))
+            else:
+                raise ValueError("Keys need to be datatype object")
+        if hasattr(obj.__class__, "_base"):
+            prefix = obj.__class__._base
+        else:
+            prefix = obj.__class__.__name__ + "_"
+        return prefix + quote("_".join(key_list))
+
+
+class ValueHashKey(metaclass=TerminusKey):
+    """Generating ID with SHA256"""
+
+    at_type = "ValueHash"
+
+    # def idgen(self, obj: "DocumentTemplate"):
+    #     if hasattr(obj.__class__, "_base"):
+    #         prefix = obj.__class__._base
+    #     else:
+    #         prefix = obj.__class__.__name__ + "_"
+    #     return prefix + sha256((quote(str(obj))).encode("utf-8")).hexdigest()
+
+
+class RandomKey(metaclass=TerminusKey):
+    """Generating ID with UUID4"""
+
+    at_type = "Random"
+
+    def idgen(self, obj: "DocumentTemplate"):
+        if hasattr(obj.__class__, "_base"):
+            prefix = obj.__class__._base
+        else:
+            prefix = obj.__class__.__name__ + "_"
+        return prefix + uuid4().hex
+
+
+class TerminusClass(type):
+    def __init__(cls, name, bases, nmspc):
+
+        if "__annotations__" in nmspc:
+            annotations = nmspc["__annotations__"]
+        else:
+            nmspc["__annotations__"] = {}
+            annotations = nmspc["__annotations__"]
+
+        for parent in bases:
+            base_annotations = (
+                parent.__annotations__ if hasattr(parent, "__annotations__") else {}
+            )
+            annotations.update(base_annotations)
+
+        if hasattr(cls, "_abstract"):
+            abstract = cls._abstract
+        else:
+            abstract = False
+
+        def init(obj, *args, **kwargs):
+            if abstract:
+                raise TypeError(f"{name} is an abstract class.")
+            for key in annotations:
+                if key in kwargs:
+                    value = kwargs[key]
+                    # ty = annotations[key]
+                    # if type(ty) == _GenericAlias:
+                    #     try:
+                    #         check_type('value',value,ty)
+                    #     except TypeError as e:
+                    #         message = f"Bad type for member: '{key}' with value '{value}' because " + e.__str__()
+                    #         raise TypeError(message)
+                    # elif isinstance(value,ty):
+                    #     pass
+                    # else:
+                    #     raise TypeError(f"Bad type for member: '{key}' with value '{value}' and type '{ty.__name__}'")
+                else:
+                    value = None
+                setattr(obj, key, value)
+            obj._annotations = annotations
+
+        cls.__init__ = init
+
+        if cls._schema is not None:
+            if not hasattr(cls._schema, "object"):
+                cls._schema.object = set()
+            cls._schema.add_obj(cls)
+
+        super().__init__(name, bases, nmspc)
+
+    def __repr__(cls):
+        return cls.__name__
+
+
+class DocumentTemplate(metaclass=TerminusClass):
+    _schema = None
+    _key = RandomKey()  # default key
+
+    def __init__(self):
+        self._new = True
+
+    # def _commit(self, client: WOQLClient):
+    #     pass
+
+    @classmethod
+    def _to_dict(cls):
+        result = {"@type": "Class", "@id": cls.__name__}
+        if cls.__base__.__name__ != "DocumentTemplate":
+            # result["@inherits"] = cls.__base__.__name__
+            parents = list(map(lambda x: x.__name__, cls.__mro__))
+            result["@inherits"] = parents[1 : parents.index("DocumentTemplate")]
+        elif cls.__base__.__name__ == "TaggedUnion":
+            result["@type"] = "TaggedUnion"
+
+        if cls.__doc__:
+            doc_obj = ClassDoc(cls)
+            result["@documentation"] = {
+                "@comment": "\n".join(doc_obj["Summary"] + doc_obj["Extended Summary"]),
+                "@properties": {
+                    thing.name: "\n".join(thing.desc) for thing in doc_obj["Attributes"]
+                },
+            }
+
+        if hasattr(cls, "_base"):
+            result["@base"] = cls._base
+        if hasattr(cls, "_subdocument"):
+            result["@subdocument"] = cls._subdocument
+            result["@key"] = {"@type": "Random"}
+        if hasattr(cls, "_abstract"):
+            result["@abstract"] = cls._abstract
+        if hasattr(cls, "_key") and not hasattr(cls, "_subdocument"):
+            if hasattr(cls._key, "_keys"):
+                result["@key"] = {
+                    "@type": cls._key.__class__.at_type,
+                    "@fields": cls._key._keys,
+                }
+            else:
+                result["@key"] = {"@type": cls._key.__class__.at_type}
+        if hasattr(cls, "__annotations__"):
+            for attr, attr_type in cls.__annotations__.items():
+                result[attr] = wt.to_woql_type(attr_type)
+        return result
+
+    def _obj_to_dict(self):
+        result = {"@type": str(self.__class__)}
+        if hasattr(self, "_id"):
+            result["@id"] = self._id
+        for item in self._annotations.keys():
+            if hasattr(self, item):
+                the_item = eval(f"self.{item}")
+                if the_item is not None:
+                    if hasattr(the_item.__class__, "_subdocument") or (
+                        hasattr(the_item.__class__, "_key")
+                        and not hasattr(the_item.__class__._key, "idgen")
+                    ):
+                        result[item] = the_item._obj_to_dict()
+                    elif hasattr(the_item, "_id"):
+                        result[item] = {"@id": the_item._id, "@type": "@id"}
+                    else:
+                        if isinstance(the_item, Enum):
+                            result[item] = str(the_item)
+                        else:
+                            result[item] = the_item
+        return result
+
+
+class EnumTemplate(Enum):
+    # def __new__(cls, *args):
+    #     if args:
+    #         value = args[0]
+    #         if not hasattr(value, "object"):
+    #             value.object = set()
+    #         value.object.add(cls)
+    #         return None
+    #     obj = object.__new__(cls)
+    #     obj._value_ = obj.name
+    #     return obj
+    def __init__(self, value=None):
+        if self.name == "_schema":
+            if not hasattr(value, "object"):
+                value.object = set()
+            value.object.add(self.__class__)
+        elif not value:
+            self._value_ = str(self.name)
+        else:
+            self._value_ = value
+
+    def __str__(self):
+        return self._value_
+
+    @classmethod
+    def _to_dict(cls):
+        result = {"@type": "Enum", "@id": cls.__name__, "@value": []}
+        for item in cls.__members__:
+            if item[0] != "_":
+                result["@value"].append(str(eval(f"cls.{item}")))
+        # if hasattr(self, "__annotations__"):
+        #     for attr, attr_type in self.__annotations__.items():
+        #         result[attr] = str(attr_type)
+        return result
+
+
+class TaggedUnion(DocumentTemplate):
+    pass
+
+
+class WOQLSchema:
+    def __init__(self):
+        self.object = set()
+
+    def commit(self, client: WOQLClient, commit_msg: Optional[str] = None):
+        client.insert_document(
+            self.to_dict(), commit_msg=commit_msg, graph_type="schema"
+        )
+
+    def add_obj(self, obj):
+        self.object.add(obj)
+
+    def all_obj(self):
+        return self.object
+
+    def to_dict(self):
+        return list(map(lambda cls: cls._to_dict(), self.object))
+
+    def copy(self):
+        return deepcopy(self)
diff --git a/tox.ini b/tox.ini
index 77e77d3d..510c3bf0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -35,7 +35,7 @@ commands =
 # Settings for other tools
 [flake8]
 # S501 is turned off for now, check if the verify=false for request is ok
-ignore = E501,W503,S101,S310,A003,E203,S607,S603,S404,W391
+ignore = E501,W503,S101,S310,A003,E203,S607,S603,S404,W391, N814
 exclude = .*/,__pycache__,docs/,build/
 
 [isort]


Test patch:
diff --git a/terminusdb_client/tests/ans_cardinality.py b/terminusdb_client/tests/ans_cardinality.py
index 5efa9cc9..91667b49 100644
--- a/terminusdb_client/tests/ans_cardinality.py
+++ b/terminusdb_client/tests/ans_cardinality.py
@@ -4,111 +4,83 @@
 @pytest.fixture(scope="module")
 def property_max():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "And",
+        "and": [
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DatatypeProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:range",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:string"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:range",
                 },
+                "object": {"@type": "Value", "node": "xsd:string"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:A"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:domain",
                 },
+                "object": {"@type": "Value", "node": "scm:A"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P_max"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:Restriction",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P_max"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:Restriction",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P_max"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:onProperty",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P_max"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "owl:onProperty",
                 },
+                "object": {"@type": "Value", "node": "scm:P"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 5},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P_max"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:maxCardinality",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": 4,
-                            "@type": "xsd:nonNegativeInteger",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P_max"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "owl:maxCardinality",
+                },
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": 4,
+                        "@type": "xsd:nonNegativeInteger",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 6},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:A"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:P_max"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:A"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
                 },
+                "object": {"@type": "Value", "node": "scm:P_max"},
+                "graph": "schema",
             },
         ],
     }
@@ -117,111 +89,83 @@ def property_max():
 @pytest.fixture(scope="module")
 def property_min():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "And",
+        "and": [
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DatatypeProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:range",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:string"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:range",
                 },
+                "object": {"@type": "Value", "node": "xsd:string"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:A"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:domain",
                 },
+                "object": {"@type": "Value", "node": "scm:A"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P_min"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:Restriction",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P_min"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:Restriction",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P_min"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:onProperty",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P_min"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "owl:onProperty",
                 },
+                "object": {"@type": "Value", "node": "scm:P"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 5},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P_min"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:minCardinality",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": 2,
-                            "@type": "xsd:nonNegativeInteger",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P_min"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "owl:minCardinality",
+                },
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": 2,
+                        "@type": "xsd:nonNegativeInteger",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 6},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:A"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:P_min"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:A"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
                 },
+                "object": {"@type": "Value", "node": "scm:P_min"},
+                "graph": "schema",
             },
         ],
     }
@@ -230,123 +174,95 @@ def property_min():
 @pytest.fixture(scope="module")
 def property_cardinalty():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "And",
+        "and": [
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DatatypeProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:range",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:string"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:range",
                 },
+                "object": {"@type": "Value", "node": "xsd:string"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:A"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:P"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:domain",
                 },
+                "object": {"@type": "Value", "node": "scm:A"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:P_cardinality",
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:Restriction",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "node": "scm:P_cardinality",
+                },
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:Restriction",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:P_cardinality",
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:onProperty",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:P"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "node": "scm:P_cardinality",
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "owl:onProperty",
                 },
+                "object": {"@type": "Value", "node": "scm:P"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 5},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:P_cardinality",
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:cardinality",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": 3,
-                            "@type": "xsd:nonNegativeInteger",
-                        },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "node": "scm:P_cardinality",
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "owl:cardinality",
+                },
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": 3,
+                        "@type": "xsd:nonNegativeInteger",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 6},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:A"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:P_cardinality",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:A"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
+                },
+                "object": {
+                    "@type": "Value",
+                    "node": "scm:P_cardinality",
                 },
+                "graph": "schema",
             },
         ],
     }
@@ -355,137 +271,86 @@ def property_cardinalty():
 @pytest.fixture(scope="module")
 def chain_insert():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Node_ID",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "Type", "@type": "xsd:string"},
-                    },
+        "@type": "And",
+        "and": [
+            {
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Node_ID",
+                },
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "variable": "Type"
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Node_ID",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Label",
-                            "@type": "xsd:string",
-                        },
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Node_ID"
+                },
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "variable": "Label"
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Node_ID",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:comment",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Description",
-                            "@type": "xsd:string",
-                        },
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Node_ID"
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:comment",
+                },
+                "object": {
+                    "@type": "Value",
+                    "variable":  "Description"
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Node_ID",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:prop"},
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "Prop", "@type": "xsd:string"},
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable":  "Node_ID",
+                },
+                "predicate": {"@type": "NodeValue", "node": "scm:prop"},
+                "object": {
+                    "@type": "Value",
+                    "variable": "Prop",
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Node_ID",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:prop"},
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Prop2",
-                            "@type": "xsd:string",
-                        },
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Node_ID",
+                },
+                "predicate": {"@type": "NodeValue", "node": "scm:prop"},
+                "object": {
+                    "@type": "Value",
+                    "variable": "Prop2",
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 5},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Node_ID",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:myParentClass",
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Node_ID"
                 },
-            },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
+                },
+                "object": {
+                    "@type": "Value",
+                    "node": "scm:myParentClass",
+                },
+            }
         ],
     }
 
@@ -493,188 +358,140 @@ def chain_insert():
 @pytest.fixture(scope="module")
 def chain_doctype():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:MyDoc"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
-            },
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:MyDoc"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
-            },
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:MyDoc"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "abc",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "And",
+        "and": [
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:MyDoc"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {"@type": "Value", "node": "owl:Class"},
+                "graph": "schema",
+            },
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:MyDoc"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
+                },
+                "object": {
+                    "@type": "Value",
+                    "node": "terminus:Document",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:MyDoc"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:comment",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "abcd",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:MyDoc"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "abc",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:MyDoc"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:comment",
+                },
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "abcd",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 5},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:range"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:dateTime"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DatatypeProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 6},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:MyDoc"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
-            },
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 7},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "aaa",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:range"},
+                "object": {"@type": "Value", "node": "xsd:dateTime"},
+                "graph": "schema",
+            },
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:domain",
                 },
+                "object": {"@type": "Value", "node": "scm:MyDoc"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 8},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop2"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "aaa",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 9},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop2"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:range"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:integer"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop2"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DatatypeProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 10},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop2"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:MyDoc"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
-            },
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 11},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:prop2"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "abe",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop2"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:range"},
+                "object": {"@type": "Value", "node": "xsd:integer"},
+                "graph": "schema",
+            },
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop2"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:domain",
+                },
+                "object": {"@type": "Value", "node": "scm:MyDoc"},
+                "graph": "schema",
+            },
+            {
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "scm:prop2"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "abe",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
         ],
     }
diff --git a/terminusdb_client/tests/ans_doctype.py b/terminusdb_client/tests/ans_doctype.py
index 21fb6502..319d7c4d 100644
--- a/terminusdb_client/tests/ans_doctype.py
+++ b/terminusdb_client/tests/ans_doctype.py
@@ -4,35 +4,27 @@
 @pytest.fixture(scope="module")
 def doctype_without():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                },
+                "@type": "AddTriple",
+                "graph": "schema",
+                "object": {"@type": "NodeValue", "node": "owl:Class"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "subject": {"@type": "Value", "node": "Station"},
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
+                "@type": "AddTriple",
+                "graph": "schema",
+                "object": {
+                    "@type": "NodeValue",
+                    "node": "terminus:Document",
                 },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
+                },
+                "subject": {"@type": "Value", "node": "Station"},
             },
         ],
     }
@@ -41,53 +33,41 @@ def doctype_without():
 @pytest.fixture(scope="module")
 def doctype_with_label():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {"@type": "Value", "node": "owl:Class"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
                 },
+                "object": {
+                    "@type": "Value",
+                    "node": "terminus:Document",
+                },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "Station Object",
-                            "@type": "xsd:string",
-                            "@language": "en",
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "Station Object",
+                        "@type": "xsd:string",
+                        "@language": "en",
                         },
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
         ],
     }
@@ -96,74 +76,58 @@ def doctype_with_label():
 @pytest.fixture(scope="module")
 def doctype_with_des():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {"@type": "Value", "node": "owl:Class"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
+                },
+                "object": {
+                    "@type": "Value",
+                    "node": "terminus:Document",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "Station Object",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "Station Object",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:comment",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "A bike station object.",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Station"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:comment",
+                },
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "A bike station object.",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
         ],
     }
diff --git a/terminusdb_client/tests/ans_insert.py b/terminusdb_client/tests/ans_insert.py
index e8859927..b8fa82e8 100644
--- a/terminusdb_client/tests/ans_insert.py
+++ b/terminusdb_client/tests/ans_insert.py
@@ -4,82 +4,55 @@
 @pytest.fixture(scope="module")
 def insert_without():
     return {
-        "@type": "woql:AddTriple",
-        "woql:subject": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Bike_URL", "@type": "xsd:string"},
+        "@type": "AddTriple",
+        "subject": {
+            "@type": "NodeValue",
+            "variable": "Bike_URL",
         },
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-        "woql:object": {"@type": "woql:Node", "woql:node": "scm:Bicycle"},
+        "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+        "object": {"@type": "Value", "node": "Bicycle"},
     }
 
 
 @pytest.fixture(scope="module")
 def insert_with_des():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Bike_URL",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:Bicycle"},
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Bike_URL"
                 },
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {"@type": "Value", "node": "Bicycle"},
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Bike_URL",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Bike_Label",
-                            "@type": "xsd:string",
-                        },
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Bike_URL"
+                },
+                "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                "object": {
+                    "@type": "Value",
+                    "variable": "Bike_Label"
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddTriple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Bike_URL",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:comment",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Bike_Des",
-                            "@type": "xsd:string",
-                        },
-                    },
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Bike_URL"
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:comment",
+                },
+                "object": {
+                    "@type": "Value",
+                    "variable": "Bike_Des",
                 },
             },
         ],
diff --git a/terminusdb_client/tests/ans_property.py b/terminusdb_client/tests/ans_property.py
index 35a8a41e..38ba3a4b 100644
--- a/terminusdb_client/tests/ans_property.py
+++ b/terminusdb_client/tests/ans_property.py
@@ -4,74 +4,54 @@
 @pytest.fixture(scope="module")
 def property_without():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
-            {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+        "@type": "And",
+        "and": [
+             {
+                 "@type": "AddTriple",
+                 "subject": {"@type": "NodeValue", "node": "Journey"},
+                 "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                 "object": {"@type": "Value", "node": "owl:Class"},
+                 "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Journey"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:subClassOf",
+                },
+                "object": {
+                    "@type": "Value",
+                    "node": "terminus:Document",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Duration"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DatatypeProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:range"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:dateTime"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Duration"},
+                "predicate": {"@type": "NodeValue", "node": "rdfs:range"},
+                "object": {"@type": "Value", "node": "xsd:dateTime"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "Duration"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:domain",
                 },
+                "object": {"@type": "Value", "node": "Journey"},
+                "graph": "schema",
             },
         ],
     }
@@ -80,113 +60,85 @@ def property_without():
 @pytest.fixture(scope="module")
 def property_with_des():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Journey"},
+                    "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                    "object": {"@type": "Value", "node": "owl:Class"},
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Journey"},
+                    "predicate": {
+                        "@type": "NodeValue",
+                        "node": "rdfs:subClassOf",
                     },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
+                    "object": {
+                        "@type": "Value",
+                        "node": "terminus:Document",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Duration"},
+                    "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                    "object": {
+                        "@type": "Value",
+                        "node": "owl:DatatypeProperty",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:range"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:dateTime"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Duration"},
+                    "predicate": {"@type": "NodeValue", "node": "rdfs:range"},
+                    "object": {"@type": "Value", "node": "xsd:dateTime"},
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Duration"},
+                    "predicate": {
+                        "@type": "NodeValue",
+                        "node": "rdfs:domain",
                     },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "object": {"@type": "Value", "node": "Journey"},
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 5},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Duration"},
+                    "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+                    "object": {
+                        "@type": "Value",
+                        "data": {
                             "@value": "Journey Duration",
                             "@type": "xsd:string",
                             "@language": "en",
                         },
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 6},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Duration"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:comment",
+                    "@type": "AddTriple",
+                    "subject": {"@type": "Value", "node": "Duration"},
+                    "predicate": {
+                        "@type": "NodeValue",
+                        "node": "rdfs:comment",
                     },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
+                    "object": {
+                        "@type": "Value",
+                        "data": {
                             "@value": "Journey duration in minutes.",
                             "@type": "xsd:string",
                             "@language": "en",
                         },
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "graph": "schema",
             },
         ],
     }
@@ -195,83 +147,63 @@ def property_with_des():
 @pytest.fixture(scope="module")
 def obj_property_without():
     return {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Journey"},
+                    "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                    "object": {"@type": "Value", "node": "owl:Class"},
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:subClassOf",
+                    "@type": "AddTriple",
+                    "subject": {"@type": "NodeValue", "node": "Journey"},
+                    "predicate": {
+                        "@type": "NodeValue",
+                        "node": "rdfs:subClassOf",
                     },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "terminus:Document",
+                    "object": {
+                        "@type": "Value",
+                        "node": "terminus:Document",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:start_station",
+                    "@type": "AddTriple",
+                    "subject": {
+                        "@type": "NodeValue",
+                        "node": "start_station",
                     },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:ObjectProperty",
+                    "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                    "object": {
+                        "@type": "Value",
+                        "node": "owl:ObjectProperty",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 3},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:start_station",
+                    "@type": "AddTriple",
+                    "subject": {
+                        "@type": "NodeValue",
+                        "node": "start_station",
                     },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:range"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "predicate": {"@type": "NodeValue", "node": "rdfs:range"},
+                    "object": {"@type": "Value", "node": "Station"},
+                    "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 4},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:start_station",
+                    "@type": "AddTriple",
+                    "subject": {
+                        "@type": "NodeValue",
+                        "node": "start_station",
                     },
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:domain",
+                    "predicate": {
+                        "@type": "NodeValue",
+                        "node": "rdfs:domain",
                     },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:Journey"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                    "object": {"@type": "Value", "node": "Journey"},
+                    "graph": "schema",
             },
         ],
     }
diff --git a/terminusdb_client/tests/ans_triple_quad.py b/terminusdb_client/tests/ans_triple_quad.py
index 0c9a737f..07d990ea 100644
--- a/terminusdb_client/tests/ans_triple_quad.py
+++ b/terminusdb_client/tests/ans_triple_quad.py
@@ -4,14 +4,14 @@
 @pytest.fixture(scope="module")
 def triple_opt():
     return {
-        "@type": "woql:Optional",
-        "woql:query": {
-            "@type": "woql:Triple",
-            "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-            "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-            "woql:object": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "Optional",
+        "query": {
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "a"},
+            "predicate": {"@type": "NodeValue", "node": "b"},
+            "object": {
+                "@type": "Value",
+                "data": {"@type": "xsd:string", "@value": "c"},
             },
         },
     }
@@ -20,15 +20,15 @@ def triple_opt():
 @pytest.fixture(scope="module")
 def quad_opt():
     return {
-        "@type": "woql:Optional",
-        "woql:query": {
-            "@type": "woql:Quad",
-            "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-            "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-            "woql:object": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "Optional",
+        "query": {
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "a"},
+            "predicate": {"@type": "NodeValue", "node": "b"},
+            "object": {
+                "@type": "Value",
+                "data": {"@type": "xsd:string", "@value": "c"},
             },
-            "woql:graph_filter": {"@type": "xsd:string", "@value": "d"},
+            "graph_filter": "d",
         },
     }
diff --git a/terminusdb_client/tests/integration_tests/test_bank.py b/terminusdb_client/tests/integration_tests/test_bank.py
index 4b8e6bbe..fcbcf24f 100644
--- a/terminusdb_client/tests/integration_tests/test_bank.py
+++ b/terminusdb_client/tests/integration_tests/test_bank.py
@@ -1,97 +1,97 @@
-import pytest
-
-from terminusdb_client.errors import DatabaseError
-from terminusdb_client.woqlclient.woqlClient import WOQLClient
-from terminusdb_client.woqlquery.woql_query import WOQLQuery
-
-
-def test_bank_tutorial(docker_url):
-
-    user = "admin"
-    account = "admin"
-    key = "root"
-    dbid = "bank_balance_example"
-    repository = "local"
-    label = "Bank Balance Example"
-    description = "An example database for playing with bank accounts"
-
-    client = WOQLClient(docker_url)
-    client.connect(user=user, account=account, key=key)
-    client.create_database(dbid, user, label=label, description=description)
-
-    # Add the schema (there is no harm in adding repeatedly as it is idempotent)
-    WOQLQuery().woql_and(
-        WOQLQuery()
-        .doctype("scm:BankAccount")
-        .label("Bank Account")
-        .description("A bank account")
-        .property("scm:owner", "xsd:string")
-        .label("owner")
-        .cardinality(1)
-        .property("scm:balance", "xsd:nonNegativeInteger")
-        .label("owner")
-    ).execute(client, "Adding bank account object to schema")
-
-    # Fix bug in schema
-    WOQLQuery().woql_and(
-        WOQLQuery().delete_quad("scm:balance", "label", "owner", "schema/main"),
-        WOQLQuery().add_quad("scm:balance", "label", "balance", "schema/main"),
-    ).execute(client, "Label for balance was wrong")
-
-    # Add the data from csv to the main branch (again idempotent as widget ids are chosen from sku)
-    WOQLQuery().woql_and(
-        WOQLQuery()
-        .insert("doc:mike", "scm:BankAccount")
-        .property("scm:owner", "mike")
-        .property("scm:balance", 123)
-    ).execute(client, "Add mike")
-
-    # try to make mike go below zero
-    balance, new_balance = WOQLQuery().vars("Balance", "New Balance")
-    with pytest.raises(DatabaseError):
-        WOQLQuery().woql_and(
-            WOQLQuery().triple("doc:mike", "scm:balance", balance),
-            WOQLQuery().delete_triple("doc:mike", "scm:balance", balance),
-            WOQLQuery().eval(WOQLQuery().minus(balance, 130), new_balance),
-            WOQLQuery().add_triple("doc:mike", "scm:balance", new_balance),
-        ).execute(client, "Update mike")
-
-    # Subtract less
-    WOQLQuery().woql_and(
-        WOQLQuery().triple("doc:mike", "scm:balance", balance),
-        WOQLQuery().delete_triple("doc:mike", "scm:balance", balance),
-        WOQLQuery().eval(WOQLQuery().minus(balance, 110), new_balance),
-        WOQLQuery().add_triple("doc:mike", "scm:balance", new_balance),
-    ).execute(client, "Update mike")
-
-    # Make the "branch_office" branch
-    branch = "branch_office"
-    client.branch(branch)
-
-    # Add some data to the branch
-    client.checkout(branch)
-    WOQLQuery().woql_and(
-        WOQLQuery()
-        .insert("doc:jim", "scm:BankAccount")
-        .property("owner", "jim")
-        .property("balance", 8)
-    ).execute(client, "Adding Jim")
-
-    # Return to the 'main' branch and add Jane
-    client.checkout("main")
-    WOQLQuery().woql_and(
-        WOQLQuery()
-        .insert("doc:jane", "scm:BankAccount")
-        .property("owner", "jane")
-        .property("balance", 887)
-    ).execute(client, "Adding Jane")
-
-    client.rebase(
-        rebase_source=f"{user}/{dbid}/{repository}/branch/{branch}",
-        author=user,
-        message="Merging jim in from branch_office",
-    )
-    result = WOQLQuery().triple("doc:jim", "scm:balance", 8).execute(client)
-    assert (
-        len(result.get("bindings")) == 1
-    )  # if jim is there, the length of the binding should be 1, if not it will be 0
+# import pytest
+#
+# from terminusdb_client.errors import DatabaseError
+# from terminusdb_client.woqlclient.woqlClient import WOQLClient
+# from terminusdb_client.woqlquery.woql_query import WOQLQuery
+#
+#
+# def test_bank_tutorial(docker_url):
+#
+#     user = "admin"
+#     account = "admin"
+#     key = "root"
+#     dbid = "bank_balance_example"
+#     repository = "local"
+#     label = "Bank Balance Example"
+#     description = "An example database for playing with bank accounts"
+#
+#     client = WOQLClient(docker_url)
+#     client.connect(user=user, account=account, key=key)
+#     client.create_database(dbid, user, label=label, description=description)
+#
+#     # Add the schema (there is no harm in adding repeatedly as it is idempotent)
+#     WOQLQuery().woql_and(
+#         WOQLQuery()
+#         .doctype("scm:BankAccount")
+#         .label("Bank Account")
+#         .description("A bank account")
+#         .property("scm:owner", "xsd:string")
+#         .label("owner")
+#         .cardinality(1)
+#         .property("scm:balance", "xsd:nonNegativeInteger")
+#         .label("owner")
+#     ).execute(client, "Adding bank account object to schema")
+#
+#     # Fix bug in schema
+#     WOQLQuery().woql_and(
+#         WOQLQuery().delete_quad("scm:balance", "label", "owner", "schema"),
+#         WOQLQuery().add_quad("scm:balance", "label", "balance", "schema"),
+#     ).execute(client, "Label for balance was wrong")
+#
+#     # Add the data from csv to the main branch (again idempotent as widget ids are chosen from sku)
+#     WOQLQuery().woql_and(
+#         WOQLQuery()
+#         .insert("doc:mike", "scm:BankAccount")
+#         .property("scm:owner", "mike")
+#         .property("scm:balance", 123)
+#     ).execute(client, "Add mike")
+#
+#     # try to make mike go below zero
+#     balance, new_balance = WOQLQuery().vars("Balance", "New Balance")
+#     with pytest.raises(DatabaseError):
+#         WOQLQuery().woql_and(
+#             WOQLQuery().triple("doc:mike", "scm:balance", balance),
+#             WOQLQuery().delete_triple("doc:mike", "scm:balance", balance),
+#             WOQLQuery().eval(WOQLQuery().minus(balance, 130), new_balance),
+#             WOQLQuery().add_triple("doc:mike", "scm:balance", new_balance),
+#         ).execute(client, "Update mike")
+#
+#     # Subtract less
+#     WOQLQuery().woql_and(
+#         WOQLQuery().triple("doc:mike", "scm:balance", balance),
+#         WOQLQuery().delete_triple("doc:mike", "scm:balance", balance),
+#         WOQLQuery().eval(WOQLQuery().minus(balance, 110), new_balance),
+#         WOQLQuery().add_triple("doc:mike", "scm:balance", new_balance),
+#     ).execute(client, "Update mike")
+#
+#     # Make the "branch_office" branch
+#     branch = "branch_office"
+#     client.branch(branch)
+#
+#     # Add some data to the branch
+#     client.checkout(branch)
+#     WOQLQuery().woql_and(
+#         WOQLQuery()
+#         .insert("doc:jim", "scm:BankAccount")
+#         .property("owner", "jim")
+#         .property("balance", 8)
+#     ).execute(client, "Adding Jim")
+#
+#     # Return to the 'main' branch and add Jane
+#     client.checkout("main")
+#     WOQLQuery().woql_and(
+#         WOQLQuery()
+#         .insert("doc:jane", "scm:BankAccount")
+#         .property("owner", "jane")
+#         .property("balance", 887)
+#     ).execute(client, "Adding Jane")
+#
+#     client.rebase(
+#         rebase_source=f"{user}/{dbid}/{repository}/branch/{branch}",
+#         author=user,
+#         message="Merging jim in from branch_office",
+#     )
+#     result = WOQLQuery().triple("doc:jim", "scm:balance", 8).execute(client)
+#     assert (
+#         len(result.get("bindings")) == 1
+#     )  # if jim is there, the length of the binding should be 1, if not it will be 0
diff --git a/terminusdb_client/tests/integration_tests/test_client.py b/terminusdb_client/tests/integration_tests/test_client.py
index 25a22182..5363b2f2 100644
--- a/terminusdb_client/tests/integration_tests/test_client.py
+++ b/terminusdb_client/tests/integration_tests/test_client.py
@@ -1,105 +1,105 @@
-import csv
-import filecmp
-import os
-
-from terminusdb_client.woqlclient.woqlClient import WOQLClient
-from terminusdb_client.woqlquery.woql_query import WOQLQuery
-
-
-def test_happy_path(docker_url):
-    # create client
-    client = WOQLClient(docker_url)
-    assert not client._connected
-    # test connect
-    client.connect()
-    assert client._connected
-    # test create db
-    client.create_database("test_happy_path", prefixes={"doc": "foo://"})
-    init_commit = client._get_current_commit()
-    assert client._db == "test_happy_path"
-    assert "test_happy_path" in client.list_databases()
-    assert client._context.get("doc") == "foo://"
-    assert len(client.get_commit_history()) == 1
-    # test adding doctype
-    WOQLQuery().doctype("Station").execute(client)
-    first_commit = client._get_current_commit()
-    target_commit = client._get_target_commit(1)
-    assert first_commit != init_commit
-    assert target_commit == init_commit.split("_")[-1]
-    commit_history = client.get_commit_history()
-    assert len(commit_history) == 2
-    assert len(client.get_commit_history(2)) == 2
-    assert len(client.get_commit_history(1)) == 1
-    assert len(client.get_commit_history(0)) == 1
-    assert commit_history[0]["commit"] == first_commit.split("_")[-1]
-    assert commit_history[1]["commit"] == init_commit.split("_")[-1]
-    # test resrt
-    client.reset(commit_history[1]["commit"])
-    assert client._get_current_commit() == init_commit
-
-    client.delete_database("test_happy_path", "admin")
-    assert client._db is None
-    assert "test_happy_path" not in client.list_databases()
-
-
-def _generate_csv(option):
-    if option == 1:
-        file_path = "employee_file.csv"
-        with open(file_path, mode="w") as employee_file:
-            employee_writer = csv.writer(
-                employee_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
-            )
-            employee_writer.writerow(["John Smith", "Accounting", "November"])
-            employee_writer.writerow(["Erica Meyers", "IT", "March"])
-        return file_path
-    else:
-        file_path = "employee_file.csv"
-        with open(file_path, mode="w") as employee_file:
-            employee_writer = csv.writer(
-                employee_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
-            )
-            employee_writer.writerow(["Cow Duck", "Marketing", "April"])
-        return file_path
-
-
-def _file_clean_up(filename):
-    if os.path.exists(filename):
-        os.remove(filename)
-
-
-def test_csv_handeling(docker_url):
-    client = WOQLClient(docker_url)
-    assert not client._connected
-    # test connect
-    client.connect()
-    assert client._connected
-    # test create db
-    client.create_database("test_csv")
-    client._get_current_commit()
-    assert client._db == "test_csv"
-    assert "test_csv" in client.list_databases()
-    csv_file_path = _generate_csv(1)  # create testing csv
-    try:
-        client.insert_csv(csv_file_path)
-        client.get_csv(csv_file_path, csv_output_name="new_" + csv_file_path)
-        assert filecmp.cmp(csv_file_path, "new_" + csv_file_path)
-        csv_file_path = _generate_csv(2)
-        client.update_csv(csv_file_path)
-        client.get_csv(csv_file_path, csv_output_name="update_" + csv_file_path)
-        assert not filecmp.cmp("new_" + csv_file_path, "update_" + csv_file_path)
-    finally:
-        _file_clean_up(csv_file_path)
-        _file_clean_up("new_" + csv_file_path)
-        _file_clean_up("update_" + csv_file_path)
-
-
-def test_create_graph(docker_url):
-    client = WOQLClient(docker_url)
-    assert not client._connected
-    # test connect
-    client.connect()
-    assert client._connected
-    # test create db
-    client.create_database("test_graph")
-    client.create_graph("instance", "test-one-more-graph", "create test graph")
-    client.delete_graph("instance", "test-one-more-graph", "delete test graph")
+# import csv
+# import filecmp
+# import os
+#
+# from terminusdb_client.woqlclient.woqlClient import WOQLClient
+# from terminusdb_client.woqlquery.woql_query import WOQLQuery
+#
+#
+# def test_happy_path(docker_url):
+#     # create client
+#     client = WOQLClient(docker_url)
+#     assert not client._connected
+#     # test connect
+#     client.connect()
+#     assert client._connected
+#     # test create db
+#     client.create_database("test_happy_path", prefixes={"doc": "foo://"})
+#     init_commit = client._get_current_commit()
+#     assert client._db == "test_happy_path"
+#     assert "test_happy_path" in client.list_databases()
+#     assert client._context.get("doc") == "foo://"
+#     assert len(client.get_commit_history()) == 1
+#     # test adding doctype
+#     WOQLQuery().doctype("Station").execute(client)
+#     first_commit = client._get_current_commit()
+#     target_commit = client._get_target_commit(1)
+#     assert first_commit != init_commit
+#     assert target_commit == init_commit.split("_")[-1]
+#     commit_history = client.get_commit_history()
+#     assert len(commit_history) == 2
+#     assert len(client.get_commit_history(2)) == 2
+#     assert len(client.get_commit_history(1)) == 1
+#     assert len(client.get_commit_history(0)) == 1
+#     assert commit_history[0]["commit"] == first_commit.split("_")[-1]
+#     assert commit_history[1]["commit"] == init_commit.split("_")[-1]
+#     # test resrt
+#     client.reset(commit_history[1]["commit"])
+#     assert client._get_current_commit() == init_commit
+#
+#     client.delete_database("test_happy_path", "admin")
+#     assert client._db is None
+#     assert "test_happy_path" not in client.list_databases()
+#
+#
+# def _generate_csv(option):
+#     if option == 1:
+#         file_path = "employee_file.csv"
+#         with open(file_path, mode="w") as employee_file:
+#             employee_writer = csv.writer(
+#                 employee_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
+#             )
+#             employee_writer.writerow(["John Smith", "Accounting", "November"])
+#             employee_writer.writerow(["Erica Meyers", "IT", "March"])
+#         return file_path
+#     else:
+#         file_path = "employee_file.csv"
+#         with open(file_path, mode="w") as employee_file:
+#             employee_writer = csv.writer(
+#                 employee_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
+#             )
+#             employee_writer.writerow(["Cow Duck", "Marketing", "April"])
+#         return file_path
+#
+#
+# def _file_clean_up(filename):
+#     if os.path.exists(filename):
+#         os.remove(filename)
+#
+#
+# def test_csv_handeling(docker_url):
+#     client = WOQLClient(docker_url)
+#     assert not client._connected
+#     # test connect
+#     client.connect()
+#     assert client._connected
+#     # test create db
+#     client.create_database("test_csv")
+#     client._get_current_commit()
+#     assert client._db == "test_csv"
+#     assert "test_csv" in client.list_databases()
+#     csv_file_path = _generate_csv(1)  # create testing csv
+#     try:
+#         client.insert_csv(csv_file_path)
+#         client.get_csv(csv_file_path, csv_output_name="new_" + csv_file_path)
+#         assert filecmp.cmp(csv_file_path, "new_" + csv_file_path)
+#         csv_file_path = _generate_csv(2)
+#         client.update_csv(csv_file_path)
+#         client.get_csv(csv_file_path, csv_output_name="update_" + csv_file_path)
+#         assert not filecmp.cmp("new_" + csv_file_path, "update_" + csv_file_path)
+#     finally:
+#         _file_clean_up(csv_file_path)
+#         _file_clean_up("new_" + csv_file_path)
+#         _file_clean_up("update_" + csv_file_path)
+#
+#
+# def test_create_graph(docker_url):
+#     client = WOQLClient(docker_url)
+#     assert not client._connected
+#     # test connect
+#     client.connect()
+#     assert client._connected
+#     # test create db
+#     client.create_database("test_graph")
+#     client.create_graph("instance", "test-one-more-graph", "create test graph")
+#     client.delete_graph("instance", "test-one-more-graph", "delete test graph")
diff --git a/terminusdb_client/tests/integration_tests/test_schema.py b/terminusdb_client/tests/integration_tests/test_schema.py
new file mode 100644
index 00000000..a15195e7
--- /dev/null
+++ b/terminusdb_client/tests/integration_tests/test_schema.py
@@ -0,0 +1,157 @@
+from typing import List, Optional, Set
+
+from terminusdb_client.woqlclient.woqlClient import WOQLClient
+from terminusdb_client.woqlschema.woql_schema import (
+    DocumentTemplate,
+    EnumTemplate,
+    HashKey,
+    ObjectTemplate,
+    TaggedUnion,
+    ValueHashKey,
+    WOQLSchema,
+)
+
+# from woql_schema import WOQLSchema, Document, Property, WOQLObject
+
+my_schema = WOQLSchema()
+
+
+class Coordinate(ObjectTemplate):
+    _schema = my_schema
+    x: float
+    y: float
+
+
+class Country(DocumentTemplate):
+    _schema = my_schema
+    _key = ValueHashKey()
+    name: str
+    perimeter: List[Coordinate]
+
+
+class Address(DocumentTemplate):
+    """This is address"""
+
+    _key = HashKey(["street", "postal_code"])
+    # _key = LexicalKey(["street", "postal_code"])
+    # _base = "Adddress_"
+    _subdocument = []
+    _schema = my_schema
+    street: str
+    postal_code: str
+    country: Country
+
+
+class Person(DocumentTemplate):
+    """This is a person
+
+    Attributes
+    ----------
+    name : str
+        Name of the person.
+    age : int
+        Age of the person.
+    """
+
+    _schema = my_schema
+    name: str
+    age: int
+    friend_of: Set["Person"]
+
+
+class Employee(Person):
+    address_of: Address
+    contact_number: Optional[str]
+    managed_by: "Employee"
+
+
+class Team(EnumTemplate):
+    _schema = my_schema
+    IT = ()
+    Marketing = ()
+
+
+class Contact(TaggedUnion):
+    local_number: int
+    international: str
+
+
+def test_create_schema(docker_url):
+    client = WOQLClient(docker_url, insecure=True)
+    client.connect()
+    client.create_database("test_docapi")
+    client.insert_document(
+        my_schema, commit_msg="I am checking in the schema", graph_type="schema"
+    )
+    result = client.get_all_documents(graph_type="schema")
+    for item in result:
+        if "@id" in item:
+            assert item["@id"] in [
+                "Employee",
+                "Person",
+                "Address",
+                "Team",
+                "Country",
+                "Coordinate",
+            ]
+        elif "@type" in item:
+            assert item["@type"] == "@context"
+        else:
+            assert False
+
+
+def test_create_schema2(docker_url):
+    client = WOQLClient(docker_url, insecure=True)
+    client.connect()
+    client.create_database("test_docapi2")
+    my_schema.commit(client, "I am checking in the schema")
+    result = client.get_all_documents(graph_type="schema")
+    for item in result:
+        if "@id" in item:
+            assert item["@id"] in [
+                "Employee",
+                "Person",
+                "Address",
+                "Team",
+                "Country",
+                "Coordinate",
+            ]
+        elif "@type" in item:
+            assert item["@type"] == "@context"
+        else:
+            assert False
+
+
+def test_insert_cheuk(docker_url):
+    uk = Country()
+    uk.name = "United Kingdom"
+
+    home = Address()
+    home.street = "123 Abc Street"
+    home.country = uk
+    home.postal_code = "A12 345"
+
+    cheuk = Employee()
+    cheuk.address_of = home
+    cheuk.contact_number = "07777123456"
+    cheuk.age = 21
+    cheuk.name = "Cheuk"
+    cheuk.managed_by = cheuk
+
+    client = WOQLClient(docker_url, insecure=True)
+    client.connect(db="test_docapi")
+    # client.create_database("test_docapi")
+    client.insert_document([uk, home, cheuk], commit_msg="Adding cheuk")
+    result = client.get_all_documents()
+    for item in result:
+        if item.get("@type") == "Country":
+            assert item["name"] == "United Kingdom"
+        elif item.get("@type") == "Employee":
+            assert item["address_of"]["postal_code"] == "A12 345"
+            assert item["address_of"]["street"] == "123 Abc Street"
+            assert item["name"] == "Cheuk"
+            assert item["age"] == 21
+            assert item["contact_number"] == "07777123456"
+            assert item["managed_by"] == item["@id"]
+        else:
+            assert False
diff --git a/terminusdb_client/tests/integration_tests/test_smart_query.py b/terminusdb_client/tests/integration_tests/test_smart_query.py
index d6a0547a..acc7a58a 100644
--- a/terminusdb_client/tests/integration_tests/test_smart_query.py
+++ b/terminusdb_client/tests/integration_tests/test_smart_query.py
@@ -1,48 +1,48 @@
-import unittest
-
-import requests
-
-from terminusdb_client.woqlquery.smart_query import (
-    TerminusDB,
-    WOQLClass,
-    WOQLLib,
-    WOQLObj,
-)
-
-
-def test_main_service_run(docker_url):
-    result = requests.get(docker_url)
-    assert result.status_code == 200
-
-
-def test_init_terminusdb(docker_url):
-    db = TerminusDB(docker_url, "test")
-    assert db._client.db() == "test"
-
-
-def test_add_class_and_object(
-    docker_url, one_class_obj, one_class_prop, one_object, one_prop_val
-):
-    db = TerminusDB(docker_url, "test")
-    my_class = WOQLClass(
-        "Journey",
-        label="Bike Journey",
-        description="Bike Journey object that capture each bike joourney.",
-    )
-    my_class.add_property("Duration", "integer")
-    db.add_class(my_class)
-
-    case = unittest.TestCase()
-    case.assertCountEqual(db.run(WOQLLib().classes()), one_class_obj)
-    case.assertCountEqual(db.run(WOQLLib().property()), one_class_prop)
-    # assert db.run(WOQLLib().classes()) == one_class_obj
-    # assert db.run(WOQLLib().property()) == one_class_prop
-
-    my_obj = WOQLObj("myobj", my_class)
-    my_obj.add_property("Duration", 75)
-    db.add_object(my_obj)
-
-    case.assertCountEqual(db.run(WOQLLib().objects()), one_object)
-    case.assertCountEqual(db.run(WOQLLib().property_values()), one_prop_val)
-    # assert db.run(WOQLLib().objects()) == one_object
-    # assert db.run(WOQLLib().property_values()) == one_prop_val
+# import unittest
+#
+# import requests
+#
+# from terminusdb_client.woqlquery.smart_query import (
+#     TerminusDB,
+#     WOQLClass,
+#     WOQLLib,
+#     WOQLObj,
+# )
+#
+#
+# def test_main_service_run(docker_url):
+#     result = requests.get(docker_url)
+#     assert result.status_code == 200
+#
+#
+# def test_init_terminusdb(docker_url):
+#     db = TerminusDB(docker_url, "test")
+#     assert db._client.db() == "test"
+#
+#
+# def test_add_class_and_object(
+#     docker_url, one_class_obj, one_class_prop, one_object, one_prop_val
+# ):
+#     db = TerminusDB(docker_url, "test")
+#     my_class = WOQLClass(
+#         "Journey",
+#         label="Bike Journey",
+#         description="Bike Journey object that capture each bike joourney.",
+#     )
+#     my_class.add_property("Duration", "integer")
+#     db.add_class(my_class)
+#
+#     case = unittest.TestCase()
+#     case.assertCountEqual(db.run(WOQLLib().classes()), one_class_obj)
+#     case.assertCountEqual(db.run(WOQLLib().property()), one_class_prop)
+#     # assert db.run(WOQLLib().classes()) == one_class_obj
+#     # assert db.run(WOQLLib().property()) == one_class_prop
+#
+#     my_obj = WOQLObj("myobj", my_class)
+#     my_obj.add_property("Duration", 75)
+#     db.add_object(my_obj)
+#
+#     case.assertCountEqual(db.run(WOQLLib().objects()), one_object)
+#     case.assertCountEqual(db.run(WOQLLib().property_values()), one_prop_val)
+#     # assert db.run(WOQLLib().objects()) == one_object
+#     # assert db.run(WOQLLib().property_values()) == one_prop_val
diff --git a/terminusdb_client/tests/test_woqlClient.py b/terminusdb_client/tests/test_woqlClient.py
index 0a7f1cfc..d2a7998b 100644
--- a/terminusdb_client/tests/test_woqlClient.py
+++ b/terminusdb_client/tests/test_woqlClient.py
@@ -30,6 +30,31 @@ def json(self):
     return MockResponse(None, 404)
 
 
+def mocked_requests_post(*args, **kwargs):
+    class MockResponse:
+        def __init__(self, text, json_data, status_code):
+            self.json_data = json_data
+            self.status_code = status_code
+            self.text = text
+
+        def json(self):
+            return self.json_data
+
+    if "http://localhost:6363/" in args[0]:
+        mock_result = {
+            "@type": "api:WoqlResponse",
+            "api:status": "api:success",
+            "api:variable_names": [],
+            "bindings": [{}],
+            "deletes": 0,
+            "inserts": 1,
+            "transaction_retry_count": 0,
+        }
+        return MockResponse(json.dumps(mock_result), {"key1": "value1"}, 200)
+
+    return MockResponse(None, 404)
+
+
 def mock_func_with_1arg(_):
     return True
 
@@ -52,9 +77,8 @@ def test_connection(mocked_requests):
 
     requests.get.assert_called_once_with(
         "http://localhost:6363/api",
-        headers={"Authorization": "Basic YWRtaW46cm9vdA=="},
-        params={},
-        verify=False,
+        auth=("admin", "root"),
+        verify=True,
     )
 
 
@@ -87,8 +111,8 @@ def test_create_database(mocked_requests, mocked_requests2):
 
     requests.post.assert_called_once_with(
         "http://localhost:6363/api/db/admin/myFirstTerminusDB",
-        headers={"Authorization": "Basic YWRtaW46cm9vdA=="},
-        verify=False,
+        auth=("admin", "root"),
+        verify=True,
         json={"label": "my first db", "comment": "my first db comment"},
     )
 
@@ -115,8 +139,8 @@ def test_create_database_with_schema(
 
     requests.post.assert_called_once_with(
         "http://localhost:6363/api/db/admin/myFirstTerminusDB",
-        headers={"Authorization": "Basic YWRtaW46cm9vdA=="},
-        verify=False,
+        auth=("admin", "root"),
+        verify=True,
         json={"label": "my first db", "comment": "my first db comment", "schema": True},
     )
 
@@ -138,8 +162,8 @@ def test_create_database_and_change_account(mocked_requests, mocked_requests2):
 
     requests.post.assert_called_once_with(
         "http://localhost:6363/api/db/my_new_account/myFirstTerminusDB",
-        headers={"Authorization": "Basic YWRtaW46cm9vdA=="},
-        verify=False,
+        auth=("admin", "root"),
+        verify=True,
         json={"label": "my first db", "comment": "my first db comment"},
     )
 
@@ -155,8 +179,8 @@ def test_branch(mocked_requests, mocked_requests2):
 
     requests.post.assert_called_once_with(
         "http://localhost:6363/api/branch/admin/myDBName/local/branch/my_new_branch",
-        headers={"Authorization": "Basic YWRtaW46cm9vdA=="},
-        verify=False,
+        auth=("admin", "root"),
+        verify=True,
         json={"origin": "admin/myDBName/local/branch/main"},
     )
 
@@ -198,8 +222,8 @@ def test_query(mocked_requests, mocked_requests2):
 
     requests.post.assert_called_once_with(
         "http://localhost:6363/api/woql/admin/myDBName/local/branch/main",
-        headers={"Authorization": "Basic YWRtaW46cm9vdA=="},
-        verify=False,
+        auth=("admin", "root"),
+        verify=True,
         json={
             "commit_info": {
                 "author": "admin",
@@ -219,20 +243,10 @@ def test_query_nodb(mocked_requests):
 
 
 @mock.patch("requests.get", side_effect=mocked_requests_get)
-@mock.patch.object(WOQLClient, "_dispatch_json")
+@mock.patch("requests.post", side_effect=mocked_requests_post)
 def test_query_commit_made(mocked_execute, mocked_requests):
-    # mocked_execute.return_value = MOCK_CAPABILITIES
     woql_client = WOQLClient("http://localhost:6363")
     woql_client.connect(user="admin", account="admin", key="root", db="myDBName")
-    mocked_execute.return_value = {
-        "@type": "api:WoqlResponse",
-        "api:status": "api:success",
-        "api:variable_names": [],
-        "bindings": [{}],
-        "deletes": 0,
-        "inserts": 1,
-        "transaction_retry_count": 0,
-    }
     result = woql_client.query(WoqlStar)
     assert result == "Commit successfully made."
 
diff --git a/terminusdb_client/tests/test_woqlQuery.py b/terminusdb_client/tests/test_woqlQuery.py
index c67affde..d2fb0c4c 100644
--- a/terminusdb_client/tests/test_woqlQuery.py
+++ b/terminusdb_client/tests/test_woqlQuery.py
@@ -23,10 +23,6 @@
 from .woqljson.woqlMathJson import WOQL_MATH_JSON
 from .woqljson.woqlOrJson import WOQL_OR_JSON
 from .woqljson.woqlTrimJson import WOQL_TRIM_JSON
-from .woqljson.woqlWhenJson import WOQL_WHEN_JSON
-
-# import pprint
-
 
 pp = pprint.PrettyPrinter(indent=4)
 
@@ -46,70 +42,29 @@ def test_limit_method(self):
     def test_start_method(self):
         woql_object = WOQLQuery().limit(10).start(0).star()
         json_obj = {
-            "@type": "woql:Limit",
-            "woql:limit": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:nonNegativeInteger", "@value": 10},
-            },
-            "woql:query": {
-                "@type": "woql:Start",
-                "woql:query": WOQL_STAR,
-                "woql:start": {
-                    "@type": "woql:Datatype",
-                    "woql:datatype": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                },
+            "@type": "Limit",
+            "limit": 10,
+            "query": {
+                "@type": "Start",
+                "query": WOQL_STAR,
+                "start": 0
             },
         }
         assert woql_object.to_dict() == json_obj
 
-    def test_insert_method(self, insert_without, insert_with_des):
-        woql_object = WOQLQuery().insert("v:Bike_URL", "Bicycle")
-        woql_object_des = WOQLQuery().insert(
-            "v:Bike_URL", "Bicycle", label="v:Bike_Label", description="v:Bike_Des"
-        )
-        assert woql_object.to_dict() == insert_without
-        assert woql_object_des.to_dict() == insert_with_des
-
-    def test_doctype_method(
-        self, doctype_without, doctype_with_label, doctype_with_des
-    ):
-        woql_object = WOQLQuery().doctype("Station")
-        woql_object_label = WOQLQuery().doctype("Station", label="Station Object")
-        woql_object_des = WOQLQuery().doctype(
-            "Station", label="Station Object", description="A bike station object."
-        )
-        assert woql_object.to_dict() == doctype_without
-        assert woql_object_label.to_dict() == doctype_with_label
-        assert woql_object_des.to_dict() == doctype_with_des
-
-    def test_doctype_property_method(self, property_without, property_with_des):
-        woql_object = WOQLQuery().doctype("Journey").property("Duration", "dateTime")
-        woql_object_des = (
-            WOQLQuery()
-            .doctype("Journey")
-            .property(
-                "Duration",
-                "dateTime",
-                label="Journey Duration",
-                description="Journey duration in minutes.",
-            )
-        )
-        assert woql_object.to_dict() == property_without
-        assert woql_object_des.to_dict() == property_with_des
-
     def test_woql_not_method(self):
         woql_object = WOQLQuery().woql_not(WOQLQuery().triple("a", "b", "c"))
         woql_object_chain = WOQLQuery().woql_not()
         woql_object_chain.triple("a", "b", "c")
         json_obj = {
-            "@type": "woql:Not",
-            "woql:query": {
-                "@type": "woql:Triple",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-                "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-                "woql:object": {
-                    "@type": "woql:Datatype",
-                    "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+            "@type": "Not",
+            "query": {
+                "@type": "Triple",
+                "subject": {"@type": "NodeValue", "node": "a"},
+                "predicate": {"@type": "NodeValue", "node": "b"},
+                "object": {
+                    "@type": "Value",
+                    "node": "c",
                 },
             },
         }
@@ -141,27 +96,20 @@ def test_woql_or_method(self):
         assert woql_object.to_dict() == WOQL_OR_JSON
         assert woql_object2.to_dict() == WOQL_OR_JSON
 
-    def test_when_method(self):
-
-        woql_object = WOQLQuery().when(True, WOQLQuery().add_class("id"))
-        woql_object_chain = WOQLQuery().when(True).add_class("id")
-        assert woql_object.to_dict() == WOQL_WHEN_JSON
-        assert woql_object_chain.to_dict() == WOQL_WHEN_JSON
-
     def test_opt_method(self):
         woql_object = WOQLQuery().opt(WOQLQuery().star())
         woql_object_chain = WOQLQuery().opt().star()
-        json_obj = {"@type": "woql:Optional", "woql:query": WOQL_STAR}
+        json_obj = {"@type": "Optional", "query": WOQL_STAR}
         assert woql_object.to_dict() == json_obj
         assert woql_object_chain.to_dict() == json_obj
 
     def test_woql_from_method(self):
-        woql_object = WOQLQuery().woql_from("schema/main", WOQLQuery().star())
-        woql_object_chain = WOQLQuery().woql_from("schema/main").star()
+        woql_object = WOQLQuery().woql_from("schema", WOQLQuery().star())
+        woql_object_chain = WOQLQuery().woql_from("schema").star()
         json_obj = {
-            "@type": "woql:From",
-            "woql:graph_filter": {"@type": "xsd:string", "@value": "schema/main"},
-            "woql:query": WOQL_STAR,
+            "@type": "From",
+            "graph_filter": "schema",
+            "query": WOQL_STAR,
         }
         assert woql_object.to_dict() == woql_object_chain.to_dict()
         assert woql_object_chain.to_dict() == json_obj
@@ -183,14 +131,14 @@ def test_select_method(self):
     def test_eq_method(self):
         woql_object = WOQLQuery().eq("a", "b")
         json_obj = {
-            "@type": "woql:Equals",
-            "woql:left": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "a"},
+            "@type": "Equals",
+            "left": {
+                "@type": "Value",
+                "node": "a",
             },
-            "woql:right": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "b"},
+            "right": {
+                "@type": "Value",
+                "node": "b"
             },
         }
         assert woql_object.to_dict() == json_obj
@@ -200,88 +148,86 @@ def test_trim_method(self):
         assert woql_object.to_dict() == WOQL_TRIM_JSON
 
     def test_eval_method(self):
-        woql_object = WOQLQuery().eval("1+2", "b")
+        woql_object = WOQLQuery().eval(WOQLQuery().plus(1,2), "v:x")
         assert woql_object.to_dict() == WOQL_MATH_JSON["evalJson"]
 
     def test_minus_method(self):
 
-        woql_object = WOQLQuery().minus("2", "1")
+        woql_object = WOQLQuery().minus(1, 1)
         assert woql_object.to_dict() == WOQL_MATH_JSON["minusJson"]
 
     def test_plus_method(self):
-        woql_object = WOQLQuery().plus("2", "1")
+        woql_object = WOQLQuery().plus(2, 1)
         assert woql_object.to_dict() == WOQL_MATH_JSON["plusJson"]
 
     def test_times_method(self):
-        woql_object = WOQLQuery().times("2", "1")
+        woql_object = WOQLQuery().times(2, 1)
         assert woql_object.to_dict() == WOQL_MATH_JSON["timesJson"]
 
     def test_divide_method(self):
-        woql_object = WOQLQuery().divide("2", "1")
+        woql_object = WOQLQuery().divide(2, 1)
         assert woql_object.to_dict() == WOQL_MATH_JSON["divideJson"]
 
     def test_exp_method(self):
-        woql_object = WOQLQuery().exp("2", "1")
+        woql_object = WOQLQuery().exp(2, 1)
         assert woql_object.to_dict() == WOQL_MATH_JSON["expJson"]
 
     def test_div_method(self):
-        woql_object = WOQLQuery().div("2", "1")
+        woql_object = WOQLQuery().div(2, 1)
         assert woql_object.to_dict() == WOQL_MATH_JSON["divJson"]
 
     def test_floor_method(self):
-        woql_object = WOQLQuery().floor("2.5")
+        woql_object = WOQLQuery().floor(2.5)
         assert woql_object.to_dict() == WOQL_MATH_JSON["floorJson"]
 
     def test_get_method(self):
         woql_object = WOQLQuery().get(WOQLQuery().woql_as("a", "b"), "Target")
         json_obj = {
-            "@type": "woql:Get",
-            "woql:as_vars": [
+            "@type": "Get",
+            "columns": [
                 {
-                    "@type": "woql:NamedAsVar",
-                    "woql:identifier": {"@type": "xsd:string", "@value": "a"},
-                    "woql:variable_name": {"@type": "xsd:string", "@value": "b"},
+                    "@type": "Column",
+                    "indicator": {"@type": "Indicator", "name": "a"},
+                    "variable": "b",
                 }
             ],
-            "woql:query_resource": "Target",
+            "resource": "Target",
         }
         assert woql_object.to_dict() == json_obj
 
     def test_remote_method(self):
         woql_object = WOQLQuery().remote({"url": "http://url"})
         json_obj = {
-            "@type": "woql:RemoteResource",
-            "woql:remote_uri": {"@type": "xsd:anyURI", "@value": {"url": "http://url"}},
+            "@type": "QueryResource",
+            "format" : "csv",
+            "source": {"@type": "Source", "url": "http://url"},
         }
         assert woql_object.to_dict() == json_obj
 
     def test_post_method(self):
-        woql_object = WOQLQuery().post("my_json_file", {"format": "panda_json"})
+        woql_object = WOQLQuery().post({"file" : "my_json_file"})
         json_obj = {
-            "@type": "woql:PostResource",
-            "woql:file": {"@type": "xsd:string", "@value": "my_json_file"},
-            "woql:format": {
-                "@type": "woql:Format",
-                "woql:format_type": {"@value": "panda_json", "@type": "xsd:string"},
-            },
+            "@type": "QueryResource",
+            "source": {"@type": "Source", "file": "my_json_file"},
+            "format": "csv",
         }
         assert woql_object.to_dict() == json_obj
 
     def test_unique_method(self):
         woql_object = WOQLQuery().unique(
-            "doc:Station", "v:Start_ID", "v:Start_Station_URL"
+            "Station", "v:Start_ID", "v:Start_Station_URL"
         )
         assert woql_object.to_dict() == WOQL_UNIQUE_JSON
 
     def test_idgen_method(self):
         woql_object = WOQLQuery().idgen(
-            "doc:Station", "v:Start_ID", "v:Start_Station_URL"
+            "Station", "v:Start_ID", "v:Start_Station_URL"
         )
         assert woql_object.to_dict() == WOQL_IDGEN_JSON
 
     def test_random_idgen_method(self):
         woql_object = WOQLQuery().random_idgen(
-            "doc:Station", "v:Start_ID", "v:Start_Station_URL"
+            "Station", "v:Start_ID", "v:Start_Station_URL"
         )
         assert woql_object.to_dict() == WOQL_RANDOM_IDGEN_JSON
 
@@ -290,18 +236,15 @@ def test_typecast_method(self):
             "v:Duration", "xsd:integer", "v:Duration_Cast"
         )
         json_obj = {
-            "@type": "woql:Typecast",
-            "woql:typecast_value": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Duration", "@type": "xsd:string"},
+            "@type": "Typecast",
+            "value": {
+                "@type": "Value",
+                "variable": "Duration",
             },
-            "woql:typecast_type": {"@type": "woql:Node", "woql:node": "xsd:integer"},
-            "woql:typecast_result": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {
-                    "@value": "Duration_Cast",
-                    "@type": "xsd:string",
-                },
+            "type": {"@type": "NodeValue", "node": "xsd:integer"},
+            "result": {
+                "@type": "Value",
+                "variable": "Duration_Cast"
             },
         }
         assert woql_object.to_dict() == json_obj
@@ -324,10 +267,10 @@ def test_cast_method_object(self):
             "my_int", "xsd:integer", "v:Duration_Cast", literal_type="owl:Thing"
         )
         woql_object2 = WOQLQuery().cast(
-            "my_int", "xsd:integer", "v:Duration_Cast", literal_type="woql:node"
+            "my_int", "xsd:integer", "v:Duration_Cast", literal_type="node"
         )
         woql_object3 = WOQLQuery().cast(
-            WOQLQuery().iri("my_int"), "xsd:integer", "v:Duration_Cast"
+            "my_int", "xsd:integer", "v:Duration_Cast"
         )
         assert woql_object1.to_dict() == woql_object3.to_dict()
         assert woql_object2.to_dict() == woql_object3.to_dict()
@@ -335,18 +278,18 @@ def test_cast_method_object(self):
     def test_re_method(self):
         woql_object = WOQLQuery().re("!\\w+(.*)test$", "v:string", "v:formated")
         json_obj = {
-            "@type": "woql:Regexp",
-            "woql:pattern": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "!\\w+(.*)test$"},
+            "@type": "Regexp",
+            "pattern": {
+                "@type": "DataValue",
+                "data": {"@type": "xsd:string", "@value": "!\\w+(.*)test$"},
             },
-            "woql:regexp_list": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@type": "xsd:string", "@value": "formated"},
+            "result": {
+                "@type": "DataValue",
+                "variable": "formated",
             },
-            "woql:regexp_string": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@type": "xsd:string", "@value": "string"},
+            "string": {
+                "@type": "DataValue",
+                "variable": "string",
             },
         }
         assert woql_object.to_dict() == json_obj
@@ -356,26 +299,26 @@ def test_join_method(self):
         assert woql_object.to_dict() == WOQL_JOIN_SPLIT_JSON["joinJson"]
 
     def test_split_method(self):
-        woql_object = WOQLQuery().split("A, B, C", ", ", "v:list_obj")
+        woql_object = WOQLQuery().split('A, B, C', ", ", "v:list_obj")
         assert woql_object.to_dict() == WOQL_JOIN_SPLIT_JSON["splitJson"]
 
     def test_member_method(self):
         woql_object = WOQLQuery().member("v:member", "v:list_obj")
         json_obj = {
-            "@type": "woql:Member",
-            "woql:member": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "member", "@type": "xsd:string"},
+            "@type": "Member",
+            "member": {
+                "@type": "Value",
+                "variable": "member",
             },
-            "woql:member_list": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "list_obj", "@type": "xsd:string"},
+            "list": {
+                "@type": "Value",
+                "variable": "list_obj",
             },
         }
         assert woql_object.to_dict() == json_obj
 
     def test_concat_method(self):
-        woql_object = WOQLQuery().concat("v:Duration yo v:Duration_Cast", "v:x")
+        woql_object = WOQLQuery().concat(["v:Duration"," yo ","v:Duration_Cast"], "v:x")
         assert woql_object.to_dict() == WOQL_CONCAT_JSON
 
     def test_group_by_method(self):
@@ -395,132 +338,138 @@ def test_order_by_method_asc(self):
         assert woql_object.to_dict() == WOQL_JSON["orderbyJson"]
 
     def test_simple_path_query(self):
-        woql_object = WOQLQuery().path("v:X", "scm:hop", "v:Y", "v:Path")
+        woql_object = WOQLQuery().path("v:X", "hop", "v:Y", "v:Path")
         json_object = {
-            "@type": "woql:Path",
-            "woql:subject": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "X", "@type": "xsd:string"},
+            "@type": "Path",
+            "subject": {
+                "@type": "NodeValue",
+                "variable": "X",
             },
-            "woql:path_pattern": {
-                "@type": "woql:PathPredicate",
-                "woql:path_predicate": {"@id": "scm:hop"},
+            "pattern": {
+                "@type": "PathPredicate",
+                "predicate": "hop",
             },
-            "woql:object": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Y", "@type": "xsd:string"},
+            "object": {
+                "@type": "Value",
+                "variable": "Y",
             },
-            "woql:path": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Path", "@type": "xsd:string"},
+            "path": {
+                "@type": "Value",
+                "variable": "Path",
             },
         }
         assert woql_object.to_dict() == json_object
 
     def test_plus_directed_path_query(self):
-        woql_object = WOQLQuery().path("v:X", "<scm:hop+", "v:Y", "v:Path")
+        woql_object = WOQLQuery().path("v:X", "<hop+", "v:Y", "v:Path")
         json_object = {
-            "@type": "woql:Path",
-            "woql:subject": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "X", "@type": "xsd:string"},
-            },
-            "woql:path_pattern": {
-                "@type": "woql:PathPlus",
-                "woql:path_pattern": {
-                    "@type": "woql:InvertedPathPredicate",
-                    "woql:path_predicate": {"@id": "scm:hop"},
+            "@type": "Path",
+            "subject": {
+                "@type": "NodeValue",
+                "variable": "X",
+            },
+            "pattern": {
+                "@type": "PathPlus",
+                "pattern": {
+                    "@type": "InversePathPredicate",
+                    "predicate": "hop",
                 },
             },
-            "woql:object": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Y", "@type": "xsd:string"},
+            "object": {
+                "@type": "Value",
+                "variable": "Y",
             },
-            "woql:path": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Path", "@type": "xsd:string"},
+            "path": {
+                "@type": "Value",
+                "variable": "Path",
             },
         }
         assert woql_object.to_dict() == json_object
 
     def test_grouped_path_query(self):
-        woql_object = WOQLQuery().path("v:X", "(<scm:hop,scm:hop>)+", "v:Y", "v:Path")
+        woql_object = WOQLQuery().path("v:X", "(<hop,hop>)+", "v:Y", "v:Path")
         json_object = {
-            "@type": "woql:Path",
-            "woql:subject": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "X", "@type": "xsd:string"},
-            },
-            "woql:path_pattern": {
-                "@type": "woql:PathPlus",
-                "woql:path_pattern": {
-                    "@type": "woql:PathSequence",
-                    "woql:path_first": {
-                        "@type": "woql:InvertedPathPredicate",
-                        "woql:path_predicate": {"@id": "scm:hop"},
-                    },
-                    "woql:path_second": {
-                        "@type": "woql:PathPredicate",
-                        "woql:path_predicate": {"@id": "scm:hop"},
-                    },
+            "@type": "Path",
+            "subject": {
+                "@type": "NodeValue",
+                "variable": "X",
+            },
+            "pattern": {
+                "@type": "PathPlus",
+                "pattern": {
+                    "@type": "PathSequence",
+                    "sequence" : [
+                        {
+                            "@type": "InversePathPredicate",
+                            "predicate": "hop",
+                        },
+                        {
+                            "@type": "PathPredicate",
+                            "predicate": "hop",
+                        },
+                    ]
                 },
             },
-            "woql:object": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Y", "@type": "xsd:string"},
+            "object": {
+                "@type": "Value",
+                "variable": "Y",
             },
-            "woql:path": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Path", "@type": "xsd:string"},
+            "path": {
+                "@type": "Value",
+                "variable": "Path",
             },
         }
         assert woql_object.to_dict() == json_object
 
     def test_double_grouped_path_query(self):
         woql_object = WOQLQuery().path(
-            "v:X", "((<scm:hop,scm:hop>)|(<scm:hop2,scm:hop2>))+", "v:Y", "v:Path"
+            "v:X", "((<hop,hop>)|(<hop2,hop2>))+", "v:Y", "v:Path"
         )
         json_object = {
-            "@type": "woql:Path",
-            "woql:subject": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "X", "@type": "xsd:string"},
-            },
-            "woql:path_pattern": {
-                "@type": "woql:PathPlus",
-                "woql:path_pattern": {
-                    "@type": "woql:PathOr",
-                    "woql:path_left": {
-                        "@type": "woql:PathSequence",
-                        "woql:path_first": {
-                            "@type": "woql:InvertedPathPredicate",
-                            "woql:path_predicate": {"@id": "scm:hop"},
-                        },
-                        "woql:path_second": {
-                            "@type": "woql:PathPredicate",
-                            "woql:path_predicate": {"@id": "scm:hop"},
-                        },
-                    },
-                    "woql:path_right": {
-                        "@type": "woql:PathSequence",
-                        "woql:path_first": {
-                            "@type": "woql:InvertedPathPredicate",
-                            "woql:path_predicate": {"@id": "scm:hop2"},
-                        },
-                        "woql:path_second": {
-                            "@type": "woql:PathPredicate",
-                            "woql:path_predicate": {"@id": "scm:hop2"},
-                        },
-                    },
+            "@type": "Path",
+            "subject": {
+                "@type": "NodeValue",
+                "variable": "X",
+            },
+            "pattern": {
+                "@type": "PathPlus",
+                "pattern": {
+                    "@type": "PathOr",
+                    "or":[
+                        { "@type": "PathSequence",
+                          "sequence" : [
+                              {
+                                  "@type": "InversePathPredicate",
+                                  "predicate": "hop"
+                              },
+                              {
+                                  "@type": "PathPredicate",
+                                  "predicate": "hop",
+                              }
+                              ]
+                         },
+                        {  "@type": "PathSequence",
+                           "sequence" : [
+                               {
+                                   "@type": "InversePathPredicate",
+                                   "predicate": "hop2",
+                               },
+                               {
+                                   "@type": "PathPredicate",
+                                   "predicate": "hop2",
+                               }
+                           ]
+                         },
+                    ],
                 },
             },
-            "woql:object": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Y", "@type": "xsd:string"},
+            "object": {
+                "@type": "Value",
+                "variable": "Y",
             },
-            "woql:path": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "Path", "@type": "xsd:string"},
+            "path": {
+                "@type": "Value",
+                "variable": "Path"
             },
         }
         assert woql_object.to_dict() == json_object
@@ -529,24 +478,16 @@ def test_double_grouped_path_query(self):
 class TestTripleBuilder:
     def test_triple_method(self, triple_opt):
         woql_object = WOQLQuery().triple("a", "b", "c")
-        woql_object_opt = WOQLQuery().triple("a", "b", "c", opt=True)
+        woql_object_opt = WOQLQuery().triple("a", "b", WOQLQuery().string("c"), opt=True)
         assert woql_object.to_dict() == WOQL_JSON["tripleJson"]
         assert woql_object_opt.to_dict() == triple_opt
 
     def test_quad_method(self, quad_opt):
         woql_object = WOQLQuery().quad("a", "b", "c", "d")
-        woql_object_opt = WOQLQuery().quad("a", "b", "c", "d", opt=True)
+        woql_object_opt = WOQLQuery().quad("a", "b", WOQLQuery().string("c"), "d", opt=True)
         assert woql_object.to_dict() == WOQL_JSON["quadJson"]
         assert woql_object_opt.to_dict() == quad_opt
 
-    def test_add_class_method(self):
-        woql_object = WOQLQuery().add_class("id")
-        assert woql_object.to_dict() == WOQL_JSON["addClassJson"]
-
-    def test_delete_class_method(self):
-        woql_object = WOQLQuery().delete_class("id")
-        assert woql_object.to_dict() == WOQL_DELETE_JSON
-
     def test_sub_method(self):
         woql_object = WOQLQuery().sub("ClassA", "ClassB")
         assert woql_object.to_dict() == WOQL_JSON["subsumptionJson"]
@@ -556,8 +497,9 @@ def test_isa_method(self):
         assert woql_object.to_dict() == WOQL_JSON["isAJson"]
 
     def test_delete_method(self):
-        woql_object = WOQLQuery().delete_object("doc:x")
-        json_obj = {"@type": "woql:DeleteObject", "woql:document_uri": "doc:x"}
+        woql_object = WOQLQuery().delete_object("x")
+        json_obj = {"@type": "DeleteObject",
+                    "document_uri": {'@type': 'NodeValue', 'node': 'x'}}
         assert woql_object.to_dict() == json_obj
 
     def test_delete_triple_method(self):
@@ -576,110 +518,7 @@ def test_add_quad_method(self):
         woql_object = WOQLQuery().add_quad("a", "b", "c", "d")
         assert woql_object.to_dict() == WOQL_JSON["addQuadJson"]
 
-    def test_add_property_method(self):
-        woql_object = WOQLQuery().add_property("some_property", "string")
-        assert woql_object.to_dict() == WOQL_JSON["addPropertyJson"]
-
-    def test_delete_property_method(self):
-        woql_object = WOQLQuery().delete_property("some_property", "string")
-        assert woql_object.to_dict() == WOQL_JSON["deletePropertyJson"]
-
-
 class TestTripleBuilderChainer:
-    def test_node_method(self):
-        woql_object = WOQLQuery().node("some_node", "add_quad")
-        assert woql_object.to_dict() == {}
-
-    def test_graph_method(self):
-        woql_object = WOQLQuery().node("a", "AddQuad").graph("schema/main")
-        woql_object2 = (
-            WOQLQuery()
-            .node("doc:x", "add_quad")
-            .graph("schema/main")
-            .label("my label", "en")
-        )
-
-        assert woql_object.to_dict() == {}
-        assert woql_object2.to_dict() == WOQL_JSON["graphMethodJson"]
-
-    def test_node_and_label_method(self):
-        woql_object = WOQLQuery().node("doc:x", "add_quad").label("my label", "en")
-        woql_object2 = WOQLQuery().node("doc:x", "add_quad").label("v:label")
-        pp.pprint(woql_object.to_dict())
-        assert woql_object.to_dict() == WOQL_JSON["labelMethodJson"]
-        assert woql_object2.to_dict() == WOQL_JSON["labelMethodJson2"]
-
-    def test_add_class_and_description_method(self):
-        woql_object = (
-            WOQLQuery().add_class("NewClass").description("A new class object.")
-        )
-        assert woql_object.to_dict() == WOQL_JSON["addClassDescJson"]
-
-    def test_comment_method(self):
-        woql_object = WOQLQuery().comment("my comment")
-        json_obj = {
-            "@type": "woql:Comment",
-            "woql:comment": {"@type": "xsd:string", "@value": "my comment"},
-        }
-        assert woql_object.to_dict() == json_obj
-
-    def test_abstract_method(self):
-        woql_object = WOQLQuery().node("doc:x", "add_quad").abstract()
-        assert woql_object.to_dict() == WOQL_JSON["nodeAbstractJson"]
-
-    def test_node_property_method(self):
-        woql_object = (
-            WOQLQuery().node("doc:x", "add_triple").property("myprop", "value")
-        )
-        assert woql_object.to_dict() == WOQL_JSON["addNodePropJson"]
-
-    def test_node_parent_method(self):
-        woql_object = WOQLQuery().node("doc:x", "add_quad").parent("classParentName")
-        assert woql_object.to_dict() == WOQL_JSON["nodeParentJson"]
-
-    def test_class_description_method(self):
-        woql_object = (
-            WOQLQuery().add_class("NewClass").description("A new class object.")
-        )
-        assert woql_object.to_dict() == WOQL_JSON["addClassDescJson"]
-
-    def test_max(self, property_max):
-        woql_object = WOQLQuery().add_property("P", "string").domain("A").max(4)
-        assert woql_object.to_dict() == property_max
-
-    def test_min(self, property_min):
-        woql_object = WOQLQuery().add_property("P", "string").domain("A").min(2)
-        assert woql_object.to_dict() == property_min
-
-    def test_card(self, property_cardinalty):
-        woql_object = WOQLQuery().add_property("P", "string").domain("A").cardinality(3)
-        assert woql_object.to_dict() == property_cardinalty
-
-    def test_chain1(self, chain_insert):
-        woql_object = (
-            WOQLQuery()
-            .insert("v:Node_ID", "v:Type")
-            .label("v:Label")
-            .description("v:Description")
-            .property("prop", "v:Prop")
-            .property("prop", "v:Prop2")
-            .parent("myParentClass")
-        )
-        assert woql_object.to_dict() == chain_insert
-
-    def test_chain2(self, chain_doctype):
-        woql_object = (
-            WOQLQuery()
-            .doctype("MyDoc")
-            .label("abc")
-            .description("abcd")
-            .property("prop", "dateTime")
-            .label("aaa")
-            .property("prop2", "integer")
-            .label("abe")
-        )
-        assert woql_object.to_dict() == chain_doctype
-
     def test_dot_chain(self):
         woql_object = WOQLQuery().triple("A", "B", "C").triple("D", "E", "F")
         v2 = WOQLQuery().woql_and(
@@ -700,18 +539,18 @@ def test_woql_as_method(self):
         query = WOQLQuery().woql_as(x).woql_as(y).woql_as(z)
         assert query.to_dict() == [
             {
-                "@type": "woql:IndexedAsVar",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "x"},
+                "@type": "Column",
+                "indicator": {"@type": "Indicator", "index": 0},
+                "variable": "x",
             },
             {
-                "@type": "woql:IndexedAsVar",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "y"},
+                "@type": "Column",
+                "indicator": {"@type": "Indicator", "index": 1},
+                "variable": "y",
             },
             {
-                "@type": "woql:IndexedAsVar",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "z"},
+                "@type": "Column",
+                "indicator": {"@type": "Indicator", "index": 2},
+                "variable": "z",
             },
         ]
diff --git a/terminusdb_client/tests/test_woqlSchema.py b/terminusdb_client/tests/test_woqlSchema.py
new file mode 100644
index 00000000..3971e228
--- /dev/null
+++ b/terminusdb_client/tests/test_woqlSchema.py
@@ -0,0 +1,85 @@
+from typing import List, Set
+
+from terminusdb_client.woqlschema.woql_schema import (
+    DocumentTemplate,
+    EnumTemplate,
+    ObjectTemplate,
+    WOQLSchema,
+)
+
+my_schema = WOQLSchema()
+
+
+class Coordinate(ObjectTemplate):
+    """Coordinate of location.
+
+    Coordinate to identify the location of a place on earth, it could be found from Google map.
+
+    Attributes
+    ----------
+    x : float
+        The X coordinate.
+    y : float
+        The Y coordinate.
+    """
+
+    _schema = my_schema
+    x: float
+    y: float
+
+
+class Country(DocumentTemplate):
+    _schema = my_schema
+    name: str
+    perimeter: List[Coordinate]
+
+
+class Address(ObjectTemplate):
+    _schema = my_schema
+    street: str
+    country: Country
+
+
+class Person(DocumentTemplate):
+    _schema = my_schema
+    name: str
+    age: int
+    friend_of: Set["Person"]
+
+
+class Employee(Person):
+    _schema = my_schema
+    address_of: Address
+    contact_number: str
+    managed_by: "Employee"
+
+
+class Team(EnumTemplate):
+    _schema = my_schema
+    IT = ()
+    Marketing = ()
+
+
+def test_schema_construct():
+    assert my_schema.all_obj() == {Employee, Person, Address, Team, Country, Coordinate}
+    # assert my_schema.all_prop() == {AddressOf, Title, PostCode}
+    # assert Employee.properties == {AddressOf, Title}
+
+
+def test_schema_copy():
+    copy_schema = my_schema.copy()
+    assert copy_schema.all_obj() == {
+        Employee,
+        Person,
+        Address,
+        Team,
+        Country,
+        Coordinate,
+    }
+    # assert copy_schema.all_prop() == {AddressOf, Title, PostCode}
+
+
+# def test_schema_delete():
+#     other_schema.delete_property(Title)
+#     assert other_schema.all_obj() == {Employee, Address, Team}
+#     assert other_schema.all_prop() == {AddressOf, PostCode, Country}
diff --git a/terminusdb_client/tests/woqljson/woqlAndJson.py b/terminusdb_client/tests/woqljson/woqlAndJson.py
index 15adda92..a4f92a03 100644
--- a/terminusdb_client/tests/woqljson/woqlAndJson.py
+++ b/terminusdb_client/tests/woqljson/woqlAndJson.py
@@ -1,30 +1,22 @@
 WOQL_AND_JSON = {
-    "@type": "woql:And",
-    "woql:query_list": [
+    "@type": "And",
+    "and": [
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            "woql:query": {
-                "@type": "woql:Triple",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-                "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-                "woql:object": {
-                    "@type": "woql:Datatype",
-                    "woql:datatype": {"@type": "xsd:string", "@value": "c"},
-                },
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "a"},
+            "predicate": {"@type": "NodeValue", "node": "b"},
+            "object": {
+                "@type": "Value",
+                "node": "c",
             },
         },
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-            "woql:query": {
-                "@type": "woql:Triple",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "doc:1"},
-                "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:2"},
-                "woql:object": {
-                    "@type": "woql:Datatype",
-                    "woql:datatype": {"@type": "xsd:string", "@value": "3"},
-                },
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "1"},
+            "predicate": {"@type": "NodeValue", "node": "2"},
+            "object": {
+                "@type": "Value",
+                "node": "3",
             },
         },
     ],
diff --git a/terminusdb_client/tests/woqljson/woqlCastJson.py b/terminusdb_client/tests/woqljson/woqlCastJson.py
index adfd7067..5e0aca7c 100644
--- a/terminusdb_client/tests/woqljson/woqlCastJson.py
+++ b/terminusdb_client/tests/woqljson/woqlCastJson.py
@@ -1,12 +1,12 @@
 WOQL_CAST_JSON = {
-    "@type": "woql:Typecast",
-    "woql:typecast_value": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@value": "Duration", "@type": "xsd:string"},
+    "@type": "Typecast",
+    "value": {
+        "@type": "Value",
+        "variable": "Duration"
     },
-    "woql:typecast_type": {"@type": "woql:Node", "woql:node": "xsd:integer"},
-    "woql:typecast_result": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@value": "Duration_Cast", "@type": "xsd:string"},
+    "type": {"@type": "NodeValue", "node": "xsd:integer"},
+    "result": {
+        "@type": "Value",
+        "variable": "Duration_Cast"
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlConcatJson.py b/terminusdb_client/tests/woqljson/woqlConcatJson.py
index 9ab11051..03377ed9 100644
--- a/terminusdb_client/tests/woqljson/woqlConcatJson.py
+++ b/terminusdb_client/tests/woqljson/woqlConcatJson.py
@@ -1,30 +1,21 @@
 WOQL_CONCAT_JSON = {
-    "@type": "woql:Concatenate",
-    "woql:concat_list": {
-        "@type": "woql:Array",
-        "woql:array_element": [
-            {
-                "@type": "woql:ArrayElement",
-                "woql:variable_name": {"@value": "Duration", "@type": "xsd:string"},
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            },
-            {
-                "@type": "woql:ArrayElement",
-                "woql:datatype": {"@type": "xsd:string", "@value": " yo "},
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-            },
-            {
-                "@type": "woql:ArrayElement",
-                "woql:variable_name": {
-                    "@value": "Duration_Cast",
-                    "@type": "xsd:string",
-                },
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-            },
-        ],
-    },
-    "woql:concatenated": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "x"},
+    "@type": "Concatenate",
+    "list": [
+        {
+            "@type": "DataValue",
+            "variable": "Duration"
+        },
+        {
+            "@type": "DataValue",
+            "data": {"@type": "xsd:string", "@value": " yo "},
+        },
+        {
+            "@type": "DataValue",
+            "variable": "Duration_Cast"
+        }
+    ],
+    "result": {
+        "@type": "DataValue",
+        "variable": "x"
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlDeleteJson.py b/terminusdb_client/tests/woqljson/woqlDeleteJson.py
index cabb7031..baf8a39d 100644
--- a/terminusdb_client/tests/woqljson/woqlDeleteJson.py
+++ b/terminusdb_client/tests/woqljson/woqlDeleteJson.py
@@ -1,47 +1,33 @@
 WOQL_DELETE_JSON = {
-    "@type": "woql:And",
-    "woql:query_list": [
+    "@type": "And",
+    "and": [
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            "woql:query": {
-                "@type": "woql:DeleteQuad",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "scm:id"},
-                "woql:predicate": {
-                    "@type": "woql:Variable",
-                    "woql:variable_name": {"@value": "Outgoing", "@type": "xsd:string"},
-                },
-                "woql:object": {
-                    "@type": "woql:Variable",
-                    "woql:variable_name": {"@value": "Value", "@type": "xsd:string"},
-                },
-                "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+            "@type": "DeleteTriple",
+            "subject": {"@type": "NodeValue", "node": "id"},
+            "predicate": {
+                "@type": "NodeValue",
+                "variable": "Outgoing"
             },
+            "object": {
+                "@type": "Value",
+                "variable": "Value"
+            },
+            "graph": "schema"
         },
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-            "woql:query": {
-                "@type": "woql:Optional",
-                "woql:query": {
-                    "@type": "woql:DeleteQuad",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Other",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {
-                            "@value": "Incoming",
-                            "@type": "xsd:string",
-                        },
-                    },
-                    "woql:object": {"@type": "woql:Node", "woql:node": "scm:id"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+            "@type": "Optional",
+            "query": {
+                "@type": "DeleteTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "Other"
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "variable": "Incoming"
                 },
+                "object": {"@type": "Value", "node": "id"},
+                "graph": "schema"
             },
         },
     ],
diff --git a/terminusdb_client/tests/woqljson/woqlDoctypeJson.py b/terminusdb_client/tests/woqljson/woqlDoctypeJson.py
index 4c5378fb..b375528c 100644
--- a/terminusdb_client/tests/woqljson/woqlDoctypeJson.py
+++ b/terminusdb_client/tests/woqljson/woqlDoctypeJson.py
@@ -1,30 +1,22 @@
 WoqlDoctype = {
-    "@type": "woql:And",
-    "woql:query_list": [
+    "@type": "And",
+    "and": [
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            "woql:query": {
-                "@type": "woql:AddQuad",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-            },
+            "@type": "AddTriple",
+            "subject": {"@type": "NodeValue", "node": "Station"},
+            "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+            "object": {"@type": "Value", "node": "owl:Class"},
+            "graph": "schema"
         },
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-            "woql:query": {
-                "@type": "woql:AddQuad",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "scm:Station"},
-                "woql:predicate": {
-                    "@type": "woql:Node",
-                    "woql:node": "rdfs:subClassOf",
-                },
-                "woql:object": {"@type": "woql:Node", "woql:node": "terminus:Document"},
-                "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+            "@type": "AddTriple",
+            "subject": {"@type": "NodeValue", "node": "Station"},
+            "predicate": {
+                "@type": "NodeValue",
+                "node": "rdfs:subClassOf",
             },
+            "object": {"@type": "Value", "node": "terminus:Document"},
+            "graph": "schema"
         },
     ],
 }
diff --git a/terminusdb_client/tests/woqljson/woqlExtraJson.py b/terminusdb_client/tests/woqljson/woqlExtraJson.py
index 1648c812..8538644d 100644
--- a/terminusdb_client/tests/woqljson/woqlExtraJson.py
+++ b/terminusdb_client/tests/woqljson/woqlExtraJson.py
@@ -1,144 +1,98 @@
 WoqlExtra = {
     "chainAndJson": {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:Triple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "A", "@type": "xsd:string"},
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "B", "@type": "xsd:string"},
-                    },
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "C", "@type": "xsd:string"},
-                    },
+                "@type": "Triple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable" : "A"
+                },
+                "predicate": {
+                    "@type" : "NodeValue",
+                    "variable": "B"
+              },
+                "object": {
+                    "@type": "Value",
+                    "variable": "C"
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:Triple",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "D", "@type": "xsd:string"},
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "E", "@type": "xsd:string"},
-                    },
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "F", "@type": "xsd:string"},
-                    },
+                "@type": "Triple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "variable": "D"
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "variable": "E"
+                },
+                "object": {
+                    "@type": "Value",
+                    "variable": "F"
                 },
             },
         ],
     },
     "usingJson": {
-        "@type": "woql:Using",
-        "@context": "/api/prefixes/userName/dbName/local/commit/commitID",
-        "woql:collection": {
-            "@type": "xsd:string",
-            "@value": "userName/dbName/local/commit/commitID",
-        },
-        "woql:query": {
-            "@type": "woql:Triple",
-            "woql:subject": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "A", "@type": "xsd:string"},
+        "@type": "Using",
+        "collection": "userName/dbName/local/commit/commitID",
+        "query": {
+            "@type": "Triple",
+            "subject": {
+                "@type": "NodeValue",
+                "variable": "A"
             },
-            "woql:predicate": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "B", "@type": "xsd:string"},
+            "predicate": {
+                "@type": "NodeValue",
+                "variable": "B"
             },
-            "woql:object": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "C", "@type": "xsd:string"},
+            "object": {
+                "@type": "Value",
+                "variable": "C"
             },
         },
     },
     "multiUsingJson": {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:Using",
-                    "@context": "/api/prefixes/admin/dbName/local/commit/commitID_1",
-                    "woql:collection": {
-                        "@type": "xsd:string",
-                        "@value": "admin/dbName/local/commit/commitID_1",
+                "@type": "Using",
+                "collection": "admin/dbName/local/commit/commitID_1",
+                "query": {
+                    "@type": "Triple",
+                    "subject": {
+                        "@type": "NodeValue",
+                        "variable": "A"
                     },
-                    "woql:query": {
-                        "@type": "woql:Triple",
-                        "woql:subject": {
-                            "@type": "woql:Variable",
-                            "woql:variable_name": {
-                                "@value": "A",
-                                "@type": "xsd:string",
-                            },
-                        },
-                        "woql:predicate": {
-                            "@type": "woql:Variable",
-                            "woql:variable_name": {
-                                "@value": "B",
-                                "@type": "xsd:string",
-                            },
-                        },
-                        "woql:object": {
-                            "@type": "woql:Variable",
-                            "woql:variable_name": {
-                                "@value": "C",
-                                "@type": "xsd:string",
-                            },
-                        },
+                    "predicate": {
+                        "@type": "NodeValue",
+                        "variable": "B"
+                    },
+                    "object": {
+                        "@type": "Value",
+                        "variable": "C"
                     },
                 },
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:Using",
-                    "@context": "/api/prefixes/admin/dbName/local/commit/commitID_2",
-                    "woql:collection": {
-                        "@type": "xsd:string",
-                        "@value": "admin/dbName/local/commit/commitID_2",
-                    },
-                    "woql:query": {
-                        "@type": "woql:Not",
-                        "woql:query": {
-                            "@type": "woql:Triple",
-                            "woql:subject": {
-                                "@type": "woql:Variable",
-                                "woql:variable_name": {
-                                    "@value": "A",
-                                    "@type": "xsd:string",
-                                },
-                            },
-                            "woql:predicate": {
-                                "@type": "woql:Variable",
-                                "woql:variable_name": {
-                                    "@value": "B",
-                                    "@type": "xsd:string",
-                                },
-                            },
-                            "woql:object": {
-                                "@type": "woql:Variable",
-                                "woql:variable_name": {
-                                    "@value": "C",
-                                    "@type": "xsd:string",
-                                },
-                            },
+                "@type": "Using",
+                "collection": "admin/dbName/local/commit/commitID_2",
+                "query": {
+                    "@type": "Not",
+                    "query": {
+                        "@type": "Triple",
+                        "subject": {
+                            "@type": "NodeValue",
+                            "variable": "A"
+                        },
+                        "predicate": {
+                            "@type": "NodeValue",
+                            "variable": "B"
+                        },
+                        "object": {
+                            "@type": "Value",
+                            "variable": "C"
                         },
                     },
                 },
diff --git a/terminusdb_client/tests/woqljson/woqlIdgenJson.py b/terminusdb_client/tests/woqljson/woqlIdgenJson.py
index 247f1f03..5caaa624 100644
--- a/terminusdb_client/tests/woqljson/woqlIdgenJson.py
+++ b/terminusdb_client/tests/woqljson/woqlIdgenJson.py
@@ -1,56 +1,40 @@
 WOQL_IDGEN_JSON = {
-    "@type": "woql:IDGenerator",
-    "woql:base": {"@type": "woql:Node", "woql:node": "doc:Station"},
-    "woql:key_list": {
-        "@type": "woql:Array",
-        "woql:array_element": [
-            {
-                "@type": "woql:ArrayElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1 - 1},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "Start_ID"},
-            }
-        ],
+    "@type": "LexicalKey",
+    "base": {"@type": "DataValue", "data": {"@type" : "xsd:string", "@value" : "Station"}},
+    "key_list": {
+        "@type": "DataValue",
+        "variable": "Start_ID"
     },
-    "woql:uri": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "Start_Station_URL"},
+    "uri": {
+        "@type": "NodeValue",
+        "variable": "Start_Station_URL",
     },
 }
 
 WOQL_UNIQUE_JSON = {
-    "@type": "woql:Unique",
-    "woql:base": {"@type": "woql:Node", "woql:node": "doc:Station"},
-    "woql:key_list": {
-        "@type": "woql:Array",
-        "woql:array_element": [
-            {
-                "@type": "woql:ArrayElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1 - 1},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "Start_ID"},
-            }
-        ],
+    "@type": "HashKey",
+    "base": {"@type": "DataValue", "data": {"@type" : "xsd:string", "@value" : "Station"}},
+    "key_list":
+    {
+        "@type": "DataValue",
+        "variable": "Start_ID",
     },
-    "woql:uri": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "Start_Station_URL"},
+    "uri": {
+        "@type": "NodeValue",
+        "variable": "Start_Station_URL",
     },
 }
 
 WOQL_RANDOM_IDGEN_JSON = {
-    "@type": "woql:RandomIDGenerator",
-    "woql:base": {"@type": "woql:Node", "woql:node": "doc:Station"},
-    "woql:key_list": {
-        "@type": "woql:Array",
-        "woql:array_element": [
-            {
-                "@type": "woql:ArrayElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1 - 1},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "Start_ID"},
-            }
-        ],
+    "@type": "RandomKey",
+    "base": {"@type": "DataValue", "data": {"@type" : "xsd:string", "@value" : "Station"}},
+    "key_list":
+    {
+        "@type": "DataValue",
+        "variable": "Start_ID",
     },
-    "woql:uri": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "Start_Station_URL"},
+    "uri": {
+        "@type": "NodeValue",
+        "variable": "Start_Station_URL",
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlJoinSplitJson.py b/terminusdb_client/tests/woqljson/woqlJoinSplitJson.py
index 47b12bf9..91feafce 100644
--- a/terminusdb_client/tests/woqljson/woqlJoinSplitJson.py
+++ b/terminusdb_client/tests/woqljson/woqlJoinSplitJson.py
@@ -1,43 +1,38 @@
 WOQL_JOIN_SPLIT_JSON = {
     "joinJson": {
-        "@type": "woql:Join",
-        "woql:join_list": {
-            "@type": "woql:Array",
-            "woql:array_element": [
-                {
-                    "@type": "woql:ArrayElement",
-                    "woql:variable_name": {"@value": "A_obj", "@type": "xsd:string"},
-                    "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                },
-                {
-                    "@type": "woql:ArrayElement",
-                    "woql:variable_name": {"@value": "B_obj", "@type": "xsd:string"},
-                    "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                },
-            ],
+        "@type": "Join",
+        "list": [
+            {
+                "@type": "DataValue",
+                "variable": "A_obj"
+            },
+            {
+                "@type": "DataValue",
+                "variable": "B_obj"
+            },
+        ],
+        "separator": {
+            "@type": "DataValue",
+            "data": {"@type": "xsd:string", "@value": ", "},
         },
-        "woql:join_separator": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": ", "},
-        },
-        "woql:join": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "output", "@type": "xsd:string"},
+        "result": {
+            "@type": "DataValue",
+            "variable": "output",
         },
     },
     "splitJson": {
-        "@type": "woql:Split",
-        "woql:split_string": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "A, B, C"},
+        "@type": "Split",
+        "string": {
+            "@type": "DataValue",
+            "data": {"@type": "xsd:string", "@value": "A, B, C"},
         },
-        "woql:split_pattern": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": ", "},
+        "pattern": {
+            "@type": "DataValue",
+            "data": {"@type": "xsd:string", "@value": ", "},
         },
-        "woql:split_list": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "list_obj", "@type": "xsd:string"},
+        "list": {
+            "@type": "DataValue",
+            "variable": "list_obj",
         },
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlJson.py b/terminusdb_client/tests/woqljson/woqlJson.py
index 46acd0a6..8d661d2a 100644
--- a/terminusdb_client/tests/woqljson/woqlJson.py
+++ b/terminusdb_client/tests/woqljson/woqlJson.py
@@ -1,368 +1,307 @@
-WOQL_STAR = {
-    "@type": "woql:Triple",
-    "woql:object": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "Object"},
-    },
-    "woql:predicate": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "Predicate"},
-    },
-    "woql:subject": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@type": "xsd:string", "@value": "Subject"},
-    },
-}
+WOQL_STAR = { "@type": "Triple",
+              "object": { "@type": "Value",
+                          "variable": "Object", },
+              "predicate": { "@type": "NodeValue",
+                             "variable": "Predicate" },
+              "subject": { "@type": "NodeValue",
+                           "variable": "Subject" },}
 
 WOQL_JSON = {
     "quadJson": {
-        "@type": "woql:Quad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "Triple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "node": "c",
         },
-        "woql:graph_filter": {"@type": "xsd:string", "@value": "d"},
+        "graph_filter": "d",
     },
     "tripleJson": {
-        "@type": "woql:Triple",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "Triple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "node": "c",
         },
     },
     "getJson": {
-        "@type": "woql:Get",
-        "woql:as_vars": [
+        "@type": "Get",
+        "columns": [
             {
-                "@type": "woql:NamedAsVar",
-                "woql:identifier": {"@type": "xsd:string", "@value": "M"},
-                "woql:variable_name": {"@type": "xsd:string", "@value": "a"},
-                "woql:var_type": {"@type": "xsd:anyURI", "@value": "p"},
+                "@type": "Column",
+                "indicator": {"@type": "Indicator", "name": "M"},
+                "variable": "a",
+                "type": "p",
             }
         ],
-        "woql:query_resource": "Target",
+        "resource": "Target",
     },
     "memberJson": {
-        "@type": "woql:Member",
-        "woql:member": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "member", "@type": "xsd:string"},
+        "@type": "Member",
+        "member": {
+            "@type": "Value",
+            "variable": "member"
         },
-        "woql:member_list": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "list_obj", "@type": "xsd:string"},
+        "list": {
+            "@type": "Value",
+            "variable": "list_obj"
         },
     },
     "groupbyJson": {
-        "@type": "woql:GroupBy",
-        "woql:group_by": [
-            {
-                "@type": "woql:VariableListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:variable_name": {"@value": "A", "@type": "xsd:string"},
-            },
-            {
-                "@type": "woql:VariableListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:variable_name": {"@value": "B", "@type": "xsd:string"},
-            },
-        ],
-        "woql:group_template": [
-            {
-                "@type": "woql:VariableListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:variable_name": {"@value": "C", "@type": "xsd:string"},
-            }
-        ],
-        "woql:grouped": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "New", "@type": "xsd:string"},
+        "@type": "GroupBy",
+        "group_by": ["A","B"],
+        "template": ["C"],
+        "grouped": {
+            "@type": "Value",
+            "variable": "New"
         },
-        "woql:query": {
-            "@type": "woql:Triple",
-            "woql:subject": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "A", "@type": "xsd:string"},
+        "query": {
+            "@type": "Triple",
+            "subject": {
+                "@type": "NodeValue",
+                "variable": "A"
             },
-            "woql:predicate": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "B", "@type": "xsd:string"},
+            "predicate": {
+                "@type": "NodeValue",
+                "variable": "B"
             },
-            "woql:object": {
-                "@type": "woql:Variable",
-                "woql:variable_name": {"@value": "C", "@type": "xsd:string"},
+            "object": {
+                "@type": "Value",
+                "variable": "C"
             },
         },
     },
     "addClassJson": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "scm:id"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-        "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "id"},
+        "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+        "object": {"@type": "Value", "node": "owl:Class"},
+        "graph": "schema",
     },
     "subsumptionJson": {
-        "@type": "woql:Subsumption",
-        "woql:parent": {"@type": "woql:Node", "woql:node": "scm:ClassA"},
-        "woql:child": {"@type": "woql:Node", "woql:node": "scm:ClassB"},
+        "@type": "Subsumption",
+        "parent": {"@type": "NodeValue", "node": "ClassA"},
+        "child": {"@type": "NodeValue", "node": "ClassB"},
     },
     "orderbyJson": {
-        "@type": "woql:OrderBy",
-        "woql:query": WOQL_STAR,
-        "woql:variable_ordering": [
+        "@type": "OrderBy",
+        "query": WOQL_STAR,
+        "ordering": [
             {
-                "@type": "woql:VariableOrdering",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:ascending": {"@type": "xsd:boolean", "@value": True},
-                "woql:variable": {
-                    "@type": "woql:Variable",
-                    "woql:variable_name": {"@value": "A", "@type": "xsd:string"},
-                },
+                "@type": "OrderTemplate",
+                "order" : "asc",
+                "variable": "A"
             },
             {
-                "@type": "woql:VariableOrdering",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:ascending": {"@type": "xsd:boolean", "@value": False},
-                "woql:variable": {
-                    "@type": "woql:Variable",
-                    "woql:variable_name": {"@value": "B", "@type": "xsd:string"},
-                },
+                "@type": "OrderTemplate",
+                "order" : "asc",
+                "variable": "B"
             },
             {
-                "@type": "woql:VariableOrdering",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 2},
-                "woql:ascending": {"@type": "xsd:boolean", "@value": True},
-                "woql:variable": {
-                    "@type": "woql:Variable",
-                    "woql:variable_name": {"@value": "C", "@type": "xsd:string"},
-                },
+                "@type": "OrderTemplate",
+                "order" : "asc",
+                "variable": "C"
             },
         ],
     },
     "isAJson": {
-        "@type": "woql:IsA",
-        "woql:element": {"@type": "woql:Node", "woql:node": "doc:instance"},
-        "woql:of_type": {"@type": "woql:Node", "woql:node": "owl:Class"},
+        "@type": "IsA",
+        "element": {"@type": "NodeValue", "node": "instance"},
+        "type": {"@type": "NodeValue", "node": "Class"},
     },
     "deleteTripleJson": {
-        "@type": "woql:DeleteTriple",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "DeleteTriple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "node": "c",
         },
     },
     "deleteQuadJson": {
-        "@type": "woql:DeleteQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "DeleteTriple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "node": "c",
         },
-        "woql:graph": {"@type": "xsd:string", "@value": "d"},
+        "graph": "d",
     },
     "addTripleJson": {
-        "@type": "woql:AddTriple",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "node": "c",
         },
     },
     "addQuadJson": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "node": "c",
         },
-        "woql:graph": {"@type": "xsd:string", "@value": "d"},
+        "graph": "d",
     },
     "addPropertyJson": {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:some_property",
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "owl:DatatypeProperty",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                    "node": "some_property",
+                },
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {
+                    "@type": "Value",
+                    "node": "owl:DataValueProperty",
                 },
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:some_property",
-                    },
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:range"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "xsd:string"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+                "@type": "AddTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                "node": "some_property",
                 },
+                "predicate": {"@type": "NodeValue", "node": "rdfs:range"},
+                "object": {"@type": "Value", "node": "xsd:string"},
+                "graph": "schema",
             },
         ],
     },
     "deletePropertyJson": {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:DeleteQuad",
-                    "woql:subject": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:some_property",
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "All", "@type": "xsd:string"},
-                    },
-                    "woql:object": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "Al2", "@type": "xsd:string"},
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "string"},
+                "@type": "DeleteTriple",
+                "subject": {
+                    "@type": "NodeValue",
+                "node": "some_property",
+                },
+                "predicate": {
+                    "@type": "NodeValue",
+                    "variable": "All"
+                },
+                "object": {
+                    "@type": "Value",
+                    "variable": "Al2"
                 },
+                "graph": "string"
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:DeleteQuad",
-                    "woql:subject": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "Al3", "@type": "xsd:string"},
-                    },
-                    "woql:predicate": {
-                        "@type": "woql:Variable",
-                        "woql:variable_name": {"@value": "Al4", "@type": "xsd:string"},
-                    },
-                    "woql:object": {
-                        "@type": "woql:Node",
-                        "woql:node": "scm:some_property",
-                    },
-                    "woql:graph": {"@type": "xsd:string", "@value": "string"},
+                "@type": "DeleteTriple",
+                "subject": {
+                    "@type": "Value",
+                    "variable": "Al3"
+                },
+                "predicate": {
+                    "@type": "Value",
+                    "variable": "Al4"
                 },
+                "object": {
+                    "@type": "Value",
+                    "node": "some_property",
+                },
+                "graph": "string",
             },
         ],
     },
     "graphMethodJson": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:x"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "x"},
+        "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+        "object": {
+            "@type": "Value",
+            "data": {
                 "@value": "my label",
                 "@type": "xsd:string",
                 "@language": "en",
             },
         },
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "graph": "schema",
     },
     "labelMethodJson": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:x"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "x"},
+        "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+        "object": {
+            "@type": "Value",
+            "data": {
                 "@value": "my label",
                 "@type": "xsd:string",
                 "@language": "en",
             },
         },
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "graph": "schema",
     },
     "labelMethodJson2": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:x"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:label"},
-        "woql:object": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "label", "@type": "xsd:string"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "x"},
+        "predicate": {"@type": "NodeValue", "node": "rdfs:label"},
+        "object": {
+            "@type": "Value",
+            "variable": "label"
         },
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "graph": "schema",
     },
     "addClassDescJson": {
-        "@type": "woql:And",
-        "woql:query_list": [
+        "@type": "And",
+        "and": [
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:NewClass"},
-                    "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-                    "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
-                },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "NewClass"},
+                "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+                "object": {"@type": "Value", "node": "owl:Class"},
+                "graph": "schema",
             },
             {
-                "@type": "woql:QueryListElement",
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-                "woql:query": {
-                    "@type": "woql:AddQuad",
-                    "woql:subject": {"@type": "woql:Node", "woql:node": "scm:NewClass"},
-                    "woql:predicate": {
-                        "@type": "woql:Node",
-                        "woql:node": "rdfs:comment",
-                    },
-                    "woql:object": {
-                        "@type": "woql:Datatype",
-                        "woql:datatype": {
-                            "@value": "A new class object.",
-                            "@type": "xsd:string",
-                            "@language": "en",
-                        },
+                "@type": "AddTriple",
+                "subject": {"@type": "NodeValue", "node": "NewClass"},
+                "predicate": {
+                    "@type": "NodeValue",
+                    "node": "rdfs:comment",
+                },
+                "object": {
+                    "@type": "Value",
+                    "data": {
+                        "@value": "A new class object.",
+                        "@type": "xsd:string",
+                        "@language": "en",
                     },
-                    "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
                 },
+                "graph": "schema",
             },
         ],
     },
     "addNodePropJson": {
-        "@type": "woql:AddTriple",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:x"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:myprop"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "value"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "x"},
+        "predicate": {"@type": "NodeValue", "node": "myprop"},
+        "object": {
+            "@type": "DataValue",
+            "data": {"@type": "xsd:string", "@value": "value"},
         },
     },
     "nodeParentJson": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:x"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdfs:subClassOf"},
-        "woql:object": {"@type": "woql:Node", "woql:node": "scm:classParentName"},
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "x"},
+        "predicate": {"@type": "NodeValue", "node": "rdfs:subClassOf"},
+        "object": {"@type": "Value", "node": "classParentName"},
+        "graph": "schema",
     },
     "nodeAbstractJson": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:x"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "terminus:tag"},
-        "woql:object": {"@type": "woql:Node", "woql:node": "terminus:abstract"},
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "x"},
+        "predicate": {"@type": "NodeValue", "node": "terminus:tag"},
+        "object": {"@type": "Value", "node": "terminus:abstract"},
+        "graph": "schema",
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlLimitStar.py b/terminusdb_client/tests/woqljson/woqlLimitStar.py
index bdc37ae4..3d2312e6 100644
--- a/terminusdb_client/tests/woqljson/woqlLimitStar.py
+++ b/terminusdb_client/tests/woqljson/woqlLimitStar.py
@@ -1,22 +1,19 @@
 WoqlLimitStart = {
-    "@type": "woql:Limit",
-    "woql:limit": {
-        "@type": "woql:Datatype",
-        "woql:datatype": {"@type": "xsd:nonNegativeInteger", "@value": 10},
-    },
-    "woql:query": {
-        "@type": "woql:Triple",
-        "woql:subject": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Subject", "@type": "xsd:string"},
+    "@type": "Limit",
+    "limit": 10,
+    "query": {
+        "@type": "Triple",
+        "subject": {
+            "@type": "NodeValue",
+            "variable": "Subject",
         },
-        "woql:predicate": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Predicate", "@type": "xsd:string"},
+        "predicate": {
+            "@type": "NodeValue",
+            "variable": "Predicate",
         },
-        "woql:object": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Object", "@type": "xsd:string"},
+        "object": {
+            "@type": "Value",
+            "variable": "Object",
         },
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlMathJson.py b/terminusdb_client/tests/woqljson/woqlMathJson.py
index 5e7e68e0..8d1c62dc 100644
--- a/terminusdb_client/tests/woqljson/woqlMathJson.py
+++ b/terminusdb_client/tests/woqljson/woqlMathJson.py
@@ -1,83 +1,91 @@
 WOQL_MATH_JSON = {
     "divJson": {
-        "@type": "woql:Div",
-        "woql:first": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2"},
+        "@type": "Div",
+        "left": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 2},
         },
-        "woql:second": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "1"},
+        "right": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
     },
     "minusJson": {
-        "@type": "woql:Minus",
-        "woql:first": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2"},
+        "@type": "Minus",
+        "left": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
-        "woql:second": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "1"},
+        "right": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
     },
     "evalJson": {
-        "@type": "woql:Eval",
-        "woql:expression": "1+2",
-        "woql:result": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "b"},
+        "@type": "Eval",
+        "expression": {
+            "@type": "Plus",
+            "left": {
+                "@type": "ArithmeticValue",
+                "data": {"@type": "xsd:decimal", "@value": 1}},
+            "right": {
+                "@type": "ArithmeticValue",
+                "data": {"@type": "xsd:decimal", "@value": 2}}
+        },
+        "result": {
+            "@type": "ArithmeticValue",
+            "variable": "x",
         },
     },
     "plusJson": {
-        "@type": "woql:Plus",
-        "woql:first": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2"},
+        "@type": "Plus",
+        "left": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 2},
         },
-        "woql:second": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "1"},
+        "right": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
     },
     "timesJson": {
-        "@type": "woql:Times",
-        "woql:first": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2"},
+        "@type": "Times",
+        "left": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 2},
         },
-        "woql:second": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "1"},
+        "right": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
     },
     "divideJson": {
-        "@type": "woql:Divide",
-        "woql:first": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2"},
+        "@type": "Divide",
+        "left": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 2},
         },
-        "woql:second": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "1"},
+        "right": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
     },
     "expJson": {
-        "@type": "woql:Exp",
-        "woql:first": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2"},
+        "@type": "Exp",
+        "left": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 2},
         },
-        "woql:second": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "1"},
+        "right": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 1},
         },
     },
     "floorJson": {
-        "@type": "woql:Floor",
-        "woql:argument": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:decimal", "@value": "2.5"},
+        "@type": "Floor",
+        "argument": {
+            "@type": "ArithmeticValue",
+            "data": {"@type": "xsd:decimal", "@value": 2.5},
         },
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlOptJson.py b/terminusdb_client/tests/woqljson/woqlOptJson.py
index 7cf7ca01..9d120886 100644
--- a/terminusdb_client/tests/woqljson/woqlOptJson.py
+++ b/terminusdb_client/tests/woqljson/woqlOptJson.py
@@ -1,12 +1,12 @@
 WoqlOpt = {
-    "@type": "woql:Optional",
-    "woql:query": {
-        "@type": "woql:Triple",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-        "woql:object": {
-            "@type": "woql:Datatype",
-            "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+    "@type": "Optional",
+    "query": {
+        "@type": "Triple",
+        "subject": {"@type": "NodeValue", "node": "a"},
+        "predicate": {"@type": "NodeValue", "node": "b"},
+        "object": {
+            "@type": "Value",
+            "data": {"@type": "xsd:string", "@value": "c"},
         },
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlOrJson.py b/terminusdb_client/tests/woqljson/woqlOrJson.py
index 419fa6e5..5275c66f 100644
--- a/terminusdb_client/tests/woqljson/woqlOrJson.py
+++ b/terminusdb_client/tests/woqljson/woqlOrJson.py
@@ -1,30 +1,22 @@
 WOQL_OR_JSON = {
-    "@type": "woql:Or",
-    "woql:query_list": [
+    "@type": "Or",
+    "or": [
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            "woql:query": {
-                "@type": "woql:Triple",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-                "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-                "woql:object": {
-                    "@type": "woql:Datatype",
-                    "woql:datatype": {"@type": "xsd:string", "@value": "c"},
-                },
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "a"},
+            "predicate": {"@type": "NodeValue", "node": "b"},
+            "object": {
+                "@type": "Value",
+                "node": "c",
             },
         },
         {
-            "@type": "woql:QueryListElement",
-            "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-            "woql:query": {
-                "@type": "woql:Triple",
-                "woql:subject": {"@type": "woql:Node", "woql:node": "doc:1"},
-                "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:2"},
-                "woql:object": {
-                    "@type": "woql:Datatype",
-                    "woql:datatype": {"@type": "xsd:string", "@value": "3"},
-                },
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "1"},
+            "predicate": {"@type": "NodeValue", "node": "2"},
+            "object": {
+                "@type": "Value",
+                "node": "3",
             },
         },
     ],
diff --git a/terminusdb_client/tests/woqljson/woqlReJson.py b/terminusdb_client/tests/woqljson/woqlReJson.py
index c98b7b60..a7293109 100644
--- a/terminusdb_client/tests/woqljson/woqlReJson.py
+++ b/terminusdb_client/tests/woqljson/woqlReJson.py
@@ -1,15 +1,15 @@
 WoqlRe = {
-    "@type": "woql:Regexp",
-    "woql:pattern": {
-        "@type": "woql:Datatype",
-        "woql:datatype": {"@type": "xsd:string", "@value": ".*"},
+    "@type": "Regexp",
+    "pattern": {
+        "@type": "DataValue",
+        "data": {"@type": "xsd:string", "@value": ".*"},
     },
-    "woql:regexp_string": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@value": "string", "@type": "xsd:string"},
+    "regexp_string": {
+        "@type": "DataValue",
+        "variable": "string",
     },
-    "woql:regexp_list": {
-        "@type": "woql:Variable",
-        "woql:variable_name": {"@value": "formated", "@type": "xsd:string"},
+    "regexp_list": {
+        "@type": "DataValue",
+        "variable": "formated",
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlSelectJson.py b/terminusdb_client/tests/woqljson/woqlSelectJson.py
index 4185bee9..cd08e157 100644
--- a/terminusdb_client/tests/woqljson/woqlSelectJson.py
+++ b/terminusdb_client/tests/woqljson/woqlSelectJson.py
@@ -1,44 +1,27 @@
 WoqlSelect = {
     "jsonObj": {
-        "@type": "woql:Select",
-        "woql:variable_list": [
-            {
-                "@type": "woql:VariableListElement",
-                "woql:variable_name": {"@value": "V1", "@type": "xsd:string"},
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            }
-        ],
-        "woql:query": {
-            "@type": "woql:Triple",
-            "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-            "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-            "woql:object": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "Select",
+        "variables": ["V1"],
+        "query": {
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "a"},
+            "predicate": {"@type": "NodeValue", "node": "b"},
+            "object": {
+                "@type": "Value",
+                "data": {"@type": "xsd:string", "@value": "c"},
             },
         },
     },
     "jsonObjMulti": {
-        "@type": "woql:Select",
-        "woql:variable_list": [
-            {
-                "@type": "woql:VariableListElement",
-                "woql:variable_name": {"@value": "V1", "@type": "xsd:string"},
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
-            },
-            {
-                "@type": "woql:VariableListElement",
-                "woql:variable_name": {"@value": "V2", "@type": "xsd:string"},
-                "woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
-            },
-        ],
-        "woql:query": {
-            "@type": "woql:Triple",
-            "woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
-            "woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
-            "woql:object": {
-                "@type": "woql:Datatype",
-                "woql:datatype": {"@type": "xsd:string", "@value": "c"},
+        "@type": "Select",
+        "variable_list": ["V1","V2"],
+        "query": {
+            "@type": "Triple",
+            "subject": {"@type": "NodeValue", "node": "a"},
+            "predicate": {"@type": "NodeValue", "node": "b"},
+            "object": {
+                "@type": "Value",
+                "data": {"@type": "xsd:string", "@value": "c"},
             },
         },
     },
diff --git a/terminusdb_client/tests/woqljson/woqlStarJson.py b/terminusdb_client/tests/woqljson/woqlStarJson.py
index 58c5ae89..24d22c33 100644
--- a/terminusdb_client/tests/woqljson/woqlStarJson.py
+++ b/terminusdb_client/tests/woqljson/woqlStarJson.py
@@ -1,22 +1,19 @@
 WoqlStar = {
-    "@type": "woql:Limit",
-    "woql:limit": {
-        "@type": "woql:Datatype",
-        "woql:datatype": {"@type": "xsd:nonNegativeInteger", "@value": 10},
-    },
-    "woql:query": {
-        "@type": "woql:Triple",
-        "woql:subject": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Subject", "@type": "xsd:string"},
+    "@type": "Limit",
+    "limit": 10,
+    "query": {
+        "@type": "Triple",
+        "subject": {
+            "@type": "NodeValue",
+            "variable": "Subject",
         },
-        "woql:predicate": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Predicate", "@type": "xsd:string"},
+        "predicate": {
+            "@type": "NodeValue",
+            "variable": "Predicate",
         },
-        "woql:object": {
-            "@type": "woql:Variable",
-            "woql:variable_name": {"@value": "Object", "@type": "xsd:string"},
+        "object": {
+            "@type": "Value",
+            "variable": "Object",
         },
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlTrimJson.py b/terminusdb_client/tests/woqljson/woqlTrimJson.py
index 4e243231..9eefa425 100644
--- a/terminusdb_client/tests/woqljson/woqlTrimJson.py
+++ b/terminusdb_client/tests/woqljson/woqlTrimJson.py
@@ -1,11 +1,11 @@
 WOQL_TRIM_JSON = {
-    "@type": "woql:Trim",
-    "woql:untrimmed": {
-        "@type": "woql:Datatype",
-        "woql:datatype": {"@type": "xsd:string", "@value": "a"},
+    "@type": "Trim",
+    "untrimmed": {
+        "@type": "DataValue",
+        "data": {"@type": "xsd:string", "@value": "a"},
     },
-    "woql:trimmed": {
-        "@type": "woql:Datatype",
-        "woql:datatype": {"@type": "xsd:string", "@value": "b"},
+    "trimmed": {
+        "@type": "DataValue",
+        "data": {"@type": "xsd:string", "@value": "b"},
     },
 }
diff --git a/terminusdb_client/tests/woqljson/woqlWhenJson.py b/terminusdb_client/tests/woqljson/woqlWhenJson.py
index 5ac263f0..da60cd47 100644
--- a/terminusdb_client/tests/woqljson/woqlWhenJson.py
+++ b/terminusdb_client/tests/woqljson/woqlWhenJson.py
@@ -1,11 +1,11 @@
 WOQL_WHEN_JSON = {
-    "@type": "woql:When",
-    "woql:query": {"@type": "woql:True"},
-    "woql:consequent": {
-        "@type": "woql:AddQuad",
-        "woql:subject": {"@type": "woql:Node", "woql:node": "scm:id"},
-        "woql:predicate": {"@type": "woql:Node", "woql:node": "rdf:type"},
-        "woql:object": {"@type": "woql:Node", "woql:node": "owl:Class"},
-        "woql:graph": {"@type": "xsd:string", "@value": "schema/main"},
+    "@type": "When",
+    "query": {"@type": "True"},
+    "consequent": {
+        "@type": "AddTriple",
+        "subject": {"@type": "NodeValue", "node": "id"},
+        "predicate": {"@type": "NodeValue", "node": "rdf:type"},
+        "object": {"@type": "Value", "node": "owl:Class"},
+        "graph": "schema",
     },
 }