You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/04/14 15:13:38 UTC
[63/87] [abbrv] clerezza git commit: CLEREZZA-966: moved ported rdf.*
modules to hierarchy
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/LICENSE
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/LICENSE b/rdf.web/rdf.web.ontologies/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rdf.web/rdf.web.ontologies/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/pom.xml
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/pom.xml b/rdf.web/rdf.web.ontologies/pom.xml
deleted file mode 100644
index 1713a43..0000000
--- a/rdf.web/rdf.web.ontologies/pom.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>clerezza</artifactId>
- <version>7-SNAPSHOT</version>
- <relativePath />
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.web.ontologies</artifactId>
- <packaging>bundle</packaging>
- <version>1.0.0-SNAPSHOT</version>
- <name>Clerezza - SCB Web Access Ontologies</name>
- <description>Ontologies defined for local use in SCB Web Access</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>maven-ontologies-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <configuration>
- <resourcePath>${basedir}/src/main/resources</resourcePath>
- <sources>
- <source>${basedir}/target/generated-sources/main/java</source>
- </sources>
- </configuration>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <version>1.0.0-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf b/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
deleted file mode 100644
index 17d70ee..0000000
--- a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/backup.rdf
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF xmlns="http://clerezza.org/2009/11/backup#"
- xml:base="http://clerezza.org/2009/11/backup"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:skos="http://www.w3.org/2008/05/skos#"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
->
-
-<!-- Ontology -->
-
-<owl:Ontology rdf:about="http://clerezza.org/2009/11/backup#">
- <owl:versionInfo>Revision: 0.1</owl:versionInfo>
- <dc:title xml:lang="en">
- Clerezza Backup
- </dc:title>
-</owl:Ontology>
-
-<!-- Classes -->
-<rdfs:Class rdf:about="#Graph">
- <rdf:type rdf:resource="owl:Class"/>
- <rdfs:label xml:lang="en">Graph</rdfs:label>
- <skos:definition xml:lang="en">An RDF graph.</skos:definition>
-</rdfs:Class>
-
-<rdfs:Class rdf:about="#MGraph">
- <rdf:type rdf:resource="owl:Class"/>
- <rdfs:label xml:lang="en">MGraph</rdfs:label>
- <skos:definition xml:lang="en">A mutable RDF graph.</skos:definition>
-</rdfs:Class>
-
-<rdfs:Class rdf:about="#BackupAdminPage">
- <rdf:type rdf:resource="owl:Class"/>
- <rdfs:label xml:lang="en">BackupAdminPage</rdfs:label>
- <skos:definition xml:lang="en">The administrative page to get backups and restore from backups.</skos:definition>
-</rdfs:Class>
-
-
-<!-- Properties -->
-
-<rdf:Property rdf:about="#file">
- <rdf:type rdf:resource="owl:DatatypeProperty" />
- <rdfs:label xml:lang="en">file</rdfs:label>
- <skos:definition xml:lang="en">Points to the backup filename of the subject.
- </skos:definition>
- <rdfs:domain rdf:resource="#Graph"/>
- <rdfs:range rdf:resource="xsd:string"/>
-</rdf:Property>
-
-</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf b/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
deleted file mode 100644
index 3368915..0000000
--- a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/graphmanagement.rdf
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF xmlns="http://clerezza.org/2010/03/graph-management#"
- xml:base="http://clerezza.org/2010/03/graph-management"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:skos="http://www.w3.org/2008/05/skos#"
- xmlns:tcp="http://clerezza.org/2009/06/tcprovider#"
->
-
-<!-- Ontology -->
-
-<owl:Ontology rdf:about="http://clerezza.org/2010/03/graph-management#">
- <owl:versionInfo>Revision: 0.1</owl:versionInfo>
- <dc:title xml:lang="en">
- Ontology for Graph Management Page related concepts
- </dc:title>
-</owl:Ontology>
-
-<!-- Classes -->
-<rdfs:Class rdf:about="#GraphManagementPage">
- <rdf:type rdf:resource="owl:Class"/>
- <rdfs:label xml:lang="en">GraphManagementPage</rdfs:label>
- <skos:definition xml:lang="en">
- A web page fro managing triple collections
- </skos:definition>
-</rdfs:Class>
-
-<!-- Properties -->
-
-<rdf:Property rdf:about="#tripleCollection">
- <rdf:type rdf:resource="owl:ObjectProperty" />
- <rdfs:label xml:lang="en">tripleCollection</rdfs:label>
- <skos:definition xml:lang="en">Points to a Triple Collection.
- </skos:definition>
- <rdfs:range rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
-</rdf:Property>
-
-<rdf:Property rdf:about="#size">
- <rdf:type rdf:resource="owl:DatatypeProperty" />
- <rdfs:label xml:lang="en">size</rdfs:label>
- <skos:definition xml:lang="en">The size (in triples) of a Triple Collection
- </skos:definition>
- <rdfs:domain rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
-</rdf:Property>
-
-</rdf:RDF>
-
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
----------------------------------------------------------------------
diff --git a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf b/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
deleted file mode 100644
index 60dc58d..0000000
--- a/rdf.web/rdf.web.ontologies/src/main/resources/org/apache/clerezza/rdf/web/ontologies/sparqlendpoint.rdf
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<rdf:RDF xmlns="http://clerezza.org/2009/11/sparql-endpoint#"
- xml:base="http://clerezza.org/2009/11/sparql-endpoint"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:skos="http://www.w3.org/2008/05/skos#"
- xmlns:tcp="http://clerezza.org/2009/06/tcprovider#"
->
-
-<!-- Ontology -->
-
-<owl:Ontology rdf:about="http://clerezza.org/2009/11/sparql-endpoint#">
- <owl:versionInfo>Revision: 0.1</owl:versionInfo>
- <dc:title xml:lang="en">
- Clerezza Sparql-Endpoint
- </dc:title>
-</owl:Ontology>
-
-<!-- Classes -->
-<rdfs:Class rdf:about="#SparqlEndpoint">
- <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
- <rdfs:label xml:lang="en">SparqlEndpoint</rdfs:label>
- <skos:definition xml:lang="en">
- A web page containing a form for entering a SPARQL query.
- </skos:definition>
-</rdfs:Class>
-
-<!-- Properties -->
-
-<rdf:Property rdf:about="#tripleCollection">
- <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty" />
- <rdfs:label xml:lang="en">tripleCollection</rdfs:label>
- <skos:definition xml:lang="en">Points to a Triple Collection.
- </skos:definition>
- <rdfs:range rdf:resource="http://clerezza.org/2009/06/tcprovider#TripleCollection"/>
-</rdf:Property>
-
-</rdf:RDF>
-
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/LICENSE
----------------------------------------------------------------------
diff --git a/rdf/file.storage/LICENSE b/rdf/file.storage/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/rdf/file.storage/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/file.storage/pom.xml b/rdf/file.storage/pom.xml
new file mode 100644
index 0000000..4932a7c
--- /dev/null
+++ b/rdf/file.storage/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>clerezza</artifactId>
+ <groupId>org.apache.clerezza</groupId>
+ <version>7-SNAPSHOT</version>
+ <relativePath />
+ </parent>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.file.storage</artifactId>
+ <packaging>bundle</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>Clerezza - RDF File Storage Provider</name>
+ <description>A file base storage provider</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.core.test</artifactId>
+ <scope>test</scope>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.jena.parser</artifactId>
+ <scope>test</scope>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.jena.serializer</artifactId>
+ <scope>test</scope>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
new file mode 100644
index 0000000..e9143f9
--- /dev/null
+++ b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileGraph.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.Collection;
+
+import java.util.Iterator;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.BlankNodeOrIri;
+import org.apache.commons.rdf.RdfTerm;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+
+/**
+ *
+ * @author mir
+ */
+public class FileGraph extends SimpleGraph {
+
+ private Serializer serializer;
+ private File file;
+ private String fileType;
+
+ FileGraph(Iri uri, Parser parser,
+ Serializer serializer) {
+ this(new File(URI.create(uri.getUnicodeString())), parser, serializer);
+ }
+
+ public FileGraph(File file, Parser parser, Serializer serializer) {
+ this.file = file;
+ String fileEnding = extractFileEnding(file.getPath());
+ fileType = getMediaTypeForFileEnding(fileEnding);
+ this.serializer = serializer;
+ try {
+ if (file.exists() && file.length() != 0) {
+ InputStream fio = new FileInputStream(file);
+ ImmutableGraph graph = parser.parse(fio, fileType);
+ addAllNoFileAccess(graph);
+ } else {
+ file.createNewFile();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public boolean add(Triple e) {
+ boolean result = super.add(e);
+ writeToFile();
+ return result;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends Triple> c) {
+ boolean modified = addAllNoFileAccess(c);
+ writeToFile();
+ return modified;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ Iterator<Triple> e = super.filter(null, null, null);
+ while (e.hasNext()) {
+ if (o.equals(e.next())) {
+ e.remove();
+ writeToFile();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ boolean modified = false;
+ Iterator<Triple> e = super.filter(null, null, null);
+ while (e.hasNext()) {
+ if (c.contains(e.next())) {
+ e.remove();
+ modified = true;
+ }
+ }
+ writeToFile();
+ return modified;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ boolean result = super.retainAll(c);
+ writeToFile();
+ return result;
+ }
+
+ @Override
+ public Iterator<Triple> filter(final BlankNodeOrIri subject,
+ final Iri predicate,
+ final RdfTerm object) {
+ final Iterator<Triple> baseIter = super.filter(subject, predicate, object);
+ Iterator<Triple> iterator = new Iterator<Triple>() {
+
+ @Override
+ public boolean hasNext() {
+ return baseIter.hasNext();
+ }
+
+ @Override
+ public Triple next() {
+ return baseIter.next();
+ }
+
+ @Override
+ public void remove() {
+ baseIter.remove();
+ writeToFile();
+ }
+
+ };
+ return iterator;
+ }
+
+ private boolean addAllNoFileAccess(Collection<? extends Triple> c) {
+ boolean modified = false;
+ Iterator<? extends Triple> e = c.iterator();
+ while (e.hasNext()) {
+ if (super.add(e.next())) {
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private String extractFileEnding(String uriString) {
+ String fileEnding = uriString.substring(uriString.lastIndexOf(".") + 1, uriString.length());
+ return fileEnding;
+ }
+
+ private String getMediaTypeForFileEnding(String fileEnding) {
+ if (fileEnding.equals("rdf")) {
+ return SupportedFormat.RDF_XML;
+ }
+ if (fileEnding.equals("nt")) {
+ return SupportedFormat.N_TRIPLE;
+ }
+ if (fileEnding.equals("ttl")) {
+ return SupportedFormat.TURTLE;
+ }
+ if (fileEnding.equals("n3")) {
+ return SupportedFormat.N3;
+ }
+ return null;
+ }
+
+ private void writeToFile() {
+ synchronized(this) {
+ OutputStream out;
+ try {
+ out = new FileOutputStream(file);
+ } catch (FileNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
+ try {
+ serializer.serialize(out, this, fileType);
+ } finally {
+ try {
+ out.close();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ }
+
+ public void delete() {
+ file.delete();
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
new file mode 100644
index 0000000..0b4fd33
--- /dev/null
+++ b/rdf/file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileTcProvider.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.osgi.service.component.ComponentContext;
+import org.apache.commons.rdf.ImmutableGraph;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException;
+import org.apache.clerezza.rdf.core.access.EntityUndeletableException;
+import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+
+/**
+ * The <code>FileTcProvider</code> is a <code>WeightedTcProvider</code> that
+ * stores <code>Graph</code>S in the file system. <code>ImmutableGraph</code>S are not
+ * supported.
+ * The <code>Iri</code> of a Graph is location of the file in the file system
+ * (e.g. "file:///home/user/myGraph.rdf"). The format of the rdf data in the file
+ * depends on the file ending, for example ".rdf" or ".ttl".
+ * <code>FileTcProvider</code> uses
+ * <code>org.apache.clerezza.rdf.core.serializedform.Parser</code> and
+ * <code>org.apache.clerezza.rdf.core.serializedform.Serializer</code> for
+ * parsing and serialization, therefore the supported formats depend on the
+ * availability of these services.
+ * The default weight of the provider is 300.
+ *
+ * @scr.component
+ * @scr.service interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"
+ * @scr.property name="weight" type="Integer" value="300"
+ *
+ * @author mir
+ */
+public class FileTcProvider implements WeightedTcProvider {
+
+ /**
+ * @scr.reference
+ */
+ private Parser parser;
+ /**
+ * @scr.reference
+ */
+ private Serializer serializer;
+
+ private Map<Iri, FileGraph> uriRef2GraphMap =
+ new HashMap<Iri, FileGraph>();
+
+ protected static File dataFile = new File("data");
+
+ boolean initialized = false;
+
+ private int weight = 300;
+
+
+ public FileTcProvider() {
+ this.parser = Parser.getInstance();
+ this.serializer = Serializer.getInstance();
+ }
+
+ protected void activate(final ComponentContext componentContext) {
+ weight = (Integer) componentContext.getProperties().get("weight");
+ dataFile = componentContext.getBundleContext().
+ getDataFile("data");
+ }
+
+ @Override
+ public int getWeight() {
+ return weight;
+ }
+
+ @Override
+ public ImmutableGraph getImmutableGraph(Iri name) throws NoSuchEntityException {
+ throw new NoSuchEntityException(name);
+ }
+
+ /**
+ * Get an <code>Graph</code> by its name. If the file at the specified
+ * location already exists, then a Graph is returned even though it was not
+ * created with createGraph().
+ *
+ * @param the name of the <code>Graph</code>
+ * @return name the <code>Graph</code> with the specified name
+ * @throws NoSuchEntityException if there is no <code>Graph</code>
+ * with the specified name or the file didn't exist.
+ */
+ @Override
+ public Graph getMGraph(Iri name) throws NoSuchEntityException {
+ initialize();
+ Graph mGraph = uriRef2GraphMap.get(name);
+ if (mGraph == null) {
+ final String uriString = name.getUnicodeString();
+ if (!uriString.startsWith("file:")) {
+ throw new NoSuchEntityException(name);
+ }
+ File file = new File(URI.create(uriString));
+ if (file.exists()) {
+ return createGraph(name);
+ } else {
+ throw new NoSuchEntityException(name);
+ }
+ }
+ return mGraph;
+ }
+
+ @Override
+ public Graph getGraph(Iri name) throws NoSuchEntityException {
+ return getMGraph(name);
+ }
+
+ @Override
+ public Set<Iri> listImmutableGraphs() {
+ throw new UnsupportedOperationException("Not supported.");
+ }
+
+ @Override
+ public Set<Iri> listMGraphs() {
+ initialize();
+ return uriRef2GraphMap.keySet();
+ }
+
+ @Override
+ public Set<Iri> listGraphs() {
+ return listMGraphs();
+ }
+
+
+ @Override
+ public Graph createGraph(Iri name) throws
+ UnsupportedOperationException, EntityAlreadyExistsException {
+ initialize();
+ if (uriRef2GraphMap.containsKey(name)) {
+ throw new EntityAlreadyExistsException(name);
+ }
+ FileGraph mGraph = new FileGraph(name, parser, serializer);
+ uriRef2GraphMap.put(name, mGraph);
+ writeDataFile();
+ return mGraph;
+ }
+
+ @Override
+ public ImmutableGraph createImmutableGraph(Iri name, Graph triples) throws
+ UnsupportedOperationException, EntityAlreadyExistsException {
+ throw new UnsupportedOperationException("Not supported.");
+ }
+
+ @Override
+ public void deleteGraph(Iri name) throws
+ UnsupportedOperationException, NoSuchEntityException, EntityUndeletableException {
+ initialize();
+ FileGraph mGraph = (FileGraph)getGraph(name);
+ mGraph.delete();
+ uriRef2GraphMap.remove(name);
+ writeDataFile();
+ }
+
+ @Override
+ public Set<Iri> getNames(ImmutableGraph graph) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ private void initialize() throws RuntimeException {
+ if (!initialized) {
+ readDataFile();
+ initialized = true;
+ }
+ }
+
+ private void readDataFile() throws RuntimeException {
+ try {
+ if (dataFile.exists()) {
+ FileInputStream fstream = new FileInputStream(dataFile);
+ DataInputStream in = new DataInputStream(fstream);
+ BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ String strLine;
+ while ((strLine = br.readLine()) != null) {
+ Iri uriRef = new Iri(strLine);
+ uriRef2GraphMap.put(uriRef, new FileGraph(uriRef, parser, serializer));
+ }
+ in.close();
+ } else {
+ dataFile.createNewFile();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void writeDataFile() {
+ FileOutputStream fout = null;
+ try {
+ fout = new FileOutputStream(dataFile);
+ for (Iri uri : uriRef2GraphMap.keySet()) {
+ fout.write((uri.getUnicodeString() + "\n").getBytes());
+ }
+ } catch (FileNotFoundException ex) {
+ throw new RuntimeException(ex);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ finally {
+ try {
+ fout.close();
+ } catch (IOException ex) {
+ Logger.getLogger(FileTcProvider.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider b/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
new file mode 100644
index 0000000..cd429a2
--- /dev/null
+++ b/rdf/file.storage/src/main/resources/META-INF/services/org.apache.clerezza.rdf.core.access.WeightedTcProvider
@@ -0,0 +1 @@
+org.apache.clerezza.rdf.file.storage.FileTcProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
new file mode 100644
index 0000000..e24edb9
--- /dev/null
+++ b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileGraphTest.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Iterator;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Iri;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author mir
+ */
+public class FileGraphTest {
+
+ private static String tempDir = System.getProperty("java.io.tmpdir");
+ private static final String FILE_PROTOCOL = "file://";
+
+ protected static final String NT_FILE_NAME = "test-04.nt";
+ protected static final String RDF_FILE_NAME = "test-04.rdf";
+ protected static final String TURTLE_FILE_NAME = "test-04.ttl";
+
+ private static final Iri uriA = new Iri("http://example.com/a");
+ private static final Iri uriB = new Iri("http://example.com/b");
+ private static final Iri uriC = new Iri("http://example.com/c");
+
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ createTempFileFromRdfTerm(NT_FILE_NAME);
+ createTempFileFromRdfTerm(RDF_FILE_NAME);
+ createTempFileFromRdfTerm(TURTLE_FILE_NAME);
+ }
+
+ @AfterClass
+ public static void cleanUp() throws Exception {
+ deleteTempFile(NT_FILE_NAME);
+ deleteTempFile(RDF_FILE_NAME);
+ deleteTempFile(TURTLE_FILE_NAME);
+ }
+
+ private static void createTempFileFromRdfTerm(String resourceName)
+ throws FileNotFoundException, IOException {
+ InputStream in = FileTcProviderTest.class.getResourceAsStream(resourceName);
+ File file = new File(URI.create(getTempFileUri(resourceName)));
+ FileOutputStream fout = new FileOutputStream(file);
+ int inByte;
+ while ((inByte = in.read()) != -1) {
+ fout.write(inByte);
+ }
+ }
+
+ protected static String getTempFileUri(String name) {
+ String prefix = tempDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
+ return prefix + tempDir.replace(File.separatorChar, '/') + "/" + name;
+ }
+
+ private static void deleteTempFile(String name)
+ throws FileNotFoundException, IOException {
+ File file = new File(tempDir + "/" + name);
+ file.delete();
+ }
+
+ @Test
+ public void testReadingFromFile() {
+ FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(RDF_FILE_NAME)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(2, mGraph.size());
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(TURTLE_FILE_NAME)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(2, mGraph.size());
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(NT_FILE_NAME)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(2, mGraph.size());
+ }
+
+ @Test
+ public void testFilter() throws IOException {
+ String fileName = "filter.rdf";
+ FileGraph mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+ Parser.getInstance(), Serializer.getInstance());
+
+ mGraph.add(new TripleImpl(uriA, uriB, uriC));
+ mGraph.add(new TripleImpl(uriC, uriB, uriA));
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+ Parser.getInstance(), Serializer.getInstance());
+
+
+ assertEquals(2, mGraph.size());
+ Iterator<Triple> iterator = mGraph.filter(null, null, null);
+
+ iterator.next();
+ iterator.remove();
+ assertEquals(1, mGraph.size());
+
+ mGraph = new FileGraph(new Iri(getTempFileUri(fileName)),
+ Parser.getInstance(), Serializer.getInstance());
+ assertEquals(1, mGraph.size());
+ deleteTempFile(fileName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
new file mode 100644
index 0000000..aeff78d
--- /dev/null
+++ b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileTcProviderTest.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import java.util.Set;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Triple;
+import org.apache.commons.rdf.Graph;
+import org.apache.commons.rdf.Iri;
+import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
+
+import org.apache.clerezza.rdf.core.access.TcProvider;
+import org.apache.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.test.TcProviderTest;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author mir
+ */
+public class FileTcProviderTest extends TcProviderTest {
+ private static final String FILE_PROTOCOL = "file://";
+ private static String tempDir = System.getProperty("java.io.tmpdir");
+ private static String testDir = tempDir + "/FileTcProviderTest";
+
+
+ @Override
+ protected Iri generateUri(String name) {
+ String prefix = testDir.startsWith("/") ? FILE_PROTOCOL : FILE_PROTOCOL +"/";
+ String path = prefix + testDir.replace('\\', '/') + "/";
+ return new Iri(path + name + ".rdf");
+ }
+
+ @Before
+ public void setupDirectory() {
+ FileUtil.setUpEmptyDirectory(testDir);
+ }
+
+ @After
+ public void deleteDataFile() {
+ FileUtil.delete(FileTcProvider.dataFile);
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testCreateImmutableGraph() {
+ super.testCreateImmutableGraph();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testCreateImmutableGraphExtended() throws Exception {
+ super.testCreateImmutableGraphExtended();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testGetImmutableGraph() {
+ super.testGetImmutableGraph();
+ }
+
+
+ @Test
+ @Override
+ public void testGetTriples() {
+ TcProvider fileTcProvider = getInstance();
+ // add Graphs
+ Graph mGraph = new SimpleGraph();
+ // add Graphs
+ mGraph = fileTcProvider.createGraph(uriRefA1);
+ mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
+ mGraph = fileTcProvider.createGraph(uriRefB1);
+ mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
+
+ // get a Graph
+ Graph tripleCollection2 = fileTcProvider.getGraph(uriRefB1);
+
+ Iterator<Triple> iterator = tripleCollection2.iterator();
+ assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
+ assertFalse(iterator.hasNext());
+ }
+
+ @Test
+ @Override
+ public void testDeleteEntity() {
+ TcProvider fileTcProvider = getInstance();
+ Graph mGraph = fileTcProvider.createGraph(uriRefA);
+ mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
+ fileTcProvider.deleteGraph(uriRefA);
+ try {
+ fileTcProvider.getGraph(uriRefA);
+ assertTrue(false);
+ } catch (NoSuchEntityException e) {
+ assertTrue(true);
+ }
+ fileTcProvider = getInstance();
+ try {
+ fileTcProvider.getGraph(uriRefA);
+ assertTrue(false);
+ } catch (NoSuchEntityException e) {
+ assertTrue(true);
+ }
+ }
+
+ @Override
+ protected TcProvider getInstance() {
+ FileTcProvider fileTcProvider = new FileTcProvider();
+ return fileTcProvider;
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testGetNames() {
+ //super.testGetNames();
+ getInstance().getNames(new SimpleGraph().getImmutableGraph());
+ }
+
+
+ /*@Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testCreateGraphExtended() throws Exception {
+ super.testCreateGraphExtended();
+ }*/
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testCreateGraphNoDuplicateNames() throws Exception {
+ super.testCreateGraphNoDuplicateNames();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testCreateGraphWithInitialCollection() throws Exception {
+ super.testCreateGraphWithInitialCollection();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testGraphIsNotMutable() throws Exception {
+ super.testGraphIsNotMutable();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testGraphDeletion() throws Exception {
+ super.testGraphDeletion();
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ @Override
+ public void testGetTriplesGraph() throws Exception {
+ super.testGetTriples();
+ }
+
+ @Test
+ public void testDataFile() {
+ TcProvider provider = getInstance();
+ provider.createGraph(uriRefA);
+ File dataFile = new File("data");
+ assertTrue(dataFile.exists());
+
+ Set<String> expected = new HashSet<String>();
+ expected.add(uriRefA.getUnicodeString());
+ assertTrue(expected.equals(getLinesFromFile(dataFile)));
+
+ provider.createGraph(uriRefB);
+ expected.add(uriRefB.getUnicodeString());
+ assertTrue(expected.equals(getLinesFromFile(dataFile)));
+
+ provider.deleteGraph(uriRefA);
+ expected.remove(uriRefA.getUnicodeString());
+ assertTrue(expected.equals(getLinesFromFile(dataFile)));
+
+ provider.deleteGraph(uriRefB);
+ expected.remove(uriRefB.getUnicodeString());
+ assertTrue(expected.equals(getLinesFromFile(dataFile)));
+ }
+
+ @Test
+ public void testAutoGraphCreationFromExistingFile() throws Exception{
+ FileGraphTest.setup();
+ TcProvider provider = getInstance();
+ Graph mGraph = provider.getGraph(new Iri(
+ FileGraphTest.getTempFileUri(FileGraphTest.RDF_FILE_NAME)));
+ assertEquals(2 ,mGraph.size());
+ FileGraphTest.cleanUp();
+ }
+
+ private Set<String> getLinesFromFile(File file) throws RuntimeException {
+ try {
+ FileInputStream fstream = new FileInputStream(file);
+ DataInputStream in = new DataInputStream(fstream);
+ BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ String strLine;
+ Set<String> lines = new HashSet<String>();
+ while ((strLine = br.readLine()) != null) {
+ lines.add(strLine);
+ }
+ in.close();
+ return lines;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
new file mode 100644
index 0000000..e163f8a
--- /dev/null
+++ b/rdf/file.storage/src/test/java/org/apache/clerezza/rdf/file/storage/FileUtil.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.rdf.file.storage;
+
+import java.io.File;
+
+/**
+ *
+ * @author mir
+ */
+public class FileUtil {
+
+ /**
+ * Sets up a new <code>SesameGraph</code>.
+ * @param testName Name of the test to support.
+ * @throws RepositoryException If it failed to activate the graph.
+ */
+ public static void setUpEmptyDirectory(String directory) {
+ final File dataDir= new File(directory);
+ dataDir.mkdirs();
+ cleanDirectory(dataDir);
+ }
+
+
+ /**
+ * Cleans the content of the specified directory recursively.
+ * @param dir Abstract path denoting the directory to clean.
+ */
+ public static void cleanDirectory(File dir) {
+ File[] files= dir.listFiles();
+ if (files!=null && files.length>0) {
+ for (File file: files) {
+ delete(file);
+ }
+ }
+ }
+
+ /**
+ * Deletes the specified file or directory.
+ * @param file Abstract path denoting the file or directory to clean.
+ */
+ public static void delete(File file) {
+ if (file.isDirectory()) {
+ cleanDirectory(file);
+ }
+ file.delete();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
new file mode 100644
index 0000000..414e4b8
--- /dev/null
+++ b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.nt
@@ -0,0 +1,2 @@
+_:genid1 <http://example.org/base#a> <http://example.org/base#b> .
+<http://example.org/base#c> <http://example.org/base#d> _:genid2 .
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
new file mode 100644
index 0000000..d046a1b
--- /dev/null
+++ b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.rdf
@@ -0,0 +1,32 @@
+<?xml version='1.0'?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:j.0="http://example.org/base#" >
+ <rdf:Description rdf:about="http://example.org/base#c">
+ <j.0:d rdf:nodeID="A0"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A1">
+ <j.0:a rdf:resource="http://example.org/base#b"/>
+ </rdf:Description>
+</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
----------------------------------------------------------------------
diff --git a/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
new file mode 100644
index 0000000..c518147
--- /dev/null
+++ b/rdf/file.storage/src/test/resources/org/apache/clerezza/rdf/file/storage/test-04.ttl
@@ -0,0 +1,4 @@
+# Test empty [] operator; not allowed as predicate
+@prefix : <http://example.org/base#> .
+[] :a :b .
+:c :d [] .
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/pom.xml
----------------------------------------------------------------------
diff --git a/rdf/pom.xml b/rdf/pom.xml
index ba6f7e4..de62088 100644
--- a/rdf/pom.xml
+++ b/rdf/pom.xml
@@ -53,7 +53,10 @@
<module>ontologies</module>
<module>rdfa</module>
<module>simple.storage</module>
+ <module>storage.web</module>
+ <module>file.storage</module>
<module>utils</module>
+ <module>web</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/d0f43e94/rdf/storage.web/LICENSE
----------------------------------------------------------------------
diff --git a/rdf/storage.web/LICENSE b/rdf/storage.web/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/rdf/storage.web/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.