You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by og...@apache.org on 2012/02/13 18:01:07 UTC
svn commit: r1243611 - in /incubator/stanbol/trunk/entityhub:
generic/core/src/main/java/org/apache/stanbol/entityhub/core/model/
generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/
generic/test/src/main/java/org/apache/stanbol/entityhu...
Author: ogrisel
Date: Mon Feb 13 17:01:07 2012
New Revision: 1243611
URL: http://svn.apache.org/viewvc?rev=1243611&view=rev
Log:
typo: TypeSaveIterator => TypeSafeIterator
Added:
incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSafeIterator.java
- copied, changed from r1243572, incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java
Removed:
incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java
Modified:
incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentation.java
incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java
incubator/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfRepresentation.java
Modified: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentation.java?rev=1243611&r1=1243610&r2=1243611&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentation.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentation.java Mon Feb 13 17:01:07 2012
@@ -26,11 +26,11 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
import org.apache.stanbol.entityhub.core.utils.TextIterator;
-import org.apache.stanbol.entityhub.core.utils.TypeSaveIterator;
+import org.apache.stanbol.entityhub.core.utils.TypeSafeIterator;
import org.apache.stanbol.entityhub.servicesapi.model.Reference;
import org.apache.stanbol.entityhub.servicesapi.model.Representation;
import org.apache.stanbol.entityhub.servicesapi.model.Text;
@@ -159,7 +159,7 @@ public class InMemoryRepresentation impl
@Override
public <T> Iterator<T> get(String field, Class<T> type) throws UnsupportedTypeException {
Collection<Object> values = getValuesAsCollection(field);
- return new TypeSaveIterator<T>(values.iterator(), type);
+ return new TypeSafeIterator<T>(values.iterator(), type);
}
@Override
@@ -389,7 +389,7 @@ public class InMemoryRepresentation impl
@Override
public Iterator<Reference> getReferences(String field) {
Collection<Object> values = getValuesAsCollection(field);
- return new TypeSaveIterator<Reference>(values.iterator(), Reference.class);
+ return new TypeSafeIterator<Reference>(values.iterator(), Reference.class);
}
protected static String getNaturalLanguageValue(Object check,Set<String> langSet,boolean isNullLanguage){
if(check instanceof Text){
Copied: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSafeIterator.java (from r1243572, incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSafeIterator.java?p2=incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSafeIterator.java&p1=incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java&r1=1243572&r2=1243611&rev=1243611&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSafeIterator.java Mon Feb 13 17:01:07 2012
@@ -24,7 +24,7 @@ import java.util.Iterator;
*
* @param <T> the type of elements returned by this iterator
*/
-public class TypeSaveIterator<T> extends AdaptingIterator<Object,T> implements Iterator<T> {
+public class TypeSafeIterator<T> extends AdaptingIterator<Object,T> implements Iterator<T> {
/**
* Constructs an iterator that selects only elements of the parsed iterator
@@ -33,7 +33,7 @@ public class TypeSaveIterator<T> extends
* @param type the type all elements of this Iterator need to be assignable to.
*/
@SuppressWarnings("unchecked")
- public TypeSaveIterator(Iterator<?> it,Class<T> type){
+ public TypeSafeIterator(Iterator<?> it,Class<T> type){
super((Iterator<Object>)it,new AssignableFormAdapter<T>(),type);
}
Modified: incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java?rev=1243611&r1=1243610&r2=1243611&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java Mon Feb 13 17:01:07 2012
@@ -574,9 +574,12 @@ public abstract class RepresentationTest
URL url = new URL("http://www.test.org/urlTest");
ValueFactory vf = getValueFactory();
Representation rep = createRepresentation(null);
+ // test empty reference
+ Iterator<Reference> refs = rep.getReferences(field);
+ assertFalse(refs.hasNext());
// test conversion
rep.add(field, url);
- Iterator<Reference> refs = rep.getReferences(field);
+ refs = rep.getReferences(field);
assertTrue(refs.hasNext());
assertEquals(refs.next().getReference(), url.toString());
assertFalse(refs.hasNext());
Modified: incubator/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfRepresentation.java?rev=1243611&r1=1243610&r2=1243611&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfRepresentation.java (original)
+++ incubator/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfRepresentation.java Mon Feb 13 17:01:07 2012
@@ -30,7 +30,7 @@ import org.apache.clerezza.rdf.core.UriR
import org.apache.clerezza.rdf.utils.GraphNode;
import org.apache.stanbol.entityhub.core.utils.AdaptingIterator;
import org.apache.stanbol.entityhub.core.utils.FilteringIterator;
-import org.apache.stanbol.entityhub.core.utils.TypeSaveIterator;
+import org.apache.stanbol.entityhub.core.utils.TypeSafeIterator;
import org.apache.stanbol.entityhub.model.clerezza.impl.Literal2TextAdapter;
import org.apache.stanbol.entityhub.model.clerezza.impl.LiteralAdapter;
import org.apache.stanbol.entityhub.model.clerezza.impl.NaturalTextFilter;
@@ -42,7 +42,6 @@ import org.apache.stanbol.entityhub.serv
import org.apache.stanbol.entityhub.servicesapi.model.Representation;
import org.apache.stanbol.entityhub.servicesapi.model.Text;
import org.apache.stanbol.entityhub.servicesapi.model.UnsupportedTypeException;
-import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
import org.apache.stanbol.entityhub.servicesapi.util.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -168,7 +167,7 @@ public class RdfRepresentation implement
}
UriRef fieldUriRef = new UriRef(field);
if(Resource.class.isAssignableFrom(type)){ //native support for Clerezza types
- return new TypeSaveIterator<T>(graphNode.getObjects(fieldUriRef), type);
+ return new TypeSafeIterator<T>(graphNode.getObjects(fieldUriRef), type);
// NOTE: (Rupert Westenthaler 12.01.2011)
// Converting everything to String is not an intended functionality. When
// someone parsed String.class he rather assumes that he gets only string