clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [32/87] [abbrv] [partial] clerezza git commit: CLEREZZA-966: removed platform. prefix of folder names
Date Tue, 14 Apr 2015 13:13:07 GMT
http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon-round.png
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon-round.png b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon-round.png
new file mode 100644
index 0000000..597b334
Binary files /dev/null and b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon-round.png differ

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon.png
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon.png b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon.png
new file mode 100644
index 0000000..156e74c
Binary files /dev/null and b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/disco-icon.png differ

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/discostyle.css
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/discostyle.css b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/discostyle.css
new file mode 100644
index 0000000..3977035
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/discostyle.css
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+img {
+	border: 0;
+}
+
+ol {
+	padding-left: 0;
+}
+
+.titledContent {
+	list-style-type: none;
+}
+
+.titledContent .content {
+	padding-left: 1em;
+}
+
+.titledContent .title .typeWidget {
+	font-size: 200%;
+	color: red;
+}
+	
+.titledContent .titledContent  .title .typeWidget {
+	font-size: 150%;
+}
+
+
+.titledContent .titledContent .titledContent .title .typeWidget {
+	font-size: 130%;
+	color: black;
+}
+
+.titledContent .titledContent .titledContent .titledContent .title .typeWidget {
+	font-size: 100%;
+}
+
+.orderedContent {
+	padding-left: 2em;
+}
+.controlArea {
+	float: right;
+}
+
+.sourceEdit {
+	background-color: grey;
+	position: absolute; top: 10%; right: 10%; left: 10%; bottom: 10%
+}
+
+.sourceEdit textarea {
+	width: 100%;
+	height: 90%
+}
+

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/favicon.ico
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/favicon.ico b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/favicon.ico
new file mode 100644
index 0000000..4cb26c1
Binary files /dev/null and b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/style/favicon.ico differ

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/test/java/org/apache/clerezza/platform/content/collections/CollectionsCreatorTest.java
----------------------------------------------------------------------
diff --git a/platform/content/src/test/java/org/apache/clerezza/platform/content/collections/CollectionsCreatorTest.java b/platform/content/src/test/java/org/apache/clerezza/platform/content/collections/CollectionsCreatorTest.java
new file mode 100644
index 0000000..7e5b242
--- /dev/null
+++ b/platform/content/src/test/java/org/apache/clerezza/platform/content/collections/CollectionsCreatorTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.platform.content.collections;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.ontologies.HIERARCHY;
+import org.apache.clerezza.rdf.ontologies.RDF;
+
+
+/**
+ * @author mir, rbn
+ */
+public class CollectionsCreatorTest{
+
+    private static UriRef root = new UriRef("http://localhost:8282/");
+    private UriRef foo = new UriRef("http://localhost:8282/foo/");
+    private UriRef fooResource = new UriRef("http://localhost:8282/foo/resource");
+    private UriRef fooTest = new UriRef("http://localhost:8282/foo/test/");
+    private UriRef fooTestResource4 = new UriRef("http://localhost:8282/foo/test/resource4");
+        
+    @Test
+    public void listPositionTest() throws Exception {
+        MGraph mGraph = new SimpleMGraph();
+        CollectionCreator collectionCreator = new CollectionCreator(mGraph);
+        collectionCreator.createContainingCollections(fooTestResource4);
+        Assert.assertTrue(mGraph.contains(new TripleImpl(fooTest, RDF.type, HIERARCHY.Collection)));
+        Assert.assertTrue(mGraph.contains(new TripleImpl(fooTestResource4, HIERARCHY.parent, fooTest)));
+        Assert.assertTrue(mGraph.contains(new TripleImpl(foo, HIERARCHY.parent, root)));
+        Assert.assertTrue(mGraph.contains(new TripleImpl(root, RDF.type, HIERARCHY.Collection)));
+        collectionCreator.createContainingCollections(fooResource);
+        Assert.assertTrue(mGraph.contains(new TripleImpl(fooResource, HIERARCHY.parent, foo)));
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/cris/LICENSE
----------------------------------------------------------------------
diff --git a/platform/cris/LICENSE b/platform/cris/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/platform/cris/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/70220239/platform/cris/pom.xml
----------------------------------------------------------------------
diff --git a/platform/cris/pom.xml b/platform/cris/pom.xml
new file mode 100644
index 0000000..4585ac3
--- /dev/null
+++ b/platform/cris/pom.xml
@@ -0,0 +1,95 @@
+<?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>0.5</version>
+        <relativePath>../parent</relativePath>
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>platform.cris</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Clerezza - Platform CRIS service for the content graph</name>
+    <description>
+        A composite resource index service for resources described in the content graph
+    </description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.cris.ontologies</artifactId>
+            <version>0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.cris.core</artifactId>
+            <version>0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>0.14</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.utils</artifactId>
+            <version>0.14</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.scala.utils</artifactId>
+            <version>0.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-library</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.graphprovider.content</artifactId>
+            <version>0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.lucene</groupId>
+            <artifactId>lucene-memory</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>org.osgi.framework; version="[1,2)", 
+                            org.osgi.service.component; version="[1,2)",*</Import-Package>
+                        <Export-Package>org.apache.clerezza.platform.cris.*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
----------------------------------------------------------------------
diff --git a/platform/cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java b/platform/cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
new file mode 100644
index 0000000..a3cb10e
--- /dev/null
+++ b/platform/cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
@@ -0,0 +1,243 @@
+/*
+ * 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.platform.cris;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.locks.Lock;
+import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.access.LockableMGraph;
+import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.cris.Condition;
+import org.apache.clerezza.rdf.cris.FacetCollector;
+import org.apache.clerezza.rdf.cris.GraphIndexer;
+import org.apache.clerezza.rdf.cris.IndexDefinitionManager;
+import org.apache.clerezza.rdf.cris.ResourceFinder;
+import org.apache.clerezza.rdf.cris.SortSpecification;
+import org.apache.clerezza.rdf.cris.VirtualProperty;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.lucene.queryparser.classic.ParseException;
+import org.apache.lucene.store.FSDirectory;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Service to index and find resources from the content graph.
+ * 
+ * @author tio
+ */
+@Component(metatype=true)
+@Service(IndexService.class)
+public class IndexService extends ResourceFinder {
+
+    @Property(intValue=0, label="The delay in minutes until the first index optimization is invoked.", 
+            description="This allows to set the time of the first invocation. 0 Is the lowest acceptable value and means run instantly.")
+    static final String OPTIMIZE_DELAY = "org.apache.clerezza.platform.cris.optimizedelay";
+    
+    @Property(intValue=0, label="The period in minutes between index optimizations.", 
+            description="When a new value is set, the first invocation will happen after the specified delay and the old schedule will be canceled instantly. The minimum acceptable value is 1 (min). A value of 0 turns off optimizations.")
+    static final String OPTIMIZE_PERIOD = "org.apache.clerezza.platform.cris.optimizeperiod";
+    
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+
+    IndexDefinitionManager indexDefinitionManager = null;
+
+    GraphIndexer graphIndexer  = null;
+
+    @Reference
+    ContentGraphProvider cgProvider;
+
+    @Reference
+    TcManager tcManager;
+
+    UriRef definitionGraphUri = new UriRef("http://zz.localhost/cris.definitions.graph");
+
+    LockableMGraph definitionGraph = null;
+
+    Integer optimizePeriod = 0;
+    Integer optimizeDelay = 0;
+    
+    protected void activate(ComponentContext context) {
+
+        optimizePeriod = (Integer) context.getProperties().get(OPTIMIZE_PERIOD);
+        optimizeDelay = (Integer) context.getProperties().get(OPTIMIZE_DELAY);
+        if(optimizeDelay == null || optimizeDelay < 0) {
+            optimizeDelay = 0;
+        }
+        
+        try {
+            definitionGraph = tcManager.getMGraph(definitionGraphUri);
+        } catch (NoSuchEntityException ex) {
+            definitionGraph = tcManager.createMGraph(definitionGraphUri);
+        }
+        File luceneIndexDir = context.getBundleContext().getDataFile("lucene-index");
+        boolean createNewIndex = luceneIndexDir.exists();
+        logger.info("Create new index: {}", !createNewIndex);
+
+        indexDefinitionManager = new IndexDefinitionManager(definitionGraph);
+        try {
+            graphIndexer = new GraphIndexer(definitionGraph, cgProvider.getContentGraph(),
+                    FSDirectory.open(luceneIndexDir), !createNewIndex);
+            if(optimizePeriod != null && optimizePeriod >= 1) {
+                long period = optimizePeriod * 60000;
+                long delay = optimizeDelay * 60000;
+                logger.info("Scheduling optimizations with delay {} min and period {} min", delay, period);
+                graphIndexer.scheduleIndexOptimizations(delay, period);
+            }
+        } catch (IOException ex) {
+            logger.error("Could not open lucene index directory.");
+            throw new IllegalStateException(ex);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        if(optimizePeriod >= 1) {
+            graphIndexer.terminateIndexOptimizationSchedule();
+        }
+        optimizeDelay = 0;
+        optimizePeriod = 0;
+        graphIndexer.closeLuceneIndex();
+        graphIndexer = null;
+
+    }
+    
+    @Override
+    public List<NonLiteral> findResources(List<? extends Condition> conditions, 
+            SortSpecification sortSpecification, FacetCollector... facetCollectors) {
+        try {
+            return graphIndexer.findResources(conditions, sortSpecification, facetCollectors);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+    
+    @Override
+    public List<NonLiteral> findResources(List<? extends Condition> conditions, 
+            FacetCollector... facetCollectors) {
+        try {
+            return graphIndexer.findResources(conditions, facetCollectors);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+
+    @Override
+    public List<NonLiteral> findResources(List<? extends Condition> conditions) {
+        try {
+            return graphIndexer.findResources(conditions);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+
+    @Override
+    public List<NonLiteral> findResources(UriRef uriRef, String pattern) {
+        try {
+            return graphIndexer.findResources(uriRef, pattern);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+    
+    @Override
+    public List<NonLiteral> findResources(UriRef uriRef, String pattern, 
+            boolean escapePattern) {
+        
+        try {
+            return graphIndexer.findResources(uriRef, pattern, escapePattern);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+    
+    @Override
+    public List<NonLiteral> findResources(UriRef uriRef, String pattern, 
+            boolean escapePattern, FacetCollector... facetCollectors) {
+        
+        try {
+            return graphIndexer.findResources(uriRef, pattern, escapePattern, facetCollectors);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+    
+    @Override
+    public List<NonLiteral> findResources(UriRef uriRef, String pattern, 
+            boolean escapePattern, SortSpecification sortSpecification, 
+            FacetCollector... facetCollectors) {
+        
+        try {
+            return graphIndexer.findResources(uriRef, pattern, escapePattern, 
+                    sortSpecification, facetCollectors);
+        } catch (ParseException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+    
+    @Override
+    public void reCreateIndex() {
+        graphIndexer.reCreateIndex();
+    }
+
+    @Override
+    public void optimizeIndex() {
+        graphIndexer.optimizeIndex();
+    }
+
+    public void addDefintion(UriRef propertyType, List<UriRef> predicates) {
+        Lock lock = definitionGraph.getLock().writeLock();
+        lock.lock();
+        try {
+            indexDefinitionManager.addDefinition(propertyType, predicates);
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    public void addDefinitionVirtual(UriRef propertyType, List<VirtualProperty> predicates) {
+        Lock lock = definitionGraph.getLock().writeLock();
+        lock.lock();
+        try {
+            indexDefinitionManager.addDefinitionVirtual(propertyType, predicates);
+        } finally {
+            lock.unlock();
+        }
+
+    }
+
+    public void deleteDefintion(UriRef propertyType) {
+        Lock lock = definitionGraph.getLock().writeLock();
+        lock.lock();
+        try {
+            indexDefinitionManager.deleteDefinition(propertyType);
+        } finally {
+            lock.unlock();
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/curieprefixmanager/LICENSE
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/LICENSE b/platform/curieprefixmanager/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/platform/curieprefixmanager/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/70220239/platform/curieprefixmanager/core/LICENSE
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/core/LICENSE b/platform/curieprefixmanager/core/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/platform/curieprefixmanager/core/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/70220239/platform/curieprefixmanager/core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/core/pom.xml b/platform/curieprefixmanager/core/pom.xml
new file mode 100644
index 0000000..d45ecc1
--- /dev/null
+++ b/platform/curieprefixmanager/core/pom.xml
@@ -0,0 +1,89 @@
+<?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>platform.curieprefixmanager</artifactId>
+        <version>0.2</version>
+    </parent>
+    <groupId>org.apache.clerezza</groupId>
+    <artifactId>platform.curieprefixmanager.core</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Clerezza - CURIE prefix manager core</name>
+    <description>
+        Skeleton Core
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.curieprefixmanager.ontologies</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>jaxrs.utils</artifactId>
+            <version>0.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>0.14</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform</artifactId>
+            <version>0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.graphprovider.content</artifactId>
+            <version>0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typerendering.core</artifactId>
+            <version>0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform.typerendering.scalaserverpages</artifactId>
+            <version>0.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>web.fileserver</artifactId>
+            <version>0.10</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/CuriePrefixRecommender.java
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/CuriePrefixRecommender.java b/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/CuriePrefixRecommender.java
new file mode 100644
index 0000000..e03a19a
--- /dev/null
+++ b/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/CuriePrefixRecommender.java
@@ -0,0 +1,36 @@
+/*
+ * 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.platform.curieprefixmanager;
+
+/**
+ *
+ * Describes a service that recommends a CURIE prefix given an IRI prefix
+ *
+ * @author reto
+ */
+public interface CuriePrefixRecommender {
+
+    /**
+     * 
+     * @param iriPrefix that part of the iri that will be replaced by the return value n the CURIE
+     * @return the suggested prefix or null if no suggestion is available
+     */
+    public String getRecommendedPrefix(String iriPrefix);
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/impl/CuriePrefixManager.java
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/impl/CuriePrefixManager.java b/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/impl/CuriePrefixManager.java
new file mode 100644
index 0000000..cf8d22e
--- /dev/null
+++ b/platform/curieprefixmanager/core/src/main/java/org/apache/clerezza/platform/curieprefixmanager/impl/CuriePrefixManager.java
@@ -0,0 +1,237 @@
+/*
+ * 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.platform.curieprefixmanager.impl;
+
+import java.net.URISyntaxException;
+import java.util.Iterator;
+import java.util.concurrent.locks.Lock;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import org.apache.clerezza.jaxrs.utils.RedirectUtil;
+import org.apache.clerezza.jaxrs.utils.TrailingSlash;
+import org.apache.clerezza.platform.curieprefixmanager.CuriePrefixRecommender;
+import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
+import org.apache.clerezza.rdf.core.BNode;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.access.LockableMGraph;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.platform.curieprefixmanager.ontologies.CURIE;
+import org.apache.clerezza.rdf.core.Literal;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+import org.apache.clerezza.rdf.utils.RdfList;
+import org.apache.clerezza.rdf.utils.UnionMGraph;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.scr.annotations.Services;
+import org.osgi.service.component.ComponentContext;
+
+
+/**
+ * Allows to mana a set of CURIE prefix bindings. Multiple URI-Prefix can point
+ * to the same prefix, but per uri-prefix only one suggested prefix is supported.
+ * 
+ * @author reto
+ */
+@Component
+@Services({
+    @Service(Object.class), 
+    @Service(CuriePrefixRecommender.class)
+})
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("/admin/curie-prefix/manager")
+public class CuriePrefixManager implements CuriePrefixRecommender {
+    private static final LiteralFactory literalFactory = LiteralFactory.getInstance();
+
+    @Reference
+    private RenderletManager renderletManager;
+
+    @Reference
+    private ContentGraphProvider cgProvider;
+
+    public void activate(ComponentContext context) throws URISyntaxException {
+        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+                new UriRef(getClass().getResource(
+                "curie-prefix-naked.ssp").toURI().toString()),
+                CURIE.CuriePrefixBinding, "naked",
+                MediaType.APPLICATION_XHTML_XML_TYPE, true);
+        renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+                new UriRef(getClass().getResource(
+                "curie-prefix-list-naked.ssp").toURI().toString()),
+                CURIE.CuriePrefixBindingList, "naked",
+                MediaType.APPLICATION_XHTML_XML_TYPE, true);
+    }
+
+    @GET
+    @Path("new")
+    public GraphNode emptyPrefixBinding() {
+        MGraph resultMGraph = new SimpleMGraph();
+        GraphNode result = new GraphNode(new BNode(), resultMGraph);
+        result.addProperty(RDF.type, CURIE.CuriePrefixBinding);
+        result.addProperty(CURIE.prefix,
+                literalFactory.createTypedLiteral("foaf"));
+        result.addProperty(CURIE.binding,
+                literalFactory.createTypedLiteral("http://xmlns.com/foaf/0.1/"));
+        result.addProperty(RDF.type, PLATFORM.HeadedPage);
+        return result;
+    }
+
+    /**
+     * Saves a PrefixBiding, replacing an existing binding to the same value and
+     * if oldBinding is not null then it is removed
+     */
+    @POST
+    @Path("save")
+    public Response savePrefixBinding(@Context UriInfo uriInfo,
+            @FormParam("prefix") String prefix,
+            @FormParam("binding") String bindingValue,
+             @FormParam("oldBinding") String oldBindingValue) {
+        LockableMGraph contentGraph = cgProvider.getContentGraph();
+        Lock l = contentGraph.getLock().writeLock();
+        l.lock();
+        
+        try {
+            NonLiteral binding = getBindingWithValue(bindingValue, contentGraph);
+            if (binding == null) {
+                binding = new BNode();
+            }
+            GraphNode bindingNode;
+            if (oldBindingValue != null) {
+                NonLiteral oldBinding = getBindingWithValue(oldBindingValue, contentGraph);
+                if (oldBinding != null) {
+                    GraphNode oldBindingNode = new GraphNode(oldBinding, contentGraph);
+                    oldBindingNode.replaceWith(binding);
+                }
+            }
+            bindingNode = new GraphNode(binding, contentGraph);
+            bindingNode.addProperty(RDF.type, CURIE.CuriePrefixBinding);
+            bindingNode.deleteProperties(CURIE.prefix);
+            bindingNode.addProperty(CURIE.prefix, literalFactory.createTypedLiteral(prefix));
+            bindingNode.deleteProperties(CURIE.binding);
+            bindingNode.addProperty(CURIE.binding, literalFactory.createTypedLiteral(bindingValue));
+        } finally {
+            l.unlock();
+        }
+        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
+    }
+
+    @POST
+    @Path("delete")
+    public Response delete(@Context UriInfo uriInfo,
+            @FormParam("binding") String bindingValue) {
+        LockableMGraph contentGraph = cgProvider.getContentGraph();
+        Lock l = contentGraph.getLock().writeLock();
+        l.lock();
+        try {
+            NonLiteral binding = getBindingWithValue(bindingValue, contentGraph);
+            GraphNode bindingNode = new GraphNode(binding, contentGraph);
+            bindingNode.deleteProperty(RDF.type, CURIE.CuriePrefixBinding);
+            bindingNode.deleteProperties(CURIE.prefix);
+            bindingNode.deleteProperties(CURIE.binding);
+        } finally {
+            l.unlock();
+        }
+        return RedirectUtil.createSeeOtherResponse("./", uriInfo);
+    }
+
+    @GET
+    public GraphNode list(@Context UriInfo uriInfo) {
+        TrailingSlash.enforcePresent(uriInfo);
+        TripleCollection resultGraph = new SimpleMGraph();
+        LockableMGraph contentGraph = cgProvider.getContentGraph();
+        GraphNode result = new GraphNode(new BNode(), new UnionMGraph(resultGraph, contentGraph));
+        RdfList list = new RdfList(result);        
+        Lock l = contentGraph.getLock().readLock();
+        l.lock();
+        try {
+            Iterator<Triple> greetings = contentGraph.filter(null, RDF.type, CURIE.CuriePrefixBinding);
+            while (greetings.hasNext()) {
+                list.add(greetings.next().getSubject());
+            }
+        } finally {
+            l.unlock();
+        }
+        result.addProperty(RDF.type, CURIE.CuriePrefixBindingList);
+        result.addProperty(RDF.type, PLATFORM.HeadedPage);
+        return result;
+    }
+
+    @GET
+    @Path("get")
+    public GraphNode getSingle(@QueryParam("binding") String bindingValue) {
+        TripleCollection resultGraph = new SimpleMGraph();
+        LockableMGraph contentGraph = cgProvider.getContentGraph();
+        MGraph unionMGraph = new UnionMGraph(resultGraph, contentGraph);
+        Lock l = contentGraph.getLock().readLock();
+        l.lock();
+        try {
+            GraphNode result = new GraphNode(getBindingWithValue(bindingValue, contentGraph), unionMGraph);
+            result.addProperty(RDF.type, PLATFORM.HeadedPage);
+            return result;
+        } finally {
+            l.unlock();
+        }
+    }
+
+    private static NonLiteral getBindingWithValue(String bindingValue, LockableMGraph graph) {
+        Iterator<Triple> triples = graph.filter(null, CURIE.binding,
+                literalFactory.createTypedLiteral(bindingValue));
+        if (triples.hasNext()) {
+            return triples.next().getSubject();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public String getRecommendedPrefix(String iriPrefix) {
+        LockableMGraph contentGraph = cgProvider.getContentGraph();
+        Lock l = contentGraph.getLock().readLock();
+        l.lock();
+        try {
+            NonLiteral binding = getBindingWithValue(iriPrefix, contentGraph);
+            if (binding == null) {
+                return null;
+            }
+            GraphNode graphNode = new GraphNode(binding, contentGraph);
+            return ((Literal)graphNode.getObjects(CURIE.prefix).next()).getLexicalForm();
+        } finally {
+            l.unlock();
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-list-naked.ssp
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-list-naked.ssp b/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-list-naked.ssp
new file mode 100644
index 0000000..416cffe
--- /dev/null
+++ b/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-list-naked.ssp
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+def curie(s: Any) = new UriRef("http://clerezza.apache.org/platform/curieprefix#" + s)
+
+<div id="tx-content">
+	<h3>The following IRI bases are bound to a CURIE Prefix:</h3>
+	<table>
+
+		<tr><th>IRI prefix</th>
+		<th>CURIE Prefix</th>
+		<th></th></tr>
+	{for (binding <- res!!) yield <tr>
+	<td><a href={"get?binding="+(binding/curie("binding")*)}>{binding/curie("binding")*}</a></td>
+	<td>{binding/curie("prefix")*}</td>
+	<td><form action="delete" method="post">
+		<input name="binding" type="hidden" value={binding/curie("binding")*}/>
+		<a class="tx-icon tx-icon-delete" href="#" onclick="this.parentNode.submit(); return false">Delete</a></form></td>
+	</tr>}
+	</table>
+	<h3>Add new Prefix Binding:</h3>
+	<form action="save" method="post">
+		<label for="prefix">Prefix:</label><input name="prefix" type="text" value=""/><br/>
+		<label for="binding">Expanded form:</label><input name="binding" type="text" size="80" value=""/><br/>
+		<input type="submit" name="add"/>
+	</form>
+
+</div>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-naked.ssp
----------------------------------------------------------------------
diff --git a/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-naked.ssp b/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-naked.ssp
new file mode 100644
index 0000000..74d2b47
--- /dev/null
+++ b/platform/curieprefixmanager/core/src/main/resources/org/apache/clerezza/platform/curieprefixmanager/impl/curie-prefix-naked.ssp
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+def curie(s: Any) = new UriRef("http://clerezza.apache.org/platform/curieprefix#" + s)
+
+<div id="tx-content">
+	<h3>A CURIE Prefix Binding:</h3>
+	<form method="post" action="save">
+		<input type="text" name="prefix" value={res/curie("prefix")*}/><br/>
+		<input type="text" name="binding" value={res/curie("binding")*}/><br/>
+		<input type="submit" name="Save"/>
+	</form>
+</div>


Mime
View raw message