You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by sf...@apache.org on 2010/12/12 17:10:52 UTC

svn commit: r1044841 [8/11] - in /incubator/stanbol/trunk/fise: SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/ SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/ui/ SemiAutomaticContentEnhancer/src/main/java/eu/iks...

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/RdfProxyInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/RdfProxyInvocationHandler.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/RdfProxyInvocationHandler.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/RdfProxyInvocationHandler.java Sun Dec 12 16:10:48 2010
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.iksproject.fise.servicesapi.helper.impl;
 
@@ -33,396 +33,396 @@ import eu.iksproject.fise.servicesapi.rd
 
 public class RdfProxyInvocationHandler implements InvocationHandler {
 
-	/**
-	 * The getID method of the RdfEntity Interface
-	 */
+    /**
+     * The getID method of the RdfEntity Interface
+     */
     protected static final Method getIDMethod;
 
-	/**
-	 * The toString Method of {@link Object}
-	 */
+    /**
+     * The toString Method of {@link Object}
+     */
     protected static final Method toString;
 
-	/**
-	 * The equals Method of {@link Object}
-	 */
+    /**
+     * The equals Method of {@link Object}
+     */
     protected static final Method equals;
 
-	/**
-	 * The hashCode Method of {@link Object}
-	 */
+    /**
+     * The hashCode Method of {@link Object}
+     */
     protected static final Method hashCode;
 
-	static {
-		try {
-			getIDMethod = RdfEntity.class.getMethod("getId", new Class<?>[]{});
-			toString = Object.class.getMethod("toString", new Class<?>[]{});
-			equals = Object.class.getMethod("equals", new Class<?>[]{Object.class});
-			hashCode = Object.class.getMethod("hashCode", new Class<?>[]{});
-		} catch (SecurityException e) {
-			throw new IllegalStateException("Unable to access getId Method in the "+RdfEntity.class+" Interface",e);
-		} catch (NoSuchMethodException e) {
-			throw new IllegalStateException("Unable to find getId Method in the "+RdfEntity.class+" Interface",e);
-		}
-	}
-
-	/**
-	 * The logger TODO: Question: How to get the dependencies for logging working with maven :(
-	 */
+    static {
+        try {
+            getIDMethod = RdfEntity.class.getMethod("getId", new Class<?>[]{});
+            toString = Object.class.getMethod("toString", new Class<?>[]{});
+            equals = Object.class.getMethod("equals", new Class<?>[]{Object.class});
+            hashCode = Object.class.getMethod("hashCode", new Class<?>[]{});
+        } catch (SecurityException e) {
+            throw new IllegalStateException("Unable to access getId Method in the "+RdfEntity.class+" Interface",e);
+        } catch (NoSuchMethodException e) {
+            throw new IllegalStateException("Unable to find getId Method in the "+RdfEntity.class+" Interface",e);
+        }
+    }
+
+    /**
+     * The logger TODO: Question: How to get the dependencies for logging working with maven :(
+     */
 //    private static final Logger log = LoggerFactory.getLogger(RdfProxyInvocationHandler.class);
 
-	protected SimpleRdfEntityFactory factory;
-	protected LiteralFactory literalFactory;
-	protected NonLiteral rdfNode;
-	private final Set<Class<?>> interfaces;
-	public RdfProxyInvocationHandler(SimpleRdfEntityFactory factory, NonLiteral rdfNode, Class<?>[] parsedInterfaces, LiteralFactory literalFactory){
-		this.rdfNode = rdfNode;
-		this.factory = factory;
-		this.literalFactory = literalFactory;
-		//TODO If slow implement this by directly using the MGraph Interface!
-		Collection<UriRef> nodeTypes = getValues(Properties.RDF_TYPE, UriRef.class);
-		Set<Class<?>> interfaceSet = new HashSet<Class<?>>();
-		for (Class<?> clazz : parsedInterfaces){
-			if(!clazz.isInterface()){
-				throw new IllegalStateException("Parsed Class "+clazz+" is not an interface!");
-			}
-			interfaceSet.add(clazz);
-			getSuperInterfaces(clazz, interfaceSet);
-		}
-		this.interfaces = Collections.unmodifiableSet(interfaceSet); //nobody should be able to change this! 
-		for (Class<?> clazz : this.interfaces){
-			Rdf classAnnotation = clazz.getAnnotation(Rdf.class);
-			if(classAnnotation == null){
-			} else { //check of the type statement is present
-				UriRef typeRef = new UriRef(classAnnotation.id());
-				if(!nodeTypes.contains(typeRef)){
-					//TODO: Question: How to get the dependencies for logging working with maven :(
-					//log.debug("add type "+typeRef+" for interface "+clazz+" to node "+rdfNode);
-					addValue(Properties.RDF_TYPE, typeRef); //add the missing type!
-				} else {
-					// else the type is already present ... nothing to do
-					//TODO: Question: How to get the dependencies for logging working with maven :(
-					//log.debug("type "+typeRef+" for interface "+clazz+" is already present for node "+rdfNode);
-				}
-			}
-		}
-	}
-
-	private static void getSuperInterfaces(Class<?> interfaze, Collection<Class<?>> interfaces){
-		for (Class<?> superInterface : interfaze.getInterfaces()){
-			if(superInterface != null){
-				interfaces.add(superInterface);
-				getSuperInterfaces(superInterface, interfaces); //recursive
-			}
-		}
-	}
-
-	@Override
-	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-		//RdfEntity rdfEntity;
-		if(!(proxy instanceof RdfEntity)){
-			throw new IllegalArgumentException("Parsed proxy instance is not of type "+RdfEntity.class
+    protected SimpleRdfEntityFactory factory;
+    protected LiteralFactory literalFactory;
+    protected NonLiteral rdfNode;
+    private final Set<Class<?>> interfaces;
+    public RdfProxyInvocationHandler(SimpleRdfEntityFactory factory, NonLiteral rdfNode, Class<?>[] parsedInterfaces, LiteralFactory literalFactory){
+        this.rdfNode = rdfNode;
+        this.factory = factory;
+        this.literalFactory = literalFactory;
+        //TODO If slow implement this by directly using the MGraph Interface!
+        Collection<UriRef> nodeTypes = getValues(Properties.RDF_TYPE, UriRef.class);
+        Set<Class<?>> interfaceSet = new HashSet<Class<?>>();
+        for (Class<?> clazz : parsedInterfaces){
+            if(!clazz.isInterface()){
+                throw new IllegalStateException("Parsed Class "+clazz+" is not an interface!");
+            }
+            interfaceSet.add(clazz);
+            getSuperInterfaces(clazz, interfaceSet);
+        }
+        this.interfaces = Collections.unmodifiableSet(interfaceSet); //nobody should be able to change this!
+        for (Class<?> clazz : this.interfaces){
+            Rdf classAnnotation = clazz.getAnnotation(Rdf.class);
+            if(classAnnotation == null){
+            } else { //check of the type statement is present
+                UriRef typeRef = new UriRef(classAnnotation.id());
+                if(!nodeTypes.contains(typeRef)){
+                    //TODO: Question: How to get the dependencies for logging working with maven :(
+                    //log.debug("add type "+typeRef+" for interface "+clazz+" to node "+rdfNode);
+                    addValue(Properties.RDF_TYPE, typeRef); //add the missing type!
+                } else {
+                    // else the type is already present ... nothing to do
+                    //TODO: Question: How to get the dependencies for logging working with maven :(
+                    //log.debug("type "+typeRef+" for interface "+clazz+" is already present for node "+rdfNode);
+                }
+            }
+        }
+    }
+
+    private static void getSuperInterfaces(Class<?> interfaze, Collection<Class<?>> interfaces){
+        for (Class<?> superInterface : interfaze.getInterfaces()){
+            if(superInterface != null){
+                interfaces.add(superInterface);
+                getSuperInterfaces(superInterface, interfaces); //recursive
+            }
+        }
+    }
+
+    @Override
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        //RdfEntity rdfEntity;
+        if(!(proxy instanceof RdfEntity)){
+            throw new IllegalArgumentException("Parsed proxy instance is not of type "+RdfEntity.class
                     +". This RdfWrapperInvocationHandler implementations only work for proxies implementing this interface!");
-		}
-		//First check for Methods defined in RDFEntity and java.lang.Object
-		//implementation of the RffEntity Interface method!
-		if(method.equals(getIDMethod)){
-			return rdfNode;
-		}
-		//implement toString
-		if(method.equals(equals)){
-			return args[0] != null && args[0] instanceof RdfEntity && ((RdfEntity)args[0]).getId().equals(rdfNode);
-		}
-		//implement hashCode
-		if(method.equals(hashCode)){
-			return rdfNode.toString().hashCode();
-		}
-		//implement toString
-		if(method.equals(toString)){
-			return "Proxy for Node "+rdfNode+" and interfaces "+interfaces;
-		}
-		Rdf rdf = method.getAnnotation(Rdf.class);
-		if(rdf == null){
-			throw new IllegalStateException("Invoked Method does not have an Rdf annotation!");
-		}
-		UriRef property; 
-		if(rdf.id().startsWith("http://") || rdf.id().startsWith("urn:")){
-			property = new UriRef(rdf.id());
-		} else {
-			throw new IllegalStateException("The id=\""+rdf.id()+"\"provided by the rdf annotation is not an valid URI");
-		}
-		//check for Write (Setter) Method
-		if(method.getReturnType().equals(void.class)){
-			Type[] parameterTypes = method.getGenericParameterTypes();
-			//check the parameter types to improve error messages!
-			//Only methods with a single parameter are supported
-			if(parameterTypes.length!=1){
-				throw new IllegalStateException("Unsupported parameters for Method "+method.toString()
+        }
+        //First check for Methods defined in RDFEntity and java.lang.Object
+        //implementation of the RffEntity Interface method!
+        if(method.equals(getIDMethod)){
+            return rdfNode;
+        }
+        //implement toString
+        if(method.equals(equals)){
+            return args[0] != null && args[0] instanceof RdfEntity && ((RdfEntity)args[0]).getId().equals(rdfNode);
+        }
+        //implement hashCode
+        if(method.equals(hashCode)){
+            return rdfNode.toString().hashCode();
+        }
+        //implement toString
+        if(method.equals(toString)){
+            return "Proxy for Node "+rdfNode+" and interfaces "+interfaces;
+        }
+        Rdf rdf = method.getAnnotation(Rdf.class);
+        if(rdf == null){
+            throw new IllegalStateException("Invoked Method does not have an Rdf annotation!");
+        }
+        UriRef property;
+        if(rdf.id().startsWith("http://") || rdf.id().startsWith("urn:")){
+            property = new UriRef(rdf.id());
+        } else {
+            throw new IllegalStateException("The id=\""+rdf.id()+"\"provided by the rdf annotation is not an valid URI");
+        }
+        //check for Write (Setter) Method
+        if(method.getReturnType().equals(void.class)){
+            Type[] parameterTypes = method.getGenericParameterTypes();
+            //check the parameter types to improve error messages!
+            //Only methods with a single parameter are supported
+            if(parameterTypes.length!=1){
+                throw new IllegalStateException("Unsupported parameters for Method "+method.toString()
                         +"! Only setter methodes with a singe parameter are supported.");
-			}
-			final Type parameterType = parameterTypes[0];
-			//now check if args != null and has an element
-			if(args == null){
-				throw new IllegalArgumentException(
+            }
+            final Type parameterType = parameterTypes[0];
+            //now check if args != null and has an element
+            if(args == null){
+                throw new IllegalArgumentException(
                         "NULL parsed as \"Object[] args\". An array with a single value is expected when calling "+method.toString()+"!");
-			}
-			if(args.length<1){
-				throw new IllegalArgumentException(
+            }
+            if(args.length<1){
+                throw new IllegalArgumentException(
                         "An empty array was parsed as \"Object[] args\". An array with a single value is expected when calling method "+method.toString()+"!");
-			}
-			final Object value = args[0];
-			//Handle Arrays
-			if(parameterType instanceof Class<?> && ((Class<?>)parameterType).isArray()){
-				throw new IllegalStateException("No support for Arrays right now. Use "+Collection.class+" instead");
-			}
-			//if null is parsed as value we need to delete all values
-			if (value == null){
-				removeValues(property);
-				return null; //setter methods are void -> return null
-			}
-			//if a collection is parsed we need to check the generic type
-			if (Collection.class.isAssignableFrom(value.getClass())){
-				Type genericType = null;
-				if (parameterTypes[0] instanceof ParameterizedType){
-					for(Type typeArgument : ((ParameterizedType)parameterTypes[0]).getActualTypeArguments()){
-						if (genericType == null){
-							genericType = typeArgument;
-						} else {
-							//TODO: replace with a warning but for testing start with an exception
-							throw new IllegalStateException(
+            }
+            final Object value = args[0];
+            //Handle Arrays
+            if(parameterType instanceof Class<?> && ((Class<?>)parameterType).isArray()){
+                throw new IllegalStateException("No support for Arrays right now. Use "+Collection.class+" instead");
+            }
+            //if null is parsed as value we need to delete all values
+            if (value == null){
+                removeValues(property);
+                return null; //setter methods are void -> return null
+            }
+            //if a collection is parsed we need to check the generic type
+            if (Collection.class.isAssignableFrom(value.getClass())){
+                Type genericType = null;
+                if (parameterTypes[0] instanceof ParameterizedType){
+                    for(Type typeArgument : ((ParameterizedType)parameterTypes[0]).getActualTypeArguments()){
+                        if (genericType == null){
+                            genericType = typeArgument;
+                        } else {
+                            //TODO: replace with a warning but for testing start with an exception
+                            throw new IllegalStateException(
                                     "Multiple generic type definition for method "+method.toString()
                                     +" (generic types: "+((ParameterizedType) parameterTypes[0]).getActualTypeArguments()+")");
-						}
-					}
-				}
-				setValues(property, (Collection<?>) value);
-				return null;
-			} else {
-				setValue(property, value);
-				return null;
-			}
-		} else { //assume an read (getter) method
-			Class<?> returnType = method.getReturnType();
-			if (Collection.class.isAssignableFrom(returnType)){
-				Type genericType = null;
-				Type genericReturnType = method.getGenericReturnType();
-				if (genericReturnType instanceof ParameterizedType){
-				    ParameterizedType type = (ParameterizedType) genericReturnType;
-					for (Type typeArgument : type.getActualTypeArguments()){
-						if (genericType == null){
-							genericType = typeArgument;
-						} else {
-							//TODO: replace with a warning but for testing start with an exception
-							throw new IllegalStateException(
+                        }
+                    }
+                }
+                setValues(property, (Collection<?>) value);
+                return null;
+            } else {
+                setValue(property, value);
+                return null;
+            }
+        } else { //assume an read (getter) method
+            Class<?> returnType = method.getReturnType();
+            if (Collection.class.isAssignableFrom(returnType)){
+                Type genericType = null;
+                Type genericReturnType = method.getGenericReturnType();
+                if (genericReturnType instanceof ParameterizedType){
+                    ParameterizedType type = (ParameterizedType) genericReturnType;
+                    for (Type typeArgument : type.getActualTypeArguments()){
+                        if (genericType == null){
+                            genericType = typeArgument;
+                        } else {
+                            //TODO: replace with a warning but for testing start with an exception
+                            throw new IllegalStateException(
                                     "Multiple generic type definition for method "+method.toString()
                                     +" (generic types: "+type.getActualTypeArguments()+")");
-						}
-					}
-				}
-				if (genericType == null){
-					throw new IllegalStateException(
+                        }
+                    }
+                }
+                if (genericType == null){
+                    throw new IllegalStateException(
                             "Generic Type not defined for Collection in Method "+method.toString()
                             +" (generic type is needed to correctly map rdf values for property "+property);
-				}
-				return getValues(property, (Class<?>)genericType);
-			} else {
-				return getValue(property, returnType);
-			}
-		}
-	}
-	
-	@SuppressWarnings("unchecked")
-	private <T> T getValue(UriRef property, Class<T> type){
-		Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
-		if (results.hasNext()){
-			Resource result = results.next().getObject();
-			if (result instanceof NonLiteral){
-				if (RdfEntity.class.isAssignableFrom(type)){
-					return (T)factory.getProxy((NonLiteral)result, (Class<? extends RdfEntity>)type);
-				} else { //check result for UriRef and types UriRef, URI or URL
-					if(result instanceof UriRef){
-						if (UriRef.class.isAssignableFrom(type)){
-							return (T)result;
-						} else if (URI.class.isAssignableFrom(type)){
-							try {
-								return (T)new URI(((UriRef)result).getUnicodeString());
-							} catch (URISyntaxException e) {
-								throw new IllegalStateException("Unable to parse "+URI.class
+                }
+                return getValues(property, (Class<?>)genericType);
+            } else {
+                return getValue(property, returnType);
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private <T> T getValue(UriRef property, Class<T> type){
+        Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
+        if (results.hasNext()){
+            Resource result = results.next().getObject();
+            if (result instanceof NonLiteral){
+                if (RdfEntity.class.isAssignableFrom(type)){
+                    return (T)factory.getProxy((NonLiteral)result, (Class<? extends RdfEntity>)type);
+                } else { //check result for UriRef and types UriRef, URI or URL
+                    if(result instanceof UriRef){
+                        if (UriRef.class.isAssignableFrom(type)){
+                            return (T)result;
+                        } else if (URI.class.isAssignableFrom(type)){
+                            try {
+                                return (T)new URI(((UriRef)result).getUnicodeString());
+                            } catch (URISyntaxException e) {
+                                throw new IllegalStateException("Unable to parse "+URI.class
                                         +" for "+UriRef.class+" value="+((UriRef)result).getUnicodeString());
-							}
-						} else if (URL.class.isAssignableFrom(type)){
-							try {
-								return (T)new URL(((UriRef)result).getUnicodeString());
-							} catch (MalformedURLException e) {
-								throw new IllegalStateException("Unable to parse "+URL.class
+                            }
+                        } else if (URL.class.isAssignableFrom(type)){
+                            try {
+                                return (T)new URL(((UriRef)result).getUnicodeString());
+                            } catch (MalformedURLException e) {
+                                throw new IllegalStateException("Unable to parse "+URL.class
                                         +" for "+UriRef.class+" value="+((UriRef)result).getUnicodeString());
-							}
-						} else {
-							throw new IllegalArgumentException("Parsed Type "+type
+                            }
+                        } else {
+                            throw new IllegalArgumentException("Parsed Type "+type
                                     +" is not compatible for result type "+result.getClass()
                                     +" (value "+result+") of node "+rdfNode+" and property "+property
                                     +"! (Subclass of RdfEntity, UriRef, URI or URL is expected for NonLiteral Values)");
-						}
-					} else {
-						throw new IllegalArgumentException("Parsed Type "+type
+                        }
+                    } else {
+                        throw new IllegalArgumentException("Parsed Type "+type
                                 +" is not compatible for result type "+result.getClass()
                                 +" (value "+result+") of node "+rdfNode+" and property "+property
                                 +"! (Subclass of RdfEntity expected as type for NonLiteral values that are no instanceof UriRef)");
-					}
-				}
-			} else {
-				return literalFactory.createObject(type,(TypedLiteral) result);
-			}
-		} else {
-			return null;
-		}
-	}
-	private <T> Collection<T> getValues(UriRef property, Class<T> type){
-		return new RdfProxyPropertyCollection<T>(property, type);
-	}
-	private void setValue(UriRef property, Object value){
-		removeValues(property);
-		addValue(property, value);
-	}
-	private void setValues(UriRef property, Collection<?> values){
-		removeValues(property);
-		for(Object value : values){
-			addValue(property, value);
-		}
-	}
-	protected Resource getRdfResource(Object value) throws NoConvertorException{
-		if(value instanceof Resource){ 
-			//if the parsed object is already a Resource
-			return (Resource) value; //return it
-		} else if(value instanceof RdfEntity){ //check for other proxies
-			return ((RdfEntity)value).getId();
-		} else if(value instanceof URI){ //or URI links
-			return new UriRef(value.toString());
-		} else if(value instanceof URL){ //or URL links
-			return new UriRef(value.toString());
-		} else { //nothing of that
-			//try to make an Literal (Clarezza internal Adapters)
-			return literalFactory.createTypedLiteral(value);
-		}
-	}
-	private boolean addValue(UriRef property, Object value){
-		Resource rdfValue;
-		try {
-			rdfValue = getRdfResource(value);
-			return factory.getGraph().add(new TripleImpl(rdfNode, property, rdfValue));
-		} catch (NoConvertorException e){
-			throw new IllegalArgumentException("Unable to transform "+value.getClass()
+                    }
+                }
+            } else {
+                return literalFactory.createObject(type,(TypedLiteral) result);
+            }
+        } else {
+            return null;
+        }
+    }
+    private <T> Collection<T> getValues(UriRef property, Class<T> type){
+        return new RdfProxyPropertyCollection<T>(property, type);
+    }
+    private void setValue(UriRef property, Object value){
+        removeValues(property);
+        addValue(property, value);
+    }
+    private void setValues(UriRef property, Collection<?> values){
+        removeValues(property);
+        for(Object value : values){
+            addValue(property, value);
+        }
+    }
+    protected Resource getRdfResource(Object value) throws NoConvertorException{
+        if(value instanceof Resource){
+            //if the parsed object is already a Resource
+            return (Resource) value; //return it
+        } else if(value instanceof RdfEntity){ //check for other proxies
+            return ((RdfEntity)value).getId();
+        } else if(value instanceof URI){ //or URI links
+            return new UriRef(value.toString());
+        } else if(value instanceof URL){ //or URL links
+            return new UriRef(value.toString());
+        } else { //nothing of that
+            //try to make an Literal (Clarezza internal Adapters)
+            return literalFactory.createTypedLiteral(value);
+        }
+    }
+    private boolean addValue(UriRef property, Object value){
+        Resource rdfValue;
+        try {
+            rdfValue = getRdfResource(value);
+            return factory.getGraph().add(new TripleImpl(rdfNode, property, rdfValue));
+        } catch (NoConvertorException e){
+            throw new IllegalArgumentException("Unable to transform "+value.getClass()
                     +" to an RDF Node. Only "+RdfEntity.class+" and RDF Literal Types are supported");
-		}
-	}
-	private boolean removeValue(UriRef property, Object value){	
-		Resource rdfValue;
-		try {
-			rdfValue = getRdfResource(value);
-			return factory.getGraph().remove(new TripleImpl(rdfNode, property, rdfValue));
-		} catch (NoConvertorException e){
-			throw new IllegalArgumentException("Unable to transform "+value.getClass()
+        }
+    }
+    private boolean removeValue(UriRef property, Object value){
+        Resource rdfValue;
+        try {
+            rdfValue = getRdfResource(value);
+            return factory.getGraph().remove(new TripleImpl(rdfNode, property, rdfValue));
+        } catch (NoConvertorException e){
+            throw new IllegalArgumentException("Unable to transform "+value.getClass()
                     +" to an RDF Node. Only "+RdfEntity.class+" and RDF Literal Types are supported");
-		}
-	}
-	private void removeValues(UriRef proptery){
-		Iterator<Triple> toRemove = factory.getGraph().filter(rdfNode, proptery, null);
-		while(toRemove.hasNext()){
-			factory.getGraph().remove(toRemove.next());
-		}
-	}
-
-	/**
-	 * We need this class to apply changes in the collection to the MGraph.
-	 * This collection implementation is a stateless wrapper over the
-	 * triples selected by the subject,property pair over the MGraph!<br>
-	 * Default implementation of {@link AbstractCollection} are very poor
-	 * performance. Because of that this class overrides some methods
-	 * already implemented by its abstract super class.
-	 * @author westei
-	 *
-	 * @param <T>
-	 */
-	private class RdfProxyPropertyCollection<T> extends AbstractCollection<T> {
-
-		//private final NonLiteral resource;
-		private final UriRef property;
-		private final Class<T> genericType;
-		private final boolean entity;
-		private final boolean uri;
-		private final boolean url;
-		private final boolean uriRef;
-		
-		private RdfProxyPropertyCollection(UriRef property,Class<T> genericType) {
-			this.property = property;
-			this.genericType = genericType;
-			entity = RdfEntity.class.isAssignableFrom(genericType);
-			uri = URI.class.isAssignableFrom(genericType);
-			url = URL.class.isAssignableFrom(genericType);
-			uriRef = UriRef.class.isAssignableFrom(genericType);
-		}
-		
-		@Override
-		public Iterator<T> iterator() {
-			return new Iterator<T>() {
-				Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
-				@Override
-				public boolean hasNext() {
-					return results.hasNext();
-				}
-
-				@SuppressWarnings("unchecked")
-				@Override
-				public T next() {
-					Resource value = results.next().getObject();
-					if (entity){
-						//type checks are done within the constructor 
-						return (T) factory.getProxy((NonLiteral)value, (Class<? extends RdfEntity>)genericType);
-					} else if(uri){
-						try {
-							return (T)new URI(((UriRef)value).getUnicodeString());
-						} catch (URISyntaxException e) {
-							throw new IllegalStateException("Unable to parse "+URI.class+" for "+UriRef.class+" value="+((UriRef)value).getUnicodeString());
-						}
-					} else if(url){
-						try {
-							return (T)new URL(((UriRef)value).getUnicodeString());
-						} catch (MalformedURLException e) {
-							throw new IllegalStateException("Unable to parse "+URL.class+" for "+UriRef.class+" value="+((UriRef)value).getUnicodeString());
-						}
-					} else if(uriRef){
-						return (T)value;
-					} else {
-						return literalFactory.createObject(genericType, (TypedLiteral)value);
-					}
-				}
-
-				@Override
-				public void remove() {
-					results.remove(); //no Idea if Clerezza implements that ^
-				}
-			};
-		}
-
-		@Override
-		public int size() {
-			Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
-			int size = 0;
-			for (;results.hasNext();size++){
-				results.next();
-			}
-			return size;
-		}
-		public boolean add(T value) {
-			return addValue(property, value);
-		}
-		@Override
-		public boolean remove(Object value) {
-			return removeValue(property,value);
-		}
-		@Override
-		public boolean isEmpty() {
-			return !factory.getGraph().filter(rdfNode, property, null).hasNext();
-		}
-	}
-}
\ No newline at end of file
+        }
+    }
+    private void removeValues(UriRef proptery){
+        Iterator<Triple> toRemove = factory.getGraph().filter(rdfNode, proptery, null);
+        while(toRemove.hasNext()){
+            factory.getGraph().remove(toRemove.next());
+        }
+    }
+
+    /**
+     * We need this class to apply changes in the collection to the MGraph.
+     * This collection implementation is a stateless wrapper over the
+     * triples selected by the subject,property pair over the MGraph!<br>
+     * Default implementation of {@link AbstractCollection} are very poor
+     * performance. Because of that this class overrides some methods
+     * already implemented by its abstract super class.
+     * @author westei
+     *
+     * @param <T>
+     */
+    private class RdfProxyPropertyCollection<T> extends AbstractCollection<T> {
+
+        //private final NonLiteral resource;
+        private final UriRef property;
+        private final Class<T> genericType;
+        private final boolean entity;
+        private final boolean uri;
+        private final boolean url;
+        private final boolean uriRef;
+
+        private RdfProxyPropertyCollection(UriRef property,Class<T> genericType) {
+            this.property = property;
+            this.genericType = genericType;
+            entity = RdfEntity.class.isAssignableFrom(genericType);
+            uri = URI.class.isAssignableFrom(genericType);
+            url = URL.class.isAssignableFrom(genericType);
+            uriRef = UriRef.class.isAssignableFrom(genericType);
+        }
+
+        @Override
+        public Iterator<T> iterator() {
+            return new Iterator<T>() {
+                Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
+                @Override
+                public boolean hasNext() {
+                    return results.hasNext();
+                }
+
+                @SuppressWarnings("unchecked")
+                @Override
+                public T next() {
+                    Resource value = results.next().getObject();
+                    if (entity){
+                        //type checks are done within the constructor
+                        return (T) factory.getProxy((NonLiteral)value, (Class<? extends RdfEntity>)genericType);
+                    } else if(uri){
+                        try {
+                            return (T)new URI(((UriRef)value).getUnicodeString());
+                        } catch (URISyntaxException e) {
+                            throw new IllegalStateException("Unable to parse "+URI.class+" for "+UriRef.class+" value="+((UriRef)value).getUnicodeString());
+                        }
+                    } else if(url){
+                        try {
+                            return (T)new URL(((UriRef)value).getUnicodeString());
+                        } catch (MalformedURLException e) {
+                            throw new IllegalStateException("Unable to parse "+URL.class+" for "+UriRef.class+" value="+((UriRef)value).getUnicodeString());
+                        }
+                    } else if(uriRef){
+                        return (T)value;
+                    } else {
+                        return literalFactory.createObject(genericType, (TypedLiteral)value);
+                    }
+                }
+
+                @Override
+                public void remove() {
+                    results.remove(); //no Idea if Clerezza implements that ^
+                }
+            };
+        }
+
+        @Override
+        public int size() {
+            Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
+            int size = 0;
+            for (;results.hasNext();size++){
+                results.next();
+            }
+            return size;
+        }
+        public boolean add(T value) {
+            return addValue(property, value);
+        }
+        @Override
+        public boolean remove(Object value) {
+            return removeValue(property,value);
+        }
+        @Override
+        public boolean isEmpty() {
+            return !factory.getGraph().filter(rdfNode, property, null).hasNext();
+        }
+    }
+}

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/SimpleRdfEntityFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/SimpleRdfEntityFactory.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/SimpleRdfEntityFactory.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/helper/impl/SimpleRdfEntityFactory.java Sun Dec 12 16:10:48 2010
@@ -10,33 +10,33 @@ import eu.iksproject.fise.servicesapi.he
 import eu.iksproject.fise.servicesapi.helper.RdfEntityFactory;
 
 public class SimpleRdfEntityFactory extends RdfEntityFactory {
-	
-	private final MGraph graph;
-	private final LiteralFactory literalFactory;
-
-	public SimpleRdfEntityFactory(MGraph graph) {
-		if (graph == null){
-			throw new IllegalArgumentException("The MGraph parsed as parameter MUST NOT be NULL!");
-		}
-		this.graph = graph;
+
+    private final MGraph graph;
+    private final LiteralFactory literalFactory;
+
+    public SimpleRdfEntityFactory(MGraph graph) {
+        if (graph == null){
+            throw new IllegalArgumentException("The MGraph parsed as parameter MUST NOT be NULL!");
+        }
+        this.graph = graph;
         literalFactory = LiteralFactory.getInstance();
-	}
+    }
 
-	@SuppressWarnings("unchecked")
-	public <T extends RdfEntity> T getProxy(NonLiteral rdfNode, Class<T> type,Class<?>...additionalInterfaces) {
-		Class<?>[] interfaces = new Class<?>[additionalInterfaces.length+1];
-		interfaces[0] = type;
-		System.arraycopy(additionalInterfaces, 0, interfaces, 1, additionalInterfaces.length);
-		//Class<?> proxy = Proxy.getProxyClass(WrapperFactory.class.getClassLoader(), interfaces);
-		Object instance = Proxy.newProxyInstance(
+    @SuppressWarnings("unchecked")
+    public <T extends RdfEntity> T getProxy(NonLiteral rdfNode, Class<T> type,Class<?>...additionalInterfaces) {
+        Class<?>[] interfaces = new Class<?>[additionalInterfaces.length+1];
+        interfaces[0] = type;
+        System.arraycopy(additionalInterfaces, 0, interfaces, 1, additionalInterfaces.length);
+        //Class<?> proxy = Proxy.getProxyClass(WrapperFactory.class.getClassLoader(), interfaces);
+        Object instance = Proxy.newProxyInstance(
                 SimpleRdfEntityFactory.class.getClassLoader(),
                 interfaces,
                 new RdfProxyInvocationHandler(this, rdfNode, interfaces, literalFactory));
-		return (T)instance;
-	}
+        return (T)instance;
+    }
 
-	protected MGraph getGraph() {
-		return graph;
-	}
+    protected MGraph getGraph() {
+        return graph;
+    }
 
 }

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/OntologicalClasses.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/OntologicalClasses.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/OntologicalClasses.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/OntologicalClasses.java Sun Dec 12 16:10:48 2010
@@ -18,10 +18,10 @@ public class OntologicalClasses {
             NamespaceEnum.dbpedia_ont+"Person");
 
     public static final UriRef DBPEDIA_PLACE = new UriRef(
-    		NamespaceEnum.dbpedia_ont+"Place");
+            NamespaceEnum.dbpedia_ont+"Place");
 
     public static final UriRef DBPEDIA_ORGANISATION = new UriRef(
-    		NamespaceEnum.dbpedia_ont+"Organisation");
+            NamespaceEnum.dbpedia_ont+"Organisation");
 
     private OntologicalClasses() {
     }

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/Properties.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/Properties.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/Properties.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/Properties.java Sun Dec 12 16:10:48 2010
@@ -152,11 +152,11 @@ public class Properties {
     public static final UriRef DC_LANGUAGE = new UriRef(NamespaceEnum.dc
             + "language");
 
-	/**
-	 * Plain text content of a content item.
-	  */
-	public static final UriRef NIE_PLAINTEXTCONTENT = new UriRef(NamespaceEnum.nie + "plainTextContent");
-	
+    /**
+     * Plain text content of a content item.
+      */
+    public static final UriRef NIE_PLAINTEXTCONTENT = new UriRef(NamespaceEnum.nie + "plainTextContent");
+
     /**
      * The topic of the resource. Used to relate a content item to a
      * skos:Concept modelling one of the overall topic of the content.

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/TechnicalClasses.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/TechnicalClasses.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/TechnicalClasses.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/main/java/eu/iksproject/fise/servicesapi/rdf/TechnicalClasses.java Sun Dec 12 16:10:48 2010
@@ -14,26 +14,26 @@ public class TechnicalClasses {
      * Type used for all enhancement created by Fise
      */
     public static final UriRef FISE_ENHANCEMENT = new UriRef(
-    		NamespaceEnum.fise+"Enhancement");
+            NamespaceEnum.fise+"Enhancement");
 
     /**
      * Type used for annotations on Text created by FISE. This type is intended
      * to be used in combination with FISE_ENHANCEMENT
      */
     public static final UriRef FISE_TEXTANNOTATION = new UriRef(
-    		NamespaceEnum.fise+"TextAnnotation");
+            NamespaceEnum.fise+"TextAnnotation");
 
     /**
      * Type used for annotations of named entities. This type is intended
      * to be used in combination with FISE_ENHANCEMENT
      */
     public static final UriRef FISE_ENTITYANNOTATION = new UriRef(
-    		NamespaceEnum.fise+"EntityAnnotation");
+            NamespaceEnum.fise+"EntityAnnotation");
 
     /**
      * To be used as a type pour any semantic knowledge extraction
      */
-	@Deprecated
+    @Deprecated
     public static final UriRef FISE_EXTRACTION = new UriRef(
             "http://iks-project.eu/ns/fise/extraction/Extraction");
 
@@ -43,7 +43,7 @@ public class TechnicalClasses {
      * TODO: rwesten: Check how this standard can be used for FISE enhancements
      * @deprecated
      */
-	@Deprecated
+    @Deprecated
     public static final UriRef ANNOTEA_ANNOTATION = new UriRef(
             "http://www.w3.org/2000/10/annotation-ns#Annotation");
 
@@ -59,7 +59,7 @@ public class TechnicalClasses {
      * Mapping of Categories</a> for more Information)
      */
     public static final UriRef FISE_CATEGORY = new UriRef(
-    		NamespaceEnum.fise + "Category");
+            NamespaceEnum.fise + "Category");
 
     private TechnicalClasses() {
     }

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/EnhancementEngineHelperTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/EnhancementEngineHelperTest.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/EnhancementEngineHelperTest.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/EnhancementEngineHelperTest.java Sun Dec 12 16:10:48 2010
@@ -36,21 +36,21 @@ public class EnhancementEngineHelperTest
     @Test
     public void testEnhancementEngineHelper() throws Exception {
         ContentItem ci = new ContentItem() {
-			MGraph mgraph = new SimpleMGraph();
-			@Override
-			public InputStream getStream() {
-				return new ByteArrayInputStream("There is content".getBytes());
-			}
-			
-			@Override
-			public String getMimeType() { return "text/plain"; }
-			
-			@Override
-			public MGraph getMetadata() { return mgraph; }
-			
-			@Override
-			public String getId() { return "urn:test:contentItem"; }
-		};
+            MGraph mgraph = new SimpleMGraph();
+            @Override
+            public InputStream getStream() {
+                return new ByteArrayInputStream("There is content".getBytes());
+            }
+
+            @Override
+            public String getMimeType() { return "text/plain"; }
+
+            @Override
+            public MGraph getMetadata() { return mgraph; }
+
+            @Override
+            public String getId() { return "urn:test:contentItem"; }
+        };
         EnhancementEngine engine = new MyEngine();
 
         UriRef extraction = EnhancementEngineHelper.createNewExtraction(ci, engine);

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/RdfEntityFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/RdfEntityFactoryTest.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/RdfEntityFactoryTest.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/RdfEntityFactoryTest.java Sun Dec 12 16:10:48 2010
@@ -33,324 +33,324 @@ import eu.iksproject.fise.servicesapi.rd
  * @author Rupert Westenthaler
  */
 public class RdfEntityFactoryTest {
-	
-	@Test
-	public void testRdfEntity() throws Exception {
-		MGraph graph = new SimpleMGraph();
-		RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
-		String testUri = "urn:RdfEntityFactoryTest:TestEntity";
-		UriRef node = new UriRef(testUri);
-		RdfEntity rdfEntity = factory.getProxy(node, RdfEntity.class);
-		//TODO: Test type statement
-		//TODO: test getID Method
+
+    @Test
+    public void testRdfEntity() throws Exception {
+        MGraph graph = new SimpleMGraph();
+        RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
+        String testUri = "urn:RdfEntityFactoryTest:TestEntity";
+        UriRef node = new UriRef(testUri);
+        RdfEntity rdfEntity = factory.getProxy(node, RdfEntity.class);
+        //TODO: Test type statement
+        //TODO: test getID Method
         assertEquals(rdfEntity.getId(), node);
-		//TODO: Test equals
-		RdfEntity rdfEntity2 = factory.getProxy(node,RdfEntity.class);
+        //TODO: Test equals
+        RdfEntity rdfEntity2 = factory.getProxy(node,RdfEntity.class);
         assertEquals(rdfEntity, rdfEntity2);
-		//TODO: Test hashCode
+        //TODO: Test hashCode
         assertEquals(rdfEntity.hashCode(), rdfEntity2.hashCode());
-	}
-	@Test
-	public void testPrimitiveDataTypes() throws Exception {
-		MGraph graph = new SimpleMGraph();
-		RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
-		String testUri = "urn:RdfEntityFactoryTest:TestEntity";
-		UriRef node = new UriRef(testUri);
-		TestRdfEntity testEntity = factory.getProxy(node, TestRdfEntity.class);
-		
-		testEntity.setBoolean(true);
-		assertTrue(testEntity.getBoolean());
-		
-		testEntity.setInteger(10);
+    }
+    @Test
+    public void testPrimitiveDataTypes() throws Exception {
+        MGraph graph = new SimpleMGraph();
+        RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
+        String testUri = "urn:RdfEntityFactoryTest:TestEntity";
+        UriRef node = new UriRef(testUri);
+        TestRdfEntity testEntity = factory.getProxy(node, TestRdfEntity.class);
+
+        testEntity.setBoolean(true);
+        assertTrue(testEntity.getBoolean());
+
+        testEntity.setInteger(10);
         assertEquals(new Integer(10), testEntity.getInteger());
-		
-		testEntity.setLong(20l);
+
+        testEntity.setLong(20l);
         assertEquals(new Long(20), testEntity.getLong());
-		
-		//TODO: Not supported by org.apache.clerezza.rdf.core.impl.SimpleLiteralFactory!
-		//testEntity.setFloat(0.1f);
-		//assertTrue(new Float(0.1f).equals(testEntity.getFloat()));
-		
-		testEntity.setDouble(0.2);
+
+        //TODO: Not supported by org.apache.clerezza.rdf.core.impl.SimpleLiteralFactory!
+        //testEntity.setFloat(0.1f);
+        //assertTrue(new Float(0.1f).equals(testEntity.getFloat()));
+
+        testEntity.setDouble(0.2);
         assertEquals(new Double(0.2), testEntity.getDouble());
-		
-		testEntity.setString("Test!");
+
+        testEntity.setString("Test!");
         assertEquals("Test!", testEntity.getString());
-		
-		Date currentDate = new Date();
-		testEntity.setDate(currentDate);
+
+        Date currentDate = new Date();
+        testEntity.setDate(currentDate);
         assertEquals(currentDate, testEntity.getDate());
-		
-		testEntity.setIntegers(Arrays.asList(new Integer(1),new Integer(2), new Integer(3)));
-		Collection<Integer> integers = testEntity.getIntegers();
-		assertTrue(integers.contains(new Integer(1)));
-		assertTrue(integers.contains(new Integer(2)));
-		assertTrue(integers.contains(new Integer(3)));
-
-		//test Remove
-		integers.remove(new Integer(2));
-		assertTrue(integers.contains(new Integer(1)));
-		assertTrue(!integers.contains(new Integer(2)));
-		assertTrue(integers.contains(new Integer(3)));
-
-		//get an new Collection and repeat the test
-		integers = testEntity.getIntegers();
-		assertTrue(integers.contains(new Integer(1)));
-		assertTrue(!integers.contains(new Integer(2)));
-		assertTrue(integers.contains(new Integer(3)));
-		
-		//test Add
-		integers.add(new Integer(-1));
-		assertTrue(integers.contains(new Integer(-1)));
-		assertTrue(integers.contains(new Integer(1)));
-		assertTrue(integers.contains(new Integer(3)));
-
-		//again get a new collection
-		Collection<Integer>integers2 = testEntity.getIntegers();
-		assertTrue(integers2.contains(new Integer(-1)));
-		assertTrue(integers2.contains(new Integer(1)));
-		assertTrue(integers2.contains(new Integer(3)));
-		
-		//remove/add an value in integers and test in integers2
-		integers.remove(new Integer(3));
-		integers.add(new Integer(0));
-		assertTrue(integers2.contains(new Integer(-1)));
-		assertTrue(integers2.contains(new Integer(0)));
-		assertTrue(integers2.contains(new Integer(1)));
-		assertTrue(!integers2.contains(new Integer(2)));
-		assertTrue(!integers2.contains(new Integer(3)));
-	}
-
-	@Test
-	public void testTypeStatements() throws Exception {
-		MGraph graph = new SimpleMGraph();
-		RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
-		String testUri = "urn:RdfEntityFactoryTest:TestEntity";
-		UriRef node = new UriRef(testUri);
-		TestRdfEntity entity = factory.getProxy(node, TestRdfEntity.class, new Class[]{TestRdfEntity2.class});
-		// test the if the proxy implements both interfaces
-		assertTrue(entity instanceof TestRdfEntity);
-		assertTrue(entity instanceof TestRdfEntity2);
-
-		Set<String> typeStrings = getRdfTypes(graph, node);
-		assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
-		assertTrue(typeStrings.contains(TestRdfEntity2.class.getAnnotation(Rdf.class).id()));
-	}
-
-	@Test
-	public void testObjectProperties() throws Exception {
-		MGraph graph = new SimpleMGraph();
-		RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
-		String testUri = "urn:RdfEntityFactoryTest:TestEntity";
-		String testUri2 = "urn:RdfEntityFactoryTest:TestEntity2";
-		UriRef node = new UriRef(testUri);
-		UriRef node2 = new UriRef(testUri2);
-		TestRdfEntity entity = factory.getProxy(node, TestRdfEntity.class);
-		TestRdfEntity2 entity2 = factory.getProxy(node2, TestRdfEntity2.class);
 
-		URI testURI = new URI("urn:test:URI");
-		entity.setURI(testURI);
+        testEntity.setIntegers(Arrays.asList(new Integer(1),new Integer(2), new Integer(3)));
+        Collection<Integer> integers = testEntity.getIntegers();
+        assertTrue(integers.contains(new Integer(1)));
+        assertTrue(integers.contains(new Integer(2)));
+        assertTrue(integers.contains(new Integer(3)));
+
+        //test Remove
+        integers.remove(new Integer(2));
+        assertTrue(integers.contains(new Integer(1)));
+        assertTrue(!integers.contains(new Integer(2)));
+        assertTrue(integers.contains(new Integer(3)));
+
+        //get an new Collection and repeat the test
+        integers = testEntity.getIntegers();
+        assertTrue(integers.contains(new Integer(1)));
+        assertTrue(!integers.contains(new Integer(2)));
+        assertTrue(integers.contains(new Integer(3)));
+
+        //test Add
+        integers.add(new Integer(-1));
+        assertTrue(integers.contains(new Integer(-1)));
+        assertTrue(integers.contains(new Integer(1)));
+        assertTrue(integers.contains(new Integer(3)));
+
+        //again get a new collection
+        Collection<Integer>integers2 = testEntity.getIntegers();
+        assertTrue(integers2.contains(new Integer(-1)));
+        assertTrue(integers2.contains(new Integer(1)));
+        assertTrue(integers2.contains(new Integer(3)));
+
+        //remove/add an value in integers and test in integers2
+        integers.remove(new Integer(3));
+        integers.add(new Integer(0));
+        assertTrue(integers2.contains(new Integer(-1)));
+        assertTrue(integers2.contains(new Integer(0)));
+        assertTrue(integers2.contains(new Integer(1)));
+        assertTrue(!integers2.contains(new Integer(2)));
+        assertTrue(!integers2.contains(new Integer(3)));
+    }
+
+    @Test
+    public void testTypeStatements() throws Exception {
+        MGraph graph = new SimpleMGraph();
+        RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
+        String testUri = "urn:RdfEntityFactoryTest:TestEntity";
+        UriRef node = new UriRef(testUri);
+        TestRdfEntity entity = factory.getProxy(node, TestRdfEntity.class, new Class[]{TestRdfEntity2.class});
+        // test the if the proxy implements both interfaces
+        assertTrue(entity instanceof TestRdfEntity);
+        assertTrue(entity instanceof TestRdfEntity2);
+
+        Set<String> typeStrings = getRdfTypes(graph, node);
+        assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
+        assertTrue(typeStrings.contains(TestRdfEntity2.class.getAnnotation(Rdf.class).id()));
+    }
+
+    @Test
+    public void testObjectProperties() throws Exception {
+        MGraph graph = new SimpleMGraph();
+        RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
+        String testUri = "urn:RdfEntityFactoryTest:TestEntity";
+        String testUri2 = "urn:RdfEntityFactoryTest:TestEntity2";
+        UriRef node = new UriRef(testUri);
+        UriRef node2 = new UriRef(testUri2);
+        TestRdfEntity entity = factory.getProxy(node, TestRdfEntity.class);
+        TestRdfEntity2 entity2 = factory.getProxy(node2, TestRdfEntity2.class);
+
+        URI testURI = new URI("urn:test:URI");
+        entity.setURI(testURI);
         assertEquals(testURI, entity.getURI());
-		
-		URL testURL = new URL("http://www.iks-project.eu");
-		entity.setURL(testURL);
+
+        URL testURL = new URL("http://www.iks-project.eu");
+        entity.setURL(testURL);
         assertEquals(testURL, entity.getURL());
-		
-		entity.setUriRef(node2);
+
+        entity.setUriRef(node2);
         assertEquals(node2, entity.getUriRef());
-		
-		entity2.setTestEntity(entity);
+
+        entity2.setTestEntity(entity);
         assertEquals(entity, entity2.getTestEntity());
-		
-		Collection<TestRdfEntity> testEntities = entity2.getTestEntities();
-		assertTrue(testEntities.isEmpty()); //check that entity is not in the collection
-		Set<UriRef> testUriRefs = new HashSet<UriRef>();
-		int NUM = 10;
-		for (int i=0;i<NUM;i++){
-			UriRef testNode = new UriRef(testUri+':'+'_'+i);
-			testUriRefs.add(testNode);
-			testEntities.add(factory.getProxy(testNode, TestRdfEntity.class));
-		}
-		//now get a new collection and test if the added entities are there
-		Collection<UriRef> resultUriRefs = new ArrayList<UriRef>(); //add to a list to check for duplicates
-		for (TestRdfEntity e : entity2.getTestEntities()){
-			assertTrue(e.getId() instanceof UriRef); //I used UriRefs for the generation ...
-			resultUriRefs.add((UriRef)e.getId());
-		}
-		//now cross check
-		assertTrue(testUriRefs.containsAll(resultUriRefs));
-		assertTrue(resultUriRefs.containsAll(testUriRefs));
-		//now one could try to remove some Elements ...
-		// ... but things like that are already tested for Integers in testPrimitiveDataTypes
-	}
-
-	@Test
-	public void testInterfaceHierarchies() throws Exception {
-		MGraph graph = new SimpleMGraph();
-		RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
-		String testUri = "urn:RdfEntityFactoryTest:SubTestEntity";
-		String testUri2 = "urn:RdfEntityFactoryTest:TestEntity2";
-		String testUri3 = "urn:RdfEntityFactoryTest:TestEntity";
-		UriRef node = new UriRef(testUri);
-		UriRef node2 = new UriRef(testUri2);
-		UriRef node3 = new UriRef(testUri3);
-		SubTestRdfEntity entity = factory.getProxy(node, SubTestRdfEntity.class);
-		TestRdfEntity entity2 = factory.getProxy(node2, TestRdfEntity.class,new Class<?>[]{SubTestRdfEntity.class,TestRdfEntity2.class});
-		TestRdfEntity entity3 = factory.getProxy(node3, TestRdfEntity.class);
-		
-		//Start with checking the types for entity2
-		//first type cast to the hierarchy
-		assertTrue(entity instanceof TestRdfEntity);
-		assertTrue(entity instanceof RdfEntity);
-
-		// test if the rdf:type triples are present in the MGraph
-		Set<String> typeStrings = getRdfTypes(graph, node);
-		assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
-		assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
-
-		typeStrings = null;
-		//now the same for entity2
-		//first type cast to the hierarchy
-		assertTrue(entity2 instanceof SubTestRdfEntity);
-		assertTrue(entity2 instanceof TestRdfEntity2);
-		assertTrue(entity2 instanceof RdfEntity);
-
-		// test if the rdf:type triples are present in the MGraph
-		typeStrings = getRdfTypes(graph, node2);
-		assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
-		assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
-		assertTrue(typeStrings.contains(TestRdfEntity2.class.getAnnotation(Rdf.class).id()));
-
-		typeStrings = null;
-		//Now check Entity3
-		assertTrue(!(entity3 instanceof SubTestRdfEntity));
-		assertTrue(entity3 instanceof TestRdfEntity);
-
-		//Now create an new Entity for the same Node that implements SubEntity2
-		SubTestRdfEntity entity4 = factory.getProxy(node3, SubTestRdfEntity.class);
-		//check if entity4 implements SubTestRefEntity
-		assertTrue(entity4 instanceof SubTestRdfEntity);
-
-		//now check if the additional type was added to node3
-		typeStrings = getRdfTypes(graph, node3);
-		assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
-		assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
-		//and that entity3 still dose not implement SubTestEntity
-		// ... because adding/removing rdf:type triples in the graph can not affect existing proxy instances!
-		assertTrue(!(entity3 instanceof SubTestRdfEntity));
-	}
-
-	private static Set<String> getRdfTypes(MGraph graph, UriRef node) {
-		Iterator<Triple> typeStatements = graph.filter(node, Properties.RDF_TYPE, null);
-		Set<String> typeStrings = new HashSet<String>();
-		while(typeStatements.hasNext()){
-			Resource type = typeStatements.next().getObject();
-			assertTrue(type instanceof UriRef);
-			typeStrings.add(((UriRef)type).getUnicodeString());
-		}
-		return typeStrings;
-	}
 
-	/**
-	 * Interface to test primitive Datatypes and Uri links.
+        Collection<TestRdfEntity> testEntities = entity2.getTestEntities();
+        assertTrue(testEntities.isEmpty()); //check that entity is not in the collection
+        Set<UriRef> testUriRefs = new HashSet<UriRef>();
+        int NUM = 10;
+        for (int i=0;i<NUM;i++){
+            UriRef testNode = new UriRef(testUri+':'+'_'+i);
+            testUriRefs.add(testNode);
+            testEntities.add(factory.getProxy(testNode, TestRdfEntity.class));
+        }
+        //now get a new collection and test if the added entities are there
+        Collection<UriRef> resultUriRefs = new ArrayList<UriRef>(); //add to a list to check for duplicates
+        for (TestRdfEntity e : entity2.getTestEntities()){
+            assertTrue(e.getId() instanceof UriRef); //I used UriRefs for the generation ...
+            resultUriRefs.add((UriRef)e.getId());
+        }
+        //now cross check
+        assertTrue(testUriRefs.containsAll(resultUriRefs));
+        assertTrue(resultUriRefs.containsAll(testUriRefs));
+        //now one could try to remove some Elements ...
+        // ... but things like that are already tested for Integers in testPrimitiveDataTypes
+    }
+
+    @Test
+    public void testInterfaceHierarchies() throws Exception {
+        MGraph graph = new SimpleMGraph();
+        RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
+        String testUri = "urn:RdfEntityFactoryTest:SubTestEntity";
+        String testUri2 = "urn:RdfEntityFactoryTest:TestEntity2";
+        String testUri3 = "urn:RdfEntityFactoryTest:TestEntity";
+        UriRef node = new UriRef(testUri);
+        UriRef node2 = new UriRef(testUri2);
+        UriRef node3 = new UriRef(testUri3);
+        SubTestRdfEntity entity = factory.getProxy(node, SubTestRdfEntity.class);
+        TestRdfEntity entity2 = factory.getProxy(node2, TestRdfEntity.class,new Class<?>[]{SubTestRdfEntity.class,TestRdfEntity2.class});
+        TestRdfEntity entity3 = factory.getProxy(node3, TestRdfEntity.class);
+
+        //Start with checking the types for entity2
+        //first type cast to the hierarchy
+        assertTrue(entity instanceof TestRdfEntity);
+        assertTrue(entity instanceof RdfEntity);
+
+        // test if the rdf:type triples are present in the MGraph
+        Set<String> typeStrings = getRdfTypes(graph, node);
+        assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
+        assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
+
+        typeStrings = null;
+        //now the same for entity2
+        //first type cast to the hierarchy
+        assertTrue(entity2 instanceof SubTestRdfEntity);
+        assertTrue(entity2 instanceof TestRdfEntity2);
+        assertTrue(entity2 instanceof RdfEntity);
+
+        // test if the rdf:type triples are present in the MGraph
+        typeStrings = getRdfTypes(graph, node2);
+        assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
+        assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
+        assertTrue(typeStrings.contains(TestRdfEntity2.class.getAnnotation(Rdf.class).id()));
+
+        typeStrings = null;
+        //Now check Entity3
+        assertTrue(!(entity3 instanceof SubTestRdfEntity));
+        assertTrue(entity3 instanceof TestRdfEntity);
+
+        //Now create an new Entity for the same Node that implements SubEntity2
+        SubTestRdfEntity entity4 = factory.getProxy(node3, SubTestRdfEntity.class);
+        //check if entity4 implements SubTestRefEntity
+        assertTrue(entity4 instanceof SubTestRdfEntity);
+
+        //now check if the additional type was added to node3
+        typeStrings = getRdfTypes(graph, node3);
+        assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
+        assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
+        //and that entity3 still dose not implement SubTestEntity
+        // ... because adding/removing rdf:type triples in the graph can not affect existing proxy instances!
+        assertTrue(!(entity3 instanceof SubTestRdfEntity));
+    }
+
+    private static Set<String> getRdfTypes(MGraph graph, UriRef node) {
+        Iterator<Triple> typeStatements = graph.filter(node, Properties.RDF_TYPE, null);
+        Set<String> typeStrings = new HashSet<String>();
+        while(typeStatements.hasNext()){
+            Resource type = typeStatements.next().getObject();
+            assertTrue(type instanceof UriRef);
+            typeStrings.add(((UriRef)type).getUnicodeString());
+        }
+        return typeStrings;
+    }
+
+    /**
+     * Interface to test primitive Datatypes and Uri links.
      *
-	 * @author westei
-	 */
-	@Rdf(id="urn:test:TestRdfEntity")
-	public static interface TestRdfEntity extends RdfEntity{
-		@Rdf(id="urn:test:Integer")
-		Integer getInteger();
-		@Rdf(id="urn:test:Integer")
-		void setInteger(Integer i);
-		
-		@Rdf(id="urn:test:Integers")
-		Collection<Integer> getIntegers();
-		@Rdf(id="urn:test:Integers")
-		void setIntegers(Collection<Integer> is);
-
-		@Rdf(id="urn:test:Long")
-		Long getLong();
-		@Rdf(id="urn:test:Long")
-		void setLong(Long l);
-		
-		@Rdf(id="urn:test:Float")
-		Float getFloat();
-		@Rdf(id="urn:test:Float")
-		void setFloat(Float f);
-		
-		@Rdf(id="urn:test:Double")
-		Double getDouble();
-		@Rdf(id="urn:test:Double")
-		void setDouble(Double d);
-
-		@Rdf(id="urn:test:Boolean")
-		Boolean getBoolean();
-		@Rdf(id="urn:test:Boolean")
-		void setBoolean(Boolean b);
-
-		@Rdf(id="urn:test:Date")
-		Date getDate();
-		@Rdf(id="urn:test:Date")
-		void setDate(Date d);
-		
-		@Rdf(id="urn:test:String")
-		String getString();
-		@Rdf(id="urn:test:String")
-		void setString(String string);
-
-		@Rdf(id="urn:test:Calendar")
-		Calendar getCalendar();
-		@Rdf(id="urn:test:Calendar")
-		void setCalendar(Calendar d);
-		
-		@Rdf(id="urn:test:URI")
-		URI getURI();
-		@Rdf(id="urn:test:URI")
-		void setURI(URI uri);
-
-		@Rdf(id="urn:test:URL")
-		URL getURL();
-		@Rdf(id="urn:test:URL")
-		void setURL(URL uri);
-	
-		@Rdf(id="urn:test:UriRef")
-		UriRef getUriRef();
-		@Rdf(id="urn:test:UriRef")
-		void setUriRef(UriRef uriRef);
-	}
+     * @author westei
+     */
+    @Rdf(id="urn:test:TestRdfEntity")
+    public static interface TestRdfEntity extends RdfEntity{
+        @Rdf(id="urn:test:Integer")
+        Integer getInteger();
+        @Rdf(id="urn:test:Integer")
+        void setInteger(Integer i);
+
+        @Rdf(id="urn:test:Integers")
+        Collection<Integer> getIntegers();
+        @Rdf(id="urn:test:Integers")
+        void setIntegers(Collection<Integer> is);
+
+        @Rdf(id="urn:test:Long")
+        Long getLong();
+        @Rdf(id="urn:test:Long")
+        void setLong(Long l);
+
+        @Rdf(id="urn:test:Float")
+        Float getFloat();
+        @Rdf(id="urn:test:Float")
+        void setFloat(Float f);
+
+        @Rdf(id="urn:test:Double")
+        Double getDouble();
+        @Rdf(id="urn:test:Double")
+        void setDouble(Double d);
+
+        @Rdf(id="urn:test:Boolean")
+        Boolean getBoolean();
+        @Rdf(id="urn:test:Boolean")
+        void setBoolean(Boolean b);
+
+        @Rdf(id="urn:test:Date")
+        Date getDate();
+        @Rdf(id="urn:test:Date")
+        void setDate(Date d);
+
+        @Rdf(id="urn:test:String")
+        String getString();
+        @Rdf(id="urn:test:String")
+        void setString(String string);
+
+        @Rdf(id="urn:test:Calendar")
+        Calendar getCalendar();
+        @Rdf(id="urn:test:Calendar")
+        void setCalendar(Calendar d);
+
+        @Rdf(id="urn:test:URI")
+        URI getURI();
+        @Rdf(id="urn:test:URI")
+        void setURI(URI uri);
+
+        @Rdf(id="urn:test:URL")
+        URL getURL();
+        @Rdf(id="urn:test:URL")
+        void setURL(URL uri);
+
+        @Rdf(id="urn:test:UriRef")
+        UriRef getUriRef();
+        @Rdf(id="urn:test:UriRef")
+        void setUriRef(UriRef uriRef);
+    }
 
-	/**
-	 * Interface to test relations to other RdfEntities.
+    /**
+     * Interface to test relations to other RdfEntities.
      *
-	 * @author westei
-	 */
-	@Rdf(id="urn:test:TestRdfEntity2")
-	public static interface TestRdfEntity2 extends RdfEntity {
-		@Rdf(id="urn:test:RdfEntity")
-		TestRdfEntity getTestEntity();
-		@Rdf(id="urn:test:RdfEntity")
-		void setTestEntity(TestRdfEntity testRdfEntity);
-		
-		@Rdf(id="urn:test:RdfEntities")
-		Collection<TestRdfEntity> getTestEntities();
-		@Rdf(id="urn:test:RdfEntities")
-		void setTestEntities(Collection<TestRdfEntity> entities);
-	}
+     * @author westei
+     */
+    @Rdf(id="urn:test:TestRdfEntity2")
+    public static interface TestRdfEntity2 extends RdfEntity {
+        @Rdf(id="urn:test:RdfEntity")
+        TestRdfEntity getTestEntity();
+        @Rdf(id="urn:test:RdfEntity")
+        void setTestEntity(TestRdfEntity testRdfEntity);
+
+        @Rdf(id="urn:test:RdfEntities")
+        Collection<TestRdfEntity> getTestEntities();
+        @Rdf(id="urn:test:RdfEntities")
+        void setTestEntities(Collection<TestRdfEntity> entities);
+    }
 
-	/**
-	 * Interface to test extends relations between Interfaces.
+    /**
+     * Interface to test extends relations between Interfaces.
      *
-	 * @author westei
-	 */
-	@Rdf(id="urn:test:SubTestRdfEntity")
-	public static interface SubTestRdfEntity extends TestRdfEntity {
-		@Rdf(id="urn:test:RdfEntity2")
-		TestRdfEntity2 getTestEntity2();
-		@Rdf(id="urn:test:RdfEntity2")
-		void setTestEntity2(TestRdfEntity2 entity2);
-	}
-
-//	public static void main(String[] args) throws Exception{
-//		new RdfEntityFactoryTest().testTypeStatements();
-//	}
+     * @author westei
+     */
+    @Rdf(id="urn:test:SubTestRdfEntity")
+    public static interface SubTestRdfEntity extends TestRdfEntity {
+        @Rdf(id="urn:test:RdfEntity2")
+        TestRdfEntity2 getTestEntity2();
+        @Rdf(id="urn:test:RdfEntity2")
+        void setTestEntity2(TestRdfEntity2 entity2);
+    }
+
+//    public static void main(String[] args) throws Exception{
+//        new RdfEntityFactoryTest().testTypeStatements();
+//    }
 }

Modified: incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/TestEnhancementInterfaces.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/TestEnhancementInterfaces.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/TestEnhancementInterfaces.java (original)
+++ incubator/stanbol/trunk/fise/generic/servicesapi/src/test/java/eu/iksproject/fise/serviceapi/helper/TestEnhancementInterfaces.java Sun Dec 12 16:10:48 2010
@@ -34,134 +34,134 @@ import eu.iksproject.fise.servicesapi.rd
  */
 public class TestEnhancementInterfaces {
 
-	public static final String SINGLE_SENTENCE = "Dr. Patrick Marshall (1869 - November 1950) was a"
+    public static final String SINGLE_SENTENCE = "Dr. Patrick Marshall (1869 - November 1950) was a"
         + " geologist who lived in New Zealand and worked at the University of Otago.";
-	public static final UriRef TEST_ENHANCEMENT_ENGINE_URI = new UriRef("urn:test:dummyEnhancementEngine");
+    public static final UriRef TEST_ENHANCEMENT_ENGINE_URI = new UriRef("urn:test:dummyEnhancementEngine");
 
-	public static ContentItem wrapAsContentItem(final String id, final String text) {
+    public static ContentItem wrapAsContentItem(final String id, final String text) {
         return new ContentItem() {
             SimpleMGraph metadata = new SimpleMGraph();
             public InputStream getStream() { return new ByteArrayInputStream(text.getBytes());}
             public String getMimeType() { return "text/plain"; }
-	        public MGraph getMetadata() { return metadata; }
-	        public String getId() { return id; }
-	    };
-	}
-
-	@Test
-	public void testEnhancementInterfaces() throws Exception {
-		ContentItem ci = wrapAsContentItem("urn:contentItem-"
+            public MGraph getMetadata() { return metadata; }
+            public String getId() { return id; }
+        };
+    }
+
+    @Test
+    public void testEnhancementInterfaces() throws Exception {
+        ContentItem ci = wrapAsContentItem("urn:contentItem-"
                 + EnhancementEngineHelper.randomUUID(),SINGLE_SENTENCE);
-		UriRef ciUri = new UriRef(ci.getId());
-		RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
-		long start = System.currentTimeMillis();
-		//create an Text Annotation representing an extracted Person
-		TextAnnotation personAnnotation = factory.getProxy(
-				createEnhancementURI(), TextAnnotation.class);
-		personAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
-		personAnnotation.setCreated(new Date());
-		personAnnotation.setExtractedFrom(ciUri);
-		personAnnotation.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/text#Person"));
-		personAnnotation.setConfidence(0.8);
-		personAnnotation.setSelectedText("Patrick Marshall");
-		personAnnotation.setStart(SINGLE_SENTENCE.indexOf(personAnnotation.getSelectedText()));
-		personAnnotation.setEnd(personAnnotation.getStart()+personAnnotation.getSelectedText().length());
-		personAnnotation.setSelectionContext(SINGLE_SENTENCE);
-		
-		//create an Text Annotation representing an extracted Location
-		TextAnnotation locationAnnotation = factory.getProxy(
-				createEnhancementURI(),	TextAnnotation.class);
-		locationAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
-		locationAnnotation.setCreated(new Date());
-		locationAnnotation.setExtractedFrom(ciUri);
-		locationAnnotation.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/text#Location"));
-		locationAnnotation.setConfidence(0.78);
-		locationAnnotation.setSelectedText("New Zealand");
-		locationAnnotation.setStart(SINGLE_SENTENCE.indexOf(locationAnnotation.getSelectedText()));
-		locationAnnotation.setEnd(locationAnnotation.getStart()+locationAnnotation.getSelectedText().length());
-		locationAnnotation.setSelectionContext(SINGLE_SENTENCE);
-		
-		//create an Text Annotation representing an extracted Organisation
-		TextAnnotation orgAnnotation = factory.getProxy(
-				createEnhancementURI(),	TextAnnotation.class);
-		orgAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
-		orgAnnotation.setCreated(new Date());
-		orgAnnotation.setExtractedFrom(ciUri);
-		orgAnnotation.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/text#Organisation"));
-		orgAnnotation.setConfidence(0.78);
-		orgAnnotation.setSelectedText("University of Otago");
-		orgAnnotation.setStart(SINGLE_SENTENCE.indexOf(orgAnnotation.getSelectedText()));
-		orgAnnotation.setEnd(orgAnnotation.getStart()+orgAnnotation.getSelectedText().length());
-		orgAnnotation.setSelectionContext(SINGLE_SENTENCE);
-		
-		// create an Entity Annotation for the person TextAnnotation
-		EntityAnnotation patrickMarshall = factory.getProxy(
-				createEnhancementURI(), EntityAnnotation.class);
-		patrickMarshall.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
-		patrickMarshall.setCreated(new Date());
-		patrickMarshall.setExtractedFrom(ciUri);
-		patrickMarshall.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/entity#Entity"));
-		patrickMarshall.setConfidence(0.56);
-		patrickMarshall.getRelations().add(personAnnotation);
-		patrickMarshall.setEntityLabel("Patrick Marshall");
-		patrickMarshall.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/patrick_marshall"));
-		patrickMarshall.getEntityTypes().addAll(Arrays.asList(
-						new UriRef("http://rdf.freebase.com/ns/people.person"),
-						new UriRef("http://rdf.freebase.com/ns/common.topic"),
-						new UriRef("http://rdf.freebase.com/ns/education.academic")));
-		// and an other for New Zealand
-		EntityAnnotation newZealand = factory.getProxy(
-				createEnhancementURI(), EntityAnnotation.class);
-		newZealand.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
-		newZealand.setCreated(new Date());
-		newZealand.setExtractedFrom(ciUri);
-		newZealand.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/entity#Entity"));
-		newZealand.setConfidence(0.98);
-		newZealand.getRelations().add(locationAnnotation);
-		newZealand.setEntityLabel("New Zealand");
-		newZealand.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/new_zealand"));
-		newZealand.getEntityTypes().addAll(Arrays.asList(
-				new UriRef("http://rdf.freebase.com/ns/location.location"),
-				new UriRef("http://rdf.freebase.com/ns/common.topic"),
-				new UriRef("http://rdf.freebase.com/ns/location.country")));
-		
-		// and an other option for New Zealand
-		EntityAnnotation airNewZealand = factory.getProxy(
-				createEnhancementURI(), EntityAnnotation.class);
-		airNewZealand.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
-		airNewZealand.setCreated(new Date());
-		airNewZealand.setExtractedFrom(ciUri);
-		airNewZealand.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/entity#Entity"));
-		airNewZealand.setConfidence(0.36);
-		airNewZealand.getRelations().add(locationAnnotation);
-		airNewZealand.setEntityLabel("New Zealand");
-		airNewZealand.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/air_new_zealand"));
-		airNewZealand.getEntityTypes().addAll(Arrays.asList(
-				new UriRef("http://rdf.freebase.com/ns/business.sponsor"),
-				new UriRef("http://rdf.freebase.com/ns/common.topic"),
-				new UriRef("http://rdf.freebase.com/ns/travel.transport_operator"),
-				new UriRef("http://rdf.freebase.com/ns/aviation.airline"),
-				new UriRef("http://rdf.freebase.com/ns/aviation.aircraft_owner"),
-				new UriRef("http://rdf.freebase.com/ns/business.employer"),
-				new UriRef("http://rdf.freebase.com/ns/freebase.apps.hosts.com.appspot.acre.juggle.juggle"),
-				new UriRef("http://rdf.freebase.com/ns/business.company")));
-		System.out.println("creation time "+(System.currentTimeMillis()-start)+"ms");
+        UriRef ciUri = new UriRef(ci.getId());
+        RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
+        long start = System.currentTimeMillis();
+        //create an Text Annotation representing an extracted Person
+        TextAnnotation personAnnotation = factory.getProxy(
+                createEnhancementURI(), TextAnnotation.class);
+        personAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
+        personAnnotation.setCreated(new Date());
+        personAnnotation.setExtractedFrom(ciUri);
+        personAnnotation.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/text#Person"));
+        personAnnotation.setConfidence(0.8);
+        personAnnotation.setSelectedText("Patrick Marshall");
+        personAnnotation.setStart(SINGLE_SENTENCE.indexOf(personAnnotation.getSelectedText()));
+        personAnnotation.setEnd(personAnnotation.getStart()+personAnnotation.getSelectedText().length());
+        personAnnotation.setSelectionContext(SINGLE_SENTENCE);
+
+        //create an Text Annotation representing an extracted Location
+        TextAnnotation locationAnnotation = factory.getProxy(
+                createEnhancementURI(),    TextAnnotation.class);
+        locationAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
+        locationAnnotation.setCreated(new Date());
+        locationAnnotation.setExtractedFrom(ciUri);
+        locationAnnotation.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/text#Location"));
+        locationAnnotation.setConfidence(0.78);
+        locationAnnotation.setSelectedText("New Zealand");
+        locationAnnotation.setStart(SINGLE_SENTENCE.indexOf(locationAnnotation.getSelectedText()));
+        locationAnnotation.setEnd(locationAnnotation.getStart()+locationAnnotation.getSelectedText().length());
+        locationAnnotation.setSelectionContext(SINGLE_SENTENCE);
+
+        //create an Text Annotation representing an extracted Organisation
+        TextAnnotation orgAnnotation = factory.getProxy(
+                createEnhancementURI(),    TextAnnotation.class);
+        orgAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
+        orgAnnotation.setCreated(new Date());
+        orgAnnotation.setExtractedFrom(ciUri);
+        orgAnnotation.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/text#Organisation"));
+        orgAnnotation.setConfidence(0.78);
+        orgAnnotation.setSelectedText("University of Otago");
+        orgAnnotation.setStart(SINGLE_SENTENCE.indexOf(orgAnnotation.getSelectedText()));
+        orgAnnotation.setEnd(orgAnnotation.getStart()+orgAnnotation.getSelectedText().length());
+        orgAnnotation.setSelectionContext(SINGLE_SENTENCE);
+
+        // create an Entity Annotation for the person TextAnnotation
+        EntityAnnotation patrickMarshall = factory.getProxy(
+                createEnhancementURI(), EntityAnnotation.class);
+        patrickMarshall.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
+        patrickMarshall.setCreated(new Date());
+        patrickMarshall.setExtractedFrom(ciUri);
+        patrickMarshall.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/entity#Entity"));
+        patrickMarshall.setConfidence(0.56);
+        patrickMarshall.getRelations().add(personAnnotation);
+        patrickMarshall.setEntityLabel("Patrick Marshall");
+        patrickMarshall.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/patrick_marshall"));
+        patrickMarshall.getEntityTypes().addAll(Arrays.asList(
+                        new UriRef("http://rdf.freebase.com/ns/people.person"),
+                        new UriRef("http://rdf.freebase.com/ns/common.topic"),
+                        new UriRef("http://rdf.freebase.com/ns/education.academic")));
+        // and an other for New Zealand
+        EntityAnnotation newZealand = factory.getProxy(
+                createEnhancementURI(), EntityAnnotation.class);
+        newZealand.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
+        newZealand.setCreated(new Date());
+        newZealand.setExtractedFrom(ciUri);
+        newZealand.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/entity#Entity"));
+        newZealand.setConfidence(0.98);
+        newZealand.getRelations().add(locationAnnotation);
+        newZealand.setEntityLabel("New Zealand");
+        newZealand.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/new_zealand"));
+        newZealand.getEntityTypes().addAll(Arrays.asList(
+                new UriRef("http://rdf.freebase.com/ns/location.location"),
+                new UriRef("http://rdf.freebase.com/ns/common.topic"),
+                new UriRef("http://rdf.freebase.com/ns/location.country")));
+
+        // and an other option for New Zealand
+        EntityAnnotation airNewZealand = factory.getProxy(
+                createEnhancementURI(), EntityAnnotation.class);
+        airNewZealand.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
+        airNewZealand.setCreated(new Date());
+        airNewZealand.setExtractedFrom(ciUri);
+        airNewZealand.getDcType().add(new UriRef("http://fise.iks-project.eu/cv/annotatation-types/entity#Entity"));
+        airNewZealand.setConfidence(0.36);
+        airNewZealand.getRelations().add(locationAnnotation);
+        airNewZealand.setEntityLabel("New Zealand");
+        airNewZealand.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/air_new_zealand"));
+        airNewZealand.getEntityTypes().addAll(Arrays.asList(
+                new UriRef("http://rdf.freebase.com/ns/business.sponsor"),
+                new UriRef("http://rdf.freebase.com/ns/common.topic"),
+                new UriRef("http://rdf.freebase.com/ns/travel.transport_operator"),
+                new UriRef("http://rdf.freebase.com/ns/aviation.airline"),
+                new UriRef("http://rdf.freebase.com/ns/aviation.aircraft_owner"),
+                new UriRef("http://rdf.freebase.com/ns/business.employer"),
+                new UriRef("http://rdf.freebase.com/ns/freebase.apps.hosts.com.appspot.acre.juggle.juggle"),
+                new UriRef("http://rdf.freebase.com/ns/business.company")));
+        System.out.println("creation time "+(System.currentTimeMillis()-start)+"ms");
 
-		//now test the enhancement
-		int numberOfTextAnnotations = checkAllTextAnnotations(ci.getMetadata());
+        //now test the enhancement
+        int numberOfTextAnnotations = checkAllTextAnnotations(ci.getMetadata());
         assertEquals(3, numberOfTextAnnotations);
 
-		int numberOfEntityAnnotations = checkAllEntityAnnotations(ci.getMetadata());
+        int numberOfEntityAnnotations = checkAllEntityAnnotations(ci.getMetadata());
         assertEquals(3, numberOfEntityAnnotations);
-	}
+    }
 
-	private static UriRef createEnhancementURI() {
-		//TODO: add some Utility to create Instances to the RdfEntityFactory
-		//      this should create a new URI by some default Algorithm 
+    private static UriRef createEnhancementURI() {
+        //TODO: add some Utility to create Instances to the RdfEntityFactory
+        //      this should create a new URI by some default Algorithm
         return new UriRef("urn:enhancement-" + EnhancementEngineHelper.randomUUID());
-	}
+    }
 
-	/*
+    /*
      * -----------------------------------------------------------------------
      * Helper Methods to check Text and EntityAnnotations
      * -----------------------------------------------------------------------

Modified: incubator/stanbol/trunk/fise/generic/standalone/src/main/java/eu/iksproject/fise/standalone/impl/MainServlet.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/generic/standalone/src/main/java/eu/iksproject/fise/standalone/impl/MainServlet.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/generic/standalone/src/main/java/eu/iksproject/fise/standalone/impl/MainServlet.java (original)
+++ incubator/stanbol/trunk/fise/generic/standalone/src/main/java/eu/iksproject/fise/standalone/impl/MainServlet.java Sun Dec 12 16:10:48 2010
@@ -3,7 +3,6 @@ package eu.iksproject.fise.standalone.im
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.Iterator;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -140,4 +139,4 @@ public class MainServlet extends HttpSer
         log.info("Servlet unregistered from {}", ALIAS);
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/Autotagger.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/Autotagger.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/Autotagger.java (original)
+++ incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/Autotagger.java Sun Dec 12 16:10:48 2010
@@ -325,4 +325,4 @@ public class Autotagger {
         mlt.setMaxQueryTerms(maxSuggestions);
         return mlt.retrieveInterestingTerms(new StringReader(text));
     }
-}
\ No newline at end of file
+}

Modified: incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/TagInfo.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/TagInfo.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/TagInfo.java (original)
+++ incubator/stanbol/trunk/fise/iks-autotagging/src/main/java/eu/iksproject/autotagging/TagInfo.java Sun Dec 12 16:10:48 2010
@@ -34,9 +34,9 @@ public class TagInfo {
     private final String[] type;
 
     public TagInfo(String id, String label, String[] type, double confidence) {
-    	if (id == null){
-    		throw new IllegalArgumentException("Parameter id MUST NOT be NULL");
-    	}
+        if (id == null){
+            throw new IllegalArgumentException("Parameter id MUST NOT be NULL");
+        }
         this.id = id;
         this.label = label;
         this.type = type;
@@ -52,31 +52,31 @@ public class TagInfo {
      */
     @Override
     public boolean equals(Object obj) {
-    	return obj != null && obj instanceof TagInfo && ((TagInfo)obj).id.equals(id) && ((TagInfo)obj).confidence.equals(confidence);
+        return obj != null && obj instanceof TagInfo && ((TagInfo)obj).id.equals(id) && ((TagInfo)obj).confidence.equals(confidence);
     }
 
     public final String getId() {
-		return id;
-	}
+        return id;
+    }
+
+    public final String getLabel() {
+        return label;
+    }
 
-	public final String getLabel() {
-		return label;
-	}
-
-	public final Double getConfidence() {
-		return confidence;
-	}
-
-	public final String[] getType() {
-		return type;
-	}
+    public final Double getConfidence() {
+        return confidence;
+    }
 
-	/**
+    public final String[] getType() {
+        return type;
+    }
+
+    /**
      * Implementation based on the id and confidence property
      */
     @Override
     public int hashCode() {
-    	return id.hashCode() + confidence.hashCode();
+        return id.hashCode() + confidence.hashCode();
     }
 
 }