Author: ito
Date: Fri May 13 05:32:55 2011
New Revision: 1102564

URL: http://svn.apache.org/viewvc?rev=1102564&view=rev
Log:
CLEREZZA-501: Lucene sort implemented for CRIS

Added:
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortFieldArrayWrapper.java
    
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortSpecification.java
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/GraphIndexer.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

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=1102564&r1=1102563&r2=1102564&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 05:32:55 2011
@@ -34,6 +34,7 @@ import org.apache.clerezza.rdf.cris.Face
 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.Reference;
@@ -95,7 +96,18 @@ public class IndexService extends Resour
        }
        
        @Override
-       public List<NonLiteral> findResources(List<Condition> conditions, 
FacetCollector... facetCollectors) {
+       public List<NonLiteral> findResources(List<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<Condition> conditions, 
+                       FacetCollector... facetCollectors) {
                try {
                        return graphIndexer.findResources(conditions, 
facetCollectors);
                } catch (ParseException ex) {
@@ -123,7 +135,8 @@ public class IndexService extends Resour
        
        @Override
        public List<NonLiteral> findResources(UriRef uriRef, String pattern, 
-       boolean escapePattern) {
+                       boolean escapePattern) {
+               
                try {
                        return graphIndexer.findResources(uriRef, pattern, 
escapePattern);
                } catch (ParseException ex) {
@@ -133,7 +146,8 @@ public class IndexService extends Resour
        
        @Override
        public List<NonLiteral> findResources(UriRef uriRef, String pattern, 
-       boolean escapePattern, FacetCollector... facetCollectors) {
+                       boolean escapePattern, FacetCollector... 
facetCollectors) {
+               
                try {
                        return graphIndexer.findResources(uriRef, pattern, 
escapePattern, facetCollectors);
                } catch (ParseException ex) {
@@ -142,6 +156,19 @@ public class IndexService extends Resour
        }
        
        @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();
        }

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=1102564&r1=1102563&r2=1102564&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 05:32:55 2011
@@ -54,6 +54,8 @@ import org.apache.lucene.search.BooleanC
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.TopFieldDocs;
 import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.store.RAMDirectory;
 import org.slf4j.Logger;
@@ -79,7 +81,11 @@ public class GraphIndexer extends Resour
        ReindexThread reindexer;
        private final GraphListener listener1;
        private final GraphListener listener2;
-
+       
+       static final String SORT_PREFIX = "PRE";
+       
+       private Map<SortFieldArrayWrapper, Sort> sortCache = new 
HashMap<SortFieldArrayWrapper, Sort>();
+       
        /**
         * When resources are added to or deleted from the base graph, 
         * this thread updates the Lucene index asynchronously. 
@@ -196,7 +202,7 @@ public class GraphIndexer extends Resour
                                        } finally {
                                                lock.unlock();
                                        }
-                                       logger.info("{}: cache full or writes 
have seized. Indexing...", getName());
+                                       logger.info("{}: cache full or writes 
have ceased. Indexing...", getName());
                                        for (Resource resource : set) {
                                                indexResource(resource, 
luceneTools.getIndexWriter());
                                        }
@@ -510,9 +516,10 @@ public class GraphIndexer extends Resour
        }
 
        @Override
-       public List<NonLiteral> findResources(List<Condition> conditions, 
FacetCollector... facetCollectors)
+       public List<NonLiteral> findResources(List<Condition> conditions, 
+                       SortSpecification sortSpecification, FacetCollector... 
facetCollectors)
                        throws ParseException {
-
+               
                if(facetCollectors == null) {
                        facetCollectors = new FacetCollector[0];
                }
@@ -521,6 +528,8 @@ public class GraphIndexer extends Resour
                for (Condition c : conditions) {
                        booleanQuery.add(c.query(), BooleanClause.Occur.MUST);
                }
+               
+               
                //val searcher = new IndexSearcher(index, true);
                IndexSearcher searcher = luceneTools.getIndexSearcher();
                TopScoreDocCollector testCollector = 
TopScoreDocCollector.create(1, true);
@@ -536,12 +545,28 @@ public class GraphIndexer extends Resour
                if (totalHits > maxHitsPerPage) {
                        hitsPerPage = maxHitsPerPage;
                }
-               TopScoreDocCollector collector = 
TopScoreDocCollector.create(hitsPerPage, true);
+               
+               ScoreDoc[] hits = null;
                try {
-                       searcher.search(booleanQuery, collector);
+                       if(sortSpecification != null) {
+                               SortFieldArrayWrapper fieldKey = 
+                                               new 
SortFieldArrayWrapper(sortSpecification.getSortFields());
+                               Sort sort = sortCache.get(fieldKey);
+                               if(sort == null) {
+                                       sort = new 
Sort(sortSpecification.getSortFields());
+                                       sortCache.put(fieldKey, sort);
+                               }
+                               searcher.setDefaultFieldSortScoring(true, true);
+                               TopFieldDocs topFieldDocs = 
searcher.search(booleanQuery, null, hitsPerPage, sort);
+                               hits = topFieldDocs.scoreDocs;
+                       } else {
+                               TopScoreDocCollector collector = 
TopScoreDocCollector.create(hitsPerPage, true);
+                               searcher.search(booleanQuery, collector);
+                               hits = collector.topDocs().scoreDocs;
+                       }
                } catch (IOException ex) {
+                       throw new RuntimeException(ex);
                }
-               ScoreDoc[] hits = collector.topDocs().scoreDocs;
 
                List<NonLiteral> result = new ArrayList<NonLiteral>();
 
@@ -640,6 +665,10 @@ public class GraphIndexer extends Resour
                                                propertyValue,
                                                Field.Store.YES,
                                                Field.Index.ANALYZED));
+                               doc.add(new Field(SORT_PREFIX + 
vProperty.stringKey,
+                                               propertyValue,
+                                               Field.Store.YES,
+                                               Field.Index.NOT_ANALYZED));
                        }
                }
                return doc;

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=1102564&r1=1102563&r2=1102564&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 05:32:55 2011
@@ -70,8 +70,29 @@ import org.apache.lucene.queryParser.Que
         * 
         * @throws ParseException when the resulting query is illegal.
         */
+       public List<NonLiteral> findResources(List<Condition> conditions, 
+                       FacetCollector... facetCollectors) throws 
ParseException {
+               
+               return findResources(conditions, null, facetCollectors);
+       }
+       
+       /**
+        * Find resources using conditions and collect facets and a sort order. 
+        * 
+        * @param conditions
+        *              a list of conditions to construct a query from.
+        * @param facetCollectors
+        *              facet collectors to apply to the query result.
+        * @param sortSpecification 
+        *              specifies the sort order.
+        * @return      
+        *              a list of resources that match the query.
+        * 
+        * @throws ParseException when the resulting query is illegal.
+        */
        public abstract List<NonLiteral> findResources(List<Condition> 
conditions, 
-                       FacetCollector... facetCollectors) throws 
ParseException;
+                       SortSpecification sortSpecification, FacetCollector... 
facetCollectors) 
+                       throws ParseException;
 
        /**
         * Find resource with given property whose value matches a pattern.
@@ -126,6 +147,31 @@ import org.apache.lucene.queryParser.Que
        }
        
        /**
+        * Find resource with given property whose value matches a pattern 
+        * and sort order and collect facets.
+        * 
+        * @param property      The property to which to apply the pattern.
+        * @param pattern       The pattern from which to construct a query.
+        * @param escapePattern whether to escape reserved characters in the 
pattern
+        * @param sortSpecification     specifies the sort order.
+        * @param facetCollectors facet collectors to apply to the query result.
+        * @return      a list of resources that match the query.
+        * 
+        * @throws ParseException when the resulting query is illegal.
+        */
+       public List<NonLiteral> findResources(UriRef property, String pattern, 
+                       boolean escapePattern, SortSpecification 
sortSpecification, 
+                       FacetCollector... facetCollectors) throws 
ParseException {
+               
+               List<Condition> list = new ArrayList<Condition>();
+               if(escapePattern) {
+                       pattern = QueryParser.escape(pattern);
+               }
+               list.add(new WildcardCondition(new PropertyHolder(property), 
pattern));
+               return findResources(list, sortSpecification, facetCollectors);
+       }
+       
+       /**
         * Find resource with given VirtualProperty whose value matches a 
pattern.
         * 
         * @param property      The property to which to apply the pattern.
@@ -177,4 +223,29 @@ import org.apache.lucene.queryParser.Que
                list.add(new WildcardCondition(property, pattern));
                return findResources(list, facetCollectors);
        }
+       
+       /**
+        * Find resource with given VirtualProperty whose value matches a 
pattern 
+        * and sort specification and collect facets.
+        * 
+        * @param property      The property to which to apply the pattern.
+        * @param pattern       The pattern from which to construct a query.
+        * @param escapePattern whether to escape reserved characters in the 
pattern
+        * @param sortSpecification     specifies the sort order.
+        * @param facetCollectors       facet collectors to apply to the query 
result.
+        * @return      a list of resources that match the query.
+        * 
+        * @throws ParseException when the resulting query is illegal.
+        */
+       public List<NonLiteral> findResources(VirtualProperty property, String 
pattern, 
+                       boolean escapePattern, SortSpecification 
sortSpecification, 
+                       FacetCollector... facetCollectors) throws 
ParseException {
+               
+               List<Condition> list = new ArrayList<Condition>();
+               if(escapePattern) {
+                       pattern = QueryParser.escape(pattern);
+               }
+               list.add(new WildcardCondition(property, pattern));
+               return findResources(list, sortSpecification, facetCollectors);
+       }
 }

Added: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortFieldArrayWrapper.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortFieldArrayWrapper.java?rev=1102564&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortFieldArrayWrapper.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortFieldArrayWrapper.java
 Fri May 13 05:32:55 2011
@@ -0,0 +1,58 @@
+/*
+ * 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 org.apache.lucene.search.SortField;
+import scala.actors.threadpool.Arrays;
+
+/**
+ * Wrapper that allows to store SortField arrays as keys in a HasMap.
+ *
+ * @author daniel
+ */
+final class SortFieldArrayWrapper {
+       private final SortField[] wrappedArray;
+
+       /**
+        * Wrap the provided array.
+        * 
+        * @param arrayToWrap the array to wrap.
+        */
+       public SortFieldArrayWrapper(SortField[] arrayToWrap) {
+               this.wrappedArray = arrayToWrap;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if(obj == null) {
+                       return false;
+               }
+               if(!(obj instanceof SortFieldArrayWrapper)) {
+                       return false;
+               }
+               
+               return Arrays.equals(wrappedArray, ((SortFieldArrayWrapper) 
obj).wrappedArray);
+       }
+
+       @Override
+       public int hashCode() {
+               return Arrays.hashCode(wrappedArray);
+       }
+}

Added: 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortSpecification.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortSpecification.java?rev=1102564&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortSpecification.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/SortSpecification.java
 Fri May 13 05:32:55 2011
@@ -0,0 +1,256 @@
+/*
+ * 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;
+import org.apache.lucene.search.SortField;
+
+/**
+ * Specifies CRIS result sorting. 
+ *
+ * @author daniel
+ */
+public class SortSpecification {
+       
+       /**
+        * Interpret values as bytes.
+        */
+       public static final int BYTE = SortField.BYTE;
+       
+       /**
+        * Interpret values as doubles.
+        */
+       public static final int DOUBLE = SortField.DOUBLE;
+       
+       /**
+        * Interpret values as floats.
+        */
+       public static final int FLOAT = SortField.FLOAT;
+       
+       /**
+        * Interpret values as integers.
+        */
+       public static final int INT = SortField.INT;
+       
+       /**
+        * Interpret values as longs.
+        */
+       public static final int LONG = SortField.LONG;
+       
+       /**
+        * Interpret values as shorts.
+        */
+       public static final int SHORT = SortField.SHORT;
+       
+       /**
+        * Interpret values as strings (using ordinals, faster).
+        */
+       public static final int STRING = SortField.STRING;
+       
+       /**
+        * Interpret values as strings (using compareTo, slower).
+        */
+       public static final int STRING_COMPARETO = SortField.STRING_VAL;
+       
+       /**
+        * Sort by indexing order (first indexed resource is first, etc.).
+        */
+       public static final SortEntry INDEX_ORDER = new SortEntry() {
+               @Override
+               SortField getSortField() {
+                       return SortField.FIELD_DOC;
+               }
+       };
+       
+       /**
+        * Sort by Lucene document score.
+        */
+       public static final SortEntry RELEVANCY = new SortEntry() {
+               @Override
+               SortField getSortField() {
+                       return SortField.FIELD_SCORE;
+               }
+       };
+       
+       /**
+        * A SortSPecification Entry.
+        */
+       public static class SortEntry {
+               private SortField sortField;
+               
+               private SortEntry() {};
+               
+               /**
+                * Constructor.
+                * 
+                * @param property      The property.
+                * @param type          The property-values type.
+                * @param reverse       True sorts in reverse. False uses 
standard order.
+                */
+               SortEntry(VirtualProperty property, int type, boolean reverse) {
+                       sortField = new SortField(GraphIndexer.SORT_PREFIX + 
property.getStringKey(), type, reverse);
+               }
+               
+               /**
+                * Return a the Lucene SortField corresponding to this entry.
+                * 
+                * @return      the SortField 
+                */
+               SortField getSortField() {
+                       return sortField;
+               }
+
+               @Override
+               public boolean equals(Object obj) {
+                       if(obj == null) {
+                               return false;
+                       }
+                       if(!(obj instanceof SortEntry)) {
+                               return false;
+                       }
+                       return getSortField().equals(((SortEntry) 
obj).getSortField());
+               }
+
+               @Override
+               public int hashCode() {
+                       return getSortField().hashCode();
+               }
+       }
+       
+       private ArrayList<SortEntry> sortPriority;
+
+       /**
+        * Creates a new SortSpecification.
+        */
+       public SortSpecification() {
+               sortPriority = new ArrayList<SortEntry>();
+       }
+       
+       /**
+        * Add a property to sort on.
+        * 
+        * Note: 
+        * The order of addition determines the search priority.
+        * The property to search on has to be indexed.
+        * The indexed value should not be tokenized.
+        * The property's value is interpreted according to specified type.
+        * 
+        * @param property      the property
+        * @param type  the type
+        */
+       public void add(VirtualProperty property, int type) {
+               add(property, type, false);
+       }
+       
+       /**
+        * Add a property to sort on.
+        * 
+        * Note: 
+        * The order of addition determines the search priority.
+        * The property to search on has to be indexed.
+        * The indexed value should not be tokenized.
+        * The property's value is interpreted according to specified type.
+        * 
+        * @param property      the property
+        * @param type  the type
+        * @param reverse whether to sort in reverse.
+        */
+       public void add(VirtualProperty property, int type, boolean reverse) {
+               SortEntry sortEntry = new SortEntry(property, type, reverse);
+               add(sortEntry);
+       }
+       
+       /**
+        * Add a SortEntry.
+        * 
+        * Note: 
+        * The order of addition determines the search priority.
+        */
+       public void add(SortEntry entry) {
+               if(!sortPriority.contains(entry)) {
+                       sortPriority.add(entry);
+               }
+       }
+       
+       /**
+        * Remove the property with specified type.
+        * 
+        * @param property the property.
+        * @param type the type.
+        */
+       public void remove(VirtualProperty property, int type) {
+               remove(property, type, false);
+       }
+       
+       /**
+        * Remove the property with specified type.
+        * 
+        * @param property the property.
+        * @param type the type.
+        * @param reverse whether the sort is specified in reverse.
+        */
+       public void remove(VirtualProperty property, int type, boolean reverse) 
{
+               SortEntry sortEntry = new SortEntry(property, type, reverse);
+               remove(sortEntry);
+       }
+       
+       /**
+        * Remove a SortEntry.
+        */
+       public void remove(SortEntry entry) {
+               ArrayList<SortEntry> old = new 
ArrayList<SortEntry>(sortPriority);
+               sortPriority.clear();
+               for(SortEntry e : old) {
+                       if(!e.equals(entry)) {
+                               sortPriority.add(e);
+                       }
+               }
+       }
+       
+       /**
+        * Clear the sort specification.
+        */
+       public void clear() {
+               sortPriority.clear();
+       }
+       
+       /**
+        * Returns the number of added entries.
+        * 
+        * @return      the number of entries. 
+        */
+       public int size() {
+               return sortPriority.size();
+       }
+       
+       /**
+        * Get all entries as SortFields.
+        * 
+        * @return      the SortFields 
+        */
+       SortField[] getSortFields() {
+               SortField[] array = new SortField[size()];
+               for(int i = 0; i < size(); ++i) {
+                       array[i] = sortPriority.get(i).getSortField();
+               }
+               
+               return array;
+       }
+}

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=1102564&r1=1102563&r2=1102564&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 05:32:55 2011
@@ -20,8 +20,8 @@ import java.util.ArrayList;
 import java.util.List;
 import org.apache.clerezza.rdf.cris.ontologies.CRIS;
 import org.apache.clerezza.rdf.core.*;
-import org.apache.clerezza.rdf.core.impl.*;
 import org.apache.clerezza.rdf.utils.*;
+import org.apache.clerezza.rdf.core.impl.*;
 import org.apache.clerezza.rdf.ontologies.FOAF;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.ontologies.RDFS;
@@ -103,13 +103,15 @@ public class GraphIndexerTest {
                List<NonLiteral> results;
                //TODO
                Thread.sleep(1000);
-
-               results = service.findResources(FOAF.homepage, 
"*tp://myhomepage/foo?query=bla*");
+               
+               results = service.findResources(FOAF.homepage, 
"*p://myhomepage/foo?query=bla&bla=te*");
                Assert.assertEquals(1, results.size());
-
+               
                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());
                
        }
 


Reply via email to