Author: ito
Date: Fri May 13 15:08:44 2011
New Revision: 1102783

URL: http://svn.apache.org/viewvc?rev=1102783&view=rev
Log:
CLEREZZA-501: Comments added and todos removed - almost ready to commit to trunk

Modified:
    
incubator/clerezza/issues/CLEREZZA-501/platform.cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/Condition.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/GraphIndexer.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/IndexDefinitionManager.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/LuceneTools.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PathVirtualProperty.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/ResourceFinder.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/GraphIndexerTest.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/IndexDefinitionManagerTest.java

Modified: 
incubator/clerezza/issues/CLEREZZA-501/platform.cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/platform.cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/platform.cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/platform.cris/src/main/java/org/apache/clerezza/platform/cris/IndexService.java
 Fri May 13 15:08:44 2011
@@ -46,7 +46,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- *
+ * Service to index and find resources from the content graph.
+ * 
  * @author tio
  */
 @Component

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/Condition.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/Condition.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/Condition.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/Condition.java
 Fri May 13 15:08:44 2011
@@ -17,6 +17,11 @@
  * under the License.
  */
 
+/**
+ * A Condition for a finding resources with CRIS based on Lucene
+ *
+ * @author tio
+ */
 package org.apache.clerezza.rdf.cris;
 
 import org.apache.lucene.search.Query;

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/GraphIndexer.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/GraphIndexer.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/GraphIndexer.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/GraphIndexer.java
 Fri May 13 15:08:44 2011
@@ -78,6 +78,8 @@ public class GraphIndexer extends Resour
        private Map<UriRef, Set<VirtualProperty>> type2IndexedProperties = null;
        private Map<VirtualProperty, Set<UriRef>> property2TypeMap = new 
HashMap<VirtualProperty, Set<UriRef>>();
        private Map<UriRef, Set<VirtualProperty>> property2IncludingVProperty = 
new HashMap<UriRef, Set<VirtualProperty>>();
+       
+       Map<String, String> labels = new HashMap<String, String>();
        ReindexThread reindexer;
        private final GraphListener listener1;
        private final GraphListener listener2;
@@ -260,9 +262,7 @@ public class GraphIndexer extends Resour
                luceneTools = new LuceneTools(this.currentIndex, analyzer);
                processDefinitions();
 
-               this.reindexer = new ReindexThread(100000000L, 500000L); 
//TODO: find good values, make them configurable
-               //TODO
-               //reindexer.setDaemon(true);
+               this.reindexer = new ReindexThread(100000000L, 500000L); //find 
good values, make them configurable
 
                listener1 = new GraphListener() {
 
@@ -287,16 +287,16 @@ public class GraphIndexer extends Resour
                        @Override
                        public void graphChanged(List<GraphEvent> events) {
                                for (GraphEvent e : events) {
-//                                     logger.info("Triple: " + e.getTriple());
+                                       logger.debug("Triple: " + 
e.getTriple());
                                        Triple triple = e.getTriple();
 
                                        UriRef predicate = 
triple.getPredicate();
                                        Set<VirtualProperty> vProperties = 
property2IncludingVProperty.get(predicate);
 
                                        List<Resource> indexedResources = new 
ArrayList<Resource>();
-//                                     logger.info("Predicate: " + predicate);
+                                       logger.debug("Predicate: " + predicate);
                                        for (VirtualProperty vProperty : 
vProperties) {
-//                                             logger.info("Subject: " + " " + 
triple.getSubject());
+                                               logger.debug("Subject: " + " " 
+ triple.getSubject());
                                                
followInversePaths(triple.getSubject(), 
vProperty.pathToIndexedResource(predicate), indexedResources);
 
                                        }
@@ -529,8 +529,6 @@ public class GraphIndexer extends Resour
                        booleanQuery.add(c.query(), BooleanClause.Occur.MUST);
                }
                
-               
-               //val searcher = new IndexSearcher(index, true);
                IndexSearcher searcher = luceneTools.getIndexSearcher();
                TopScoreDocCollector testCollector = 
TopScoreDocCollector.create(1, true);
                try {
@@ -617,8 +615,7 @@ public class GraphIndexer extends Resour
 
        private void indexNamedResource(UriRef uriRef, IndexWriter writer)
                        throws IOException {
-               //val searcher = new IndexSearcher(index, true);
-//             IndexSearcher searcher = luceneTools.getIndexSearcher();
+
                Term term = new Term(URI_FIELD_NAME, uriRef.getUnicodeString());
                writer.deleteDocuments(term);
                //the reindexing might be caused by the removal of a type 
statement

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/IndexDefinitionManager.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/IndexDefinitionManager.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/IndexDefinitionManager.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/IndexDefinitionManager.java
 Fri May 13 15:08:44 2011
@@ -31,6 +31,11 @@ import org.apache.clerezza.rdf.ontologie
 import org.apache.clerezza.rdf.utils.GraphNode;
 import org.apache.clerezza.rdf.utils.RdfList;
 
+/**
+ * Sets the definitions which literals of a resource should be indexed in a 
graph.
+ * 
+ * @author rbn, tio, daniel
+ */
 public class IndexDefinitionManager {
 
        private MGraph definitionGraph;

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/LuceneTools.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/LuceneTools.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/LuceneTools.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/LuceneTools.java
 Fri May 13 15:08:44 2011
@@ -34,6 +34,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
+ * Provides lucene tools such as <code>IndexWriter</code> and 
<code>IndexSearcher</code>.
+ * 
  *
  * @author tio
  */
@@ -143,7 +145,6 @@ public class LuceneTools {
                        if (!luceneIndexDir.exists() && 
!IndexReader.indexExists(directory)) {
                                createDir = true;
                        }*/
-                       //TODO IndexReader.indexExists(dir); if not possible to 
write copy index and create new one
                        indexWriter = new IndexWriterWrapper(indexDirectory, 
getAnalyzer(),
                                        createDir, 
IndexWriter.MaxFieldLength.UNLIMITED);
                        indexWriter.setMergeFactor(100);
@@ -183,7 +184,7 @@ public class LuceneTools {
                System.out.println("Closing IndexWriter");
                try {
                        if(indexWriter != null) {
-                               //TODO do this in an extra thread, execution 
time configurable
+                               //do this in an extra thread, execution time 
configurable
                                //call optimize only when necessary
                                try {
                                        
if(!indexWriter.getReader().isOptimized()) {
@@ -216,7 +217,6 @@ public class LuceneTools {
                                return indexSearcher;
                        }
 //                     if(luceneIndexDir != null) {
-//                             System.out.println("OPENING NEW DIR!!");
 //                             indexDirectory = 
FSDirectory.open(luceneIndexDir);
 //                     }
                        if (IndexReader.indexExists(indexDirectory)) {

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PathVirtualProperty.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PathVirtualProperty.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PathVirtualProperty.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PathVirtualProperty.java
 Fri May 13 15:08:44 2011
@@ -66,7 +66,7 @@ public class PathVirtualProperty extends
                        list.addAll(new 
PropertyHolder(properties.get(0)).value(node));
                } else {
 
-                       //TODO lock necessary?
+                       //lock necessary?
                        Lock lock = node.readLock();
                        lock.lock();
                        try {

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/ResourceFinder.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/ResourceFinder.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/ResourceFinder.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/ResourceFinder.java
 Fri May 13 15:08:44 2011
@@ -27,7 +27,7 @@ import org.apache.lucene.queryParser.Par
 import org.apache.lucene.queryParser.QueryParser;
 /**
  *
- * @author tio
+ * @author rbn, tio
  **/
  public abstract class ResourceFinder {
 

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/GraphIndexerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/GraphIndexerTest.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/GraphIndexerTest.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/GraphIndexerTest.java
 Fri May 13 15:08:44 2011
@@ -1,19 +1,22 @@
 /*
- *  Copyright 2011 tio.
- * 
- *  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.
- *  under the License.
+ * 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.cris;
 
 import java.util.ArrayList;
@@ -69,7 +72,7 @@ public class GraphIndexerTest {
                list.add(FOAF.homepage);
                createDefinition(FOAF.Person, list);
                service = new GraphIndexer(definitions, dataGraph);
-
+               
                GraphNode nodeB = new GraphNode(new UriRef(Util.createURN5()), 
dataGraph);
                nodeB.addProperty(RDF.type, FOAF.Person);
                nodeB.addProperty(FOAF.homepage, new 
UriRef("http://myhomepage/foo?query=bla&bla=test";));
@@ -99,7 +102,7 @@ public class GraphIndexerTest {
        }
 
        @Test
-       public void findUriOfResources() throws ParseException, 
InterruptedException {
+       public void findResourcesViaUriRef() throws ParseException, 
InterruptedException {
                List<NonLiteral> results;
                //TODO
                Thread.sleep(1000);
@@ -110,12 +113,10 @@ public class GraphIndexerTest {
                results = service.findResources(FOAF.homepage, 
"http://myhomepage/foo?query=bla&bla=test";);
                Assert.assertEquals(1, results.size());
                
-//             results = service.findResources(FOAF.homepage, 
"http://myhomepage/foo";);
-//             Assert.assertEquals(0, results.size());
                
        }
 
-       /*@Test
+       @Test
        public void findResources() throws ParseException, InterruptedException 
{
                List<NonLiteral> results;
                //TODO
@@ -354,5 +355,5 @@ public class GraphIndexerTest {
                } catch (ParseException ex) {
                } catch (InterruptedException ex) {
                }
-       }*/
+       }
 }

Modified: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/IndexDefinitionManagerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/IndexDefinitionManagerTest.java?rev=1102783&r1=1102782&r2=1102783&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/IndexDefinitionManagerTest.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/test/java/org/apache/clerezza/rdf/cris/IndexDefinitionManagerTest.java
 Fri May 13 15:08:44 2011
@@ -1,18 +1,20 @@
 /*
- *  Copyright 2011 tio.
- * 
- *  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.
- *  under the License.
+ * 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.cris;


Reply via email to