Author: ito
Date: Tue May 31 11:58:54 2011
New Revision: 1129637
URL: http://svn.apache.org/viewvc?rev=1129637&view=rev
Log:
CLEREZZA-501: readlock set and todo removed
Modified:
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/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/PropertyHolder.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/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=1129637&r1=1129636&r2=1129637&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
Tue May 31 11:58:54 2011
@@ -369,11 +369,18 @@ public class GraphIndexer extends Resour
if (pathToIndexedResource.isEmpty()) {
list.add(resource);
} else {
- Iterator<NonLiteral> predecessors = new
GraphNode(resource, this.baseGraph).getSubjects(pathToIndexedResource.get(0));
+ GraphNode node = new GraphNode(resource,
this.baseGraph);
+ Lock lock = node.readLock();
+ lock.lock();
+ try {
+ Iterator<NonLiteral> predecessors =
node.getSubjects(pathToIndexedResource.get(0));
- List<UriRef> tail = pathToIndexedResource.subList(1,
pathToIndexedResource.size());
- while (predecessors.hasNext()) {
- followInversePaths(predecessors.next(), tail,
list);
+ List<UriRef> tail =
pathToIndexedResource.subList(1, pathToIndexedResource.size());
+ while (predecessors.hasNext()) {
+ followInversePaths(predecessors.next(),
tail, list);
+ }
+ } finally {
+ lock.unlock();
}
//throw new RuntimeException("modification of indirect
properties not yet supported")
}
@@ -636,7 +643,6 @@ public class GraphIndexer extends Resour
GraphNode node = new GraphNode(uriRef, this.baseGraph);
List<UriRef> types = new ArrayList<UriRef>();
- //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/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=1129637&r1=1129636&r2=1129637&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
Tue May 31 11:58:54 2011
@@ -147,7 +147,7 @@ public class LuceneTools {
}*/
indexWriter = new IndexWriterWrapper(indexDirectory,
getAnalyzer(),
createDir,
IndexWriter.MaxFieldLength.UNLIMITED);
- indexWriter.setMergeFactor(100);
+ indexWriter.setMergeFactor(1000);
return indexWriter;
} catch (Exception ex) {
logger.error(ex.getMessage());
@@ -250,8 +250,6 @@ public class LuceneTools {
indexSearcher = null;
indexDirectory = null;
}
- //in finally block: if
(IndexReader.isLocked(LuceneIndexConstants.INDEX_DIR)) {
- //IndexReader.unlock(LuceneIndexConstants.INDEX_DIR);
}
/**
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=1129637&r1=1129636&r2=1129637&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
Tue May 31 11:58:54 2011
@@ -65,8 +65,6 @@ public class PathVirtualProperty extends
if (properties.size() == 1) {
list.addAll(new
PropertyHolder(properties.get(0)).value(node));
} else {
-
- //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/PropertyHolder.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PropertyHolder.java?rev=1129637&r1=1129636&r2=1129637&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PropertyHolder.java
(original)
+++
incubator/clerezza/issues/CLEREZZA-501/rdf.cris/core/src/main/java/org/apache/clerezza/rdf/cris/PropertyHolder.java
Tue May 31 11:58:54 2011
@@ -47,7 +47,6 @@ public class PropertyHolder extends Virt
@Override
protected List<String> value(GraphNode node) {
List<String> list = new ArrayList<String>();
- //Locks necessary?
Lock lock = node.readLock();
lock.lock();
try {
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=1129637&r1=1129636&r2=1129637&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
Tue May 31 11:58:54 2011
@@ -108,7 +108,6 @@ public class GraphIndexerTest {
@Test
public void findResourcesViaUriRef() throws ParseException,
InterruptedException {
List<NonLiteral> results;
- //TODO
Thread.sleep(1000);
results = service.findResources(FOAF.homepage,
"*p://myhomepage/foo?query=bla&bla=te*");
@@ -123,7 +122,6 @@ public class GraphIndexerTest {
@Test
public void findResources() throws ParseException, InterruptedException
{
List<NonLiteral> results;
- //TODO
Thread.sleep(1000);
results = service.findResources(FOAF.firstName, "*Joe*");
@@ -136,7 +134,6 @@ public class GraphIndexerTest {
List<Condition> conditions = new ArrayList<Condition>();
conditions.add(new WildcardCondition(FOAF.firstName,
"*Joe*"));
conditions.add(new WildcardCondition(FOAF.lastName,
"*Wotsit*"));
- //TODO
Thread.sleep(1000);
List<NonLiteral> results =
service.findResources(conditions);
Assert.assertEquals(1, results.size());
@@ -148,7 +145,6 @@ public class GraphIndexerTest {
List<Condition> conditions = new ArrayList<Condition>();
conditions.add(new WildcardCondition(FOAF.firstName,
"*Jo*"));
conditions.add(new WildcardCondition(FOAF.firstName,
"*Wil*"));
- //TODO
Thread.sleep(1000);
List<NonLiteral> results =
service.findResources(conditions);
@@ -228,7 +224,7 @@ public class GraphIndexerTest {
try {
service.reCreateIndex();
//the old data still available
- Thread.sleep(1000);//TODO
+ Thread.sleep(1000);
List<NonLiteral> results =
service.findResources(FOAF.firstName, "*Joe*");
Assert.assertEquals(2, results.size());
} catch (ParseException ex) {
@@ -238,8 +234,6 @@ public class GraphIndexerTest {
@Test
public void reIndexTest() throws InterruptedException {
- //import VirtualProperties._
- //val joinProperty = JoinVirtualProperty(List(FOAF.firstName,
FOAF.lastName))
IndexDefinitionManager indexDefinitionManager = new
IndexDefinitionManager(definitions);
List<UriRef> predicates = new ArrayList<UriRef>();
@@ -248,7 +242,6 @@ public class GraphIndexerTest {
predicates.add(RDFS.comment);
indexDefinitionManager.addDefinition(FOAF.Person, predicates);
service.reCreateIndex();
- //TODO
Thread.sleep(1000);
{
try {
@@ -295,7 +288,6 @@ public class GraphIndexerTest {
}
//late addition
- //late addition
{
//check before
List<NonLiteral> results =
service.findResources(joinProperty, "*Joe*");
@@ -317,7 +309,6 @@ public class GraphIndexerTest {
@Test
public void pathVirtualProperty() {
try {
- // import VirtualProperties._
List<UriRef> pathProperties = new
java.util.ArrayList<UriRef>();
pathProperties.add(ownsPetProperty);
pathProperties.add(FOAF.name);
@@ -336,7 +327,6 @@ public class GraphIndexerTest {
Assert.assertEquals(1, results.size());
}
//and a late addtition, lets give Frank a pet
- //and a late addtition, lets give Frank a pet
GraphNode frank = new
GraphNode(service.findResources(FOAF.firstName, "Frank").get(0), dataGraph);
GraphNode pet = new GraphNode(new BNode(), dataGraph);
frank.addProperty(ownsPetProperty, pet.getNode());
@@ -350,7 +340,6 @@ public class GraphIndexerTest {
}
//lets give that pet an additional name
pet.addPropertyValue(FOAF.name, "Fifi");
- //TODO
Thread.sleep(1000);
{
List<NonLiteral> results =
service.findResources(pathProperty, "Fifi");
@@ -380,7 +369,7 @@ public class GraphIndexerTest {
List<NonLiteral> results =
service.findResources(firstName, "*", false, facetCollector);
Assert.assertTrue(results.size() > 0);
- //there are 7 distinct firsst names
+ //there are 7 distinct first names
Assert.assertEquals(7,
facetCollector.getFacets(firstName).size());
//the firstname "Frank" appears once
Assert.assertEquals(new Integer(1),
facetCollector.getFacetValue(firstName, "Frank"));