cypher2sql 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,170 @@
1
+ """The one canonical list of valid Cypher that 0.1.0 refuses.
2
+
3
+ Each entry carries the construct as a reader writes it, why the compiler cannot compile it, the
4
+ alternative that is usually one query away, and the hint the parser or binder attaches when it
5
+ refuses the construct. `docs/api.md`'s "Not supported in 0.1.0" table is generated from this
6
+ tuple and asserted equal by `tests/test_unsupported.py`; the changelog and the vision link to that
7
+ table instead of enumerating the list a second time.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from dataclasses import dataclass
13
+
14
+
15
+ @dataclass(frozen=True, slots=True)
16
+ class Unsupported:
17
+ """One construct, its reason, its alternative and the hint a refusal attaches."""
18
+
19
+ key: str
20
+ construct: str
21
+ why: str
22
+ alternative: str
23
+ hint: str
24
+
25
+
26
+ #: Every refused construct, in the order the API table lists it. The ``why`` and ``alternative``
27
+ #: cells are Markdown; a ``|`` in either would break the table, so none is written.
28
+ UNSUPPORTED: tuple[Unsupported, ...] = (
29
+ Unsupported(
30
+ "projection",
31
+ "`RETURN *`, `RETURN n.name`, `RETURN n, m`, a relationship or a path",
32
+ "the result is one node type's key set, not a projection",
33
+ "return the node variable alone; its key columns are selected for you",
34
+ "return the variable; its key columns are selected for you",
35
+ ),
36
+ Unsupported(
37
+ "aggregation",
38
+ "`RETURN count(*)`, `RETURN sum(o.total)`",
39
+ "the result is a key set, not a number",
40
+ "return the node variable and count its keys around the SQL "
41
+ "(`len(rows)`, or `SELECT count(*) FROM (...)`)",
42
+ "return the variable; its key columns are selected for you",
43
+ ),
44
+ Unsupported(
45
+ "function-call",
46
+ "`size(p.sku)`, `date()`, `datetime()`, `duration()`",
47
+ "a function call builds a value, and temporal values are not part of the query language "
48
+ "here",
49
+ "filter with comparisons, `AND`/`OR`/`NOT`, `IS [NOT] NULL` and pattern predicates; "
50
+ "compare a stored temporal column with a value",
51
+ "filter with comparisons, AND/OR/NOT, IS [NOT] NULL and pattern predicates; "
52
+ "function calls and aggregates are not supported",
53
+ ),
54
+ Unsupported(
55
+ "list-index",
56
+ "`RETURN p[0]`, `RETURN p[0..2]`",
57
+ "a key set has no elements or length",
58
+ "return the variable; read the pieces you need alongside its keys",
59
+ "return the variable; its key columns are selected for you",
60
+ ),
61
+ Unsupported(
62
+ "comprehension",
63
+ "`[x IN xs \\| x]`, `[(a)-->(b) \\| b]`",
64
+ "it builds a value, and the result is keys",
65
+ "ask the question with a pattern predicate or `EXISTS { MATCH ... }` in `WHERE`, "
66
+ "then return the variable",
67
+ "ask the question with a pattern predicate or EXISTS { MATCH ... } in WHERE; "
68
+ "then return the variable",
69
+ ),
70
+ Unsupported(
71
+ "with-projection",
72
+ "a property, aggregate or function in `WITH`; `WITH *`",
73
+ "`WITH` keeps exactly the whole variables you list",
74
+ "name them: `WITH a, b`, and filter with `WHERE`",
75
+ "WITH keeps whole variables: list them, optionally renaming one with AS",
76
+ ),
77
+ Unsupported(
78
+ "with-order",
79
+ "`ORDER BY`, `SKIP` or `LIMIT` inside `WITH`",
80
+ "the result is an unordered key set until `RETURN` orders and pages it",
81
+ "filter with `WHERE`; order and page after `RETURN`",
82
+ "filter with WHERE instead; a key set has no order or page in this compiler",
83
+ ),
84
+ Unsupported(
85
+ "order-by",
86
+ "`ORDER BY o.name`, `ORDER BY o + 1`, `ORDER BY o, p`",
87
+ "the result is a key set, not a projection",
88
+ "order by the returned variable alone, e.g. `ORDER BY o`",
89
+ "the result is a key set: order by the variable RETURN names, e.g. ORDER BY o",
90
+ ),
91
+ Unsupported(
92
+ "named-path",
93
+ "`MATCH p = (\u2026)->()`, `RETURN p`",
94
+ "a path is not a key set; path values are not supported in 0.1.0",
95
+ "return the node variable; ask path questions with a pattern predicate or "
96
+ "`EXISTS { MATCH ... }`",
97
+ "return the node variable; ask path questions with a pattern predicate or "
98
+ "EXISTS { MATCH ... }",
99
+ ),
100
+ Unsupported(
101
+ "case",
102
+ "`CASE WHEN \u2026 THEN \u2026 ELSE \u2026 END`",
103
+ "the result is a key set, so there is no value to compute",
104
+ "filter with comparisons and `AND`/`OR`/`NOT`, or compute the `CASE` around the SQL",
105
+ "filter with comparisons and boolean operators; compute CASE around the SQL",
106
+ ),
107
+ Unsupported(
108
+ "map-literal",
109
+ "`{a: 1}` as a value",
110
+ "a map is not one of the declared property types, and the result is keys",
111
+ "compare one property at a time (`n.a = 1`), or query a JSON column in your own SQL",
112
+ "compare properties one by one; a map is not a value in 0.1.0",
113
+ ),
114
+ Unsupported(
115
+ "unwind",
116
+ "`UNWIND $rows AS row`",
117
+ "`UNWIND` emits rows, not one node type's keys",
118
+ "filter a property with `IN` (a list literal or one list `$param`), or compile one "
119
+ "query per value",
120
+ "filter a property with IN (a list literal or one list $parameter), or compile one "
121
+ "query per value",
122
+ ),
123
+ Unsupported(
124
+ "union",
125
+ "`UNION`, `UNION ALL`",
126
+ "two result sets are not one key set",
127
+ "compile one query per pattern and union their keys in your own SQL",
128
+ "compile one query per pattern and union their keys in your own SQL",
129
+ ),
130
+ Unsupported(
131
+ "call",
132
+ "`CALL { ... }`, `CALL db.labels()`",
133
+ "procedures and subqueries change the row stream",
134
+ "compile the question as one pattern; run procedures with your own SQL",
135
+ "compile the question as one pattern; run procedures with your own SQL",
136
+ ),
137
+ Unsupported(
138
+ "foreach",
139
+ "`FOREACH (x IN xs \\| SET ...)`",
140
+ "writes are not compiled",
141
+ "run the write loop with your own SQL",
142
+ "run the write loop with your own SQL",
143
+ ),
144
+ Unsupported(
145
+ "write",
146
+ "`CREATE`, `MERGE`, `SET`, `DELETE`, `REMOVE`",
147
+ "the compiler reads one node type's keys: it never writes",
148
+ "run writes with your own SQL",
149
+ "run writes with your own SQL",
150
+ ),
151
+ )
152
+
153
+ _BY_KEY = {entry.key: entry for entry in UNSUPPORTED}
154
+
155
+
156
+ def entry(key: str) -> Unsupported:
157
+ """The one entry for `key`; an unknown key is an internal programming error."""
158
+ return _BY_KEY[key]
159
+
160
+
161
+ def hint_for(key: str) -> str:
162
+ """The refusal hint documented for `key`; every refused construct has one."""
163
+ return entry(key).hint
164
+
165
+
166
+ def markdown_table() -> str:
167
+ """The complete "Not supported in 0.1.0" table, exactly as `docs/api.md` shows it."""
168
+ lines = ["| You write | Why it cannot compile | Do this instead |", "|---|---|---|"]
169
+ lines.extend(f"| {item.construct} | {item.why} | {item.alternative} |" for item in UNSUPPORTED)
170
+ return "\n".join(lines)
cypher2sql/py.typed ADDED
File without changes
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.5
2
+ Name: cypher2sql
3
+ Version: 0.1.0
4
+ Summary: Write Cypher graph patterns against your existing PostgreSQL schema; get back plain SQL that selects the matching primary keys.
5
+ Project-URL: Repository, https://github.com/OffworldNexus/cypher2sql
6
+ Project-URL: Issues, https://github.com/OffworldNexus/cypher2sql/issues
7
+ Author-email: Rémy Sanchez <remy.sanchez@hyperthese.net>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Database
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+
22
+ # cypher2sql
23
+
24
+ [![CI](https://github.com/OffworldNexus/cypher2sql/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/OffworldNexus/cypher2sql/actions/workflows/ci.yml)
25
+ [![PyPI](https://img.shields.io/pypi/v/cypher2sql.svg)](https://pypi.org/project/cypher2sql/)
26
+ [![Python](https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-blue.svg)](https://github.com/OffworldNexus/cypher2sql/blob/develop/pyproject.toml)
27
+ [![Docs](https://img.shields.io/badge/docs-offworldnexus.github.io%2Fcypher2sql-blue.svg)](https://offworldnexus.github.io/cypher2sql/)
28
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/OffworldNexus/cypher2sql/blob/develop/LICENSE)
29
+
30
+ **Answer graph questions on the PostgreSQL schema you already have — up to 17.1× faster than Neo4j (median 6.1×), no migration.**
31
+
32
+ Install with `pip install cypher2sql`, describe your tables and foreign keys once, write Cypher, get one parameterized SQL query that returns the primary keys you asked for.
33
+
34
+ [Documentation](https://offworldnexus.github.io/cypher2sql/) · [Tutorial](https://offworldnexus.github.io/cypher2sql/tutorial/) · [API reference](https://offworldnexus.github.io/cypher2sql/api/) · [Performance](https://offworldnexus.github.io/cypher2sql/performance/) · [openCypher parity](https://offworldnexus.github.io/cypher2sql/api/#feature-parity-with-neo4j)
35
+
36
+ ```python
37
+ from cypher2sql import Edge, Node, Schema
38
+
39
+ customer = Node("Customer", table="customer", key="id", properties={"country": str})
40
+ order = Node("Order", table="order", key="id", properties={"id": int})
41
+ shop = Schema(
42
+ nodes=[customer, order],
43
+ edges=[Edge("PLACED", customer, order, source_columns="customer_id")],
44
+ )
45
+
46
+ q = shop.to_sql(
47
+ "MATCH (c:Customer {country: $country})-[:PLACED]->(:Order) RETURN c",
48
+ {"country": "FR"},
49
+ )
50
+ print(q.sql)
51
+ print(q.params)
52
+ ```
53
+ ```text title="output"
54
+ SELECT n1."id"
55
+ FROM "customer" AS n1
56
+ WHERE n1."country" COLLATE "C" = %s::text
57
+ AND EXISTS (
58
+ SELECT 1
59
+ FROM "order" AS n2
60
+ WHERE n2."customer_id" = n1."id"
61
+ )
62
+ ('FR',)
63
+ ```
64
+
65
+ Run it with any driver: `conn.execute(q.sql, q.params)` (psycopg), or feed it to your ORM. A single-column
66
+ key fits `WHERE id IN (...)`, a `psycopg.sql` wrapper still needs your own literal `%` as `%%`, and composite keys
67
+ join a CTE. Compiling never touches the database; on Python ≥ 3.14 a
68
+ [t-string](https://github.com/OffworldNexus/cypher2sql/blob/develop/docs/api.md#t-string-queries) carries its
69
+ values as `{expr}` and takes no `params` dict.
70
+
71
+ - Your database stays relational: no graph extension, no data migration, no runtime dependencies.
72
+ - Property values are always bound parameters; a label/type selector only chooses among identifiers from your
73
+ declared schema.
74
+
75
+ Start with the
76
+ [tutorial](https://github.com/OffworldNexus/cypher2sql/blob/develop/docs/tutorial.md); every name
77
+ is in the
78
+ [API reference](https://github.com/OffworldNexus/cypher2sql/blob/develop/docs/api.md).
79
+
80
+ ## Correctness
81
+
82
+ Correctness is checked on a real PostgreSQL against the official
83
+ [openCypher TCK](https://github.com/opencypher/openCypher/tree/main/tck), vendored in
84
+ `vendor/opencypher-tck/`: 220 features, 3,897 scenario instances (1,615 declarations; outlines expand to 3,897).
85
+ `tests/tck/scope.toml` classifies every instance and
86
+ [the design](https://github.com/OffworldNexus/cypher2sql/blob/develop/docs/design.md#tck) records why.
87
+ `make tck` prints the live split: its first line is
88
+ `in-scope passing: N / N, out-of-scope: M (by category)`, then `planned: P (must not pass)` and one
89
+ count line per category, including `in`; N, M and P are the live counts.
90
+ [The vision](https://github.com/OffworldNexus/cypher2sql/blob/develop/docs/VISION.md#correctness-bar-the-opencypher-tck)
91
+ states that split.
92
+
93
+ ## License
94
+
95
+ Apache-2.0. The vendored openCypher TCK and grammar are Apache-2.0 (see `vendor/*/NOTICE`).
@@ -0,0 +1,40 @@
1
+ cypher2sql/__init__.py,sha256=7fQaHoxhBjwiXo3zvGEXOSdjPyPKJFKiXaIxgM6TGVc,805
2
+ cypher2sql/_ast.py,sha256=F7xoTZjq8Hyq5Fej2awU7LkmW_85_ewE0hB41Sb-B5s,9700
3
+ cypher2sql/_compare.py,sha256=bKvHliWQzmtLKoeqfl5kGZPnJaEyUcKBvzw_tjF_3xc,9209
4
+ cypher2sql/_errors.py,sha256=iOWoQXs79Y1Bl7J-hn4ipXVrlDAqNB5bx0TKuZe_QrQ,14741
5
+ cypher2sql/_infer.py,sha256=dODuP1iD3pxTLORsN-mjuIerDZs5lhrE1fAcYifpa1c,12564
6
+ cypher2sql/_ir.py,sha256=XC1twfTteMZhaErHAEQyiYjSsJSE8AbtpyimGaNGnvc,22889
7
+ cypher2sql/_lexer.py,sha256=eszR-R37cYqBPH4CIHriFHOxdJbDRLRNjMPs3JxlkDM,19176
8
+ cypher2sql/_limits.py,sha256=_fh___n4euaEEiN4rWpiPDep2pTaNW97h1iG9zhJgZM,2749
9
+ cypher2sql/_schema.py,sha256=8daEBdrRhssydJRWeA1K6yEnjMM_7-8Yjvwl-fH-A5I,19148
10
+ cypher2sql/_template.py,sha256=LPl1iYtqP3mpl6utnsuflxDKmJjgM0i_0uaIdTB91Ow,2212
11
+ cypher2sql/_unsupported.py,sha256=WmmDjhcc2kIFT8CZo64isbgz1g1ppZR7iSQAkxEnq7c,7054
12
+ cypher2sql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ cypher2sql/_bind/__init__.py,sha256=93wDdggfg-2IFelgJFBIHVa2G5nUD7G2PdbHc8VSPuQ,3001
14
+ cypher2sql/_bind/_base.py,sha256=uUtd7R96-xKX3crh8NASrEPgz4Ilw3yC5HwTmiICBI8,15509
15
+ cypher2sql/_bind/_binder.py,sha256=j6gev5mzCDTvG8FzRTGEk0aCz5OTRJmQeFdQyERF5ZE,16928
16
+ cypher2sql/_bind/_build.py,sha256=0-1SZbEmLbrvataYjmFpfgQJWiBRcC0Q9MdNe-xXwt8,32985
17
+ cypher2sql/_bind/_edges.py,sha256=MZ9EVooijzKQZ_zOCaoxPW3N39g-G3Qbvdz2S1u0QTM,12515
18
+ cypher2sql/_bind/_names.py,sha256=kajaruXyWmtjKAR0KbofZjrgvj5mFz21aibd9LVIq9w,2915
19
+ cypher2sql/_bind/_patterns.py,sha256=_LGWjbTLP3OHzzRphAVSFGeXejjqnHjDajgUxbF5964,28113
20
+ cypher2sql/_bind/_predicates.py,sha256=KSGPOWm4hFb6710i3Fc9fmv_2YHQlY5jL3nLgdy34AU,24130
21
+ cypher2sql/_bind/_values.py,sha256=Q46Ub_6PWAh10dcsaT8uka7__iMYq3S9JjRDv-BlKwA,27781
22
+ cypher2sql/_emit/__init__.py,sha256=vTNRLgwSZw5UhRd1VeWH4BcCEElOCEBmQpsR-GvyHg4,1962
23
+ cypher2sql/_emit/_core.py,sha256=7YHFWk9dBDX2l2PaXwOqNuA9iNDfb7QAVq1qXqWLIow,15977
24
+ cypher2sql/_emit/_walks.py,sha256=VWOsMzmhmwZ4xV3TfmITEzppXC6e-8cxLbwkzdfltg4,28630
25
+ cypher2sql/_parser/__init__.py,sha256=nQ8j-Z1yiymBTMIPuYR5iVS2VWlTMbRwH0afav1Ij98,3181
26
+ cypher2sql/_parser/_base.py,sha256=Im-i_jtV1TTpuLvUN_NPhu6fBRTnVHdNnayzP8bsIOA,8752
27
+ cypher2sql/_parser/_clauses.py,sha256=ZM6FXhJr61fZoshRa6QXhZ3eoZeYTk9APiCKlpTaYHs,16879
28
+ cypher2sql/_parser/_grammar.py,sha256=H7tpb4y7C8TGGf3jtSBL6dUciIE5X56swyyiiLVKnXc,27682
29
+ cypher2sql/_plan/__init__.py,sha256=Zen322ByfZd0z0pHJVymtv6yzIaK_qzOQ13mvLPB6kI,6041
30
+ cypher2sql/_plan/_groups.py,sha256=WGb0_WtaJ3DM-cIvDjn9uIzfyTYkpiEX3gIjGe1OzF4,11835
31
+ cypher2sql/_plan/_nodes.py,sha256=TuzUHq3SyWzvzUEpGReMf_h4XYlC--IApC-mmvGchbY,19270
32
+ cypher2sql/_plan/_planner.py,sha256=z1uMY1mOg2Imos5MhQ91-HA0eHRgZyrBIasFtyaoOcc,33859
33
+ cypher2sql/_plan/_rows.py,sha256=JBpn_DreEAtcuc8egZpUIC3I8lVhnbA-N_iBvUPN978,35601
34
+ cypher2sql/_plan/_scopes.py,sha256=TVCCfwjC2YbiYqYLApHCMVq3yWTW0vxnTtodxzcDmGQ,3405
35
+ cypher2sql/_plan/_uniqueness.py,sha256=uxo9SquUThxdXl8AWAqKPDiD7ujvc9FowZMNKgWRiNE,3316
36
+ cypher2sql/_plan/_working.py,sha256=jbKUK1bhUh1bJJR6H1oBeKUwDa-adyNpQVIPW4Dl5-o,3005
37
+ cypher2sql-0.1.0.dist-info/METADATA,sha256=HuCmLsymKhiO2BxmNy0lxuJvCujSnqM3VI2vRaOLg4o,4807
38
+ cypher2sql-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
39
+ cypher2sql-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
40
+ cypher2sql-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.