Note: forwarded message attached.
Take the Internet to Go: Yahoo!Go puts the Internet
in your pocket: mail, news, photos & more.
Hi people,
I have a problem using the method getRelatedEntities, I attached
the source.
List relEntities = apiEntity.getRelatedEntities(listEntities,1);
By the way, what's the meaning of the 'count'
(second) parameter ?
Error in runtime:
java.lang.ClassCastException: org.openrdf.model.impl.URIImpl cannot be
cast to java.lang.String
at
com.ontotext.kim.proton.KIMEntityAPIImpl.getRelatedEntities(KIMEntityAPIImpl.java:525)
at
com.ontotext.kim.proton.KIMEntityAPIImpl.getRelatedEntities(KIMEntityAPIImpl.java:500)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
.........
.........
Thank you,
Alvaro
Choose the right car based on your needs. Check out Yahoo!
Autos new Car Finder tool.
package utiles_kim;
import com.ontotext.kim.client.*;
import com.ontotext.kim.client.query.*;
import com.ontotext.kim.client.model.*;
import com.ontotext.kim.client.proton.*;
import java.util.*;
import java.util.Iterator;
import java.lang.String;
public class RelatedEntitiesProof
{
public static final String INDEX_URL = "c:/kim-platform-1.7.12.15/context/default/populated/index-and-store";
public static final String PERSIST_URL = "lucene:/c:/kim-platform-1.7.12.15/context/default/populated/index-and-store";
public final static String INDEX_AND_PERSIST_URL = "lucene:/c:/kim-platform-1.7.12.15/context/default/populated/index-and-store";
private static QueryAPI apiQuery = null;
private static EntityAPI apiEntity = null;
public static void main(String[] args)
{
try
{
KIMService serviceKim = GetService.from();
spit("KIM Server connected.");
// obtain CorporaAPI and SemanticAnnotationAPI components
apiQuery = serviceKim.getQueryAPI();
apiEntity = serviceKim.getEntityAPI();
// ----------------------------------------------------------------------------------
// construct semantic query 1
// ----------------------------------------------------------------------------------
SemanticQuery seq1 = new SemanticQueryImpl();
seq1.addRequestedVar("CONT"); // add variable PERS of class Person
seq1.setClass("CONT", WKBConstants.CLASS_CONTINENT);
// ----------------------------------------------------------------------------------
// add name and pattern restrictions for seq1
// ----------------------------------------------------------------------------------
seq1.addNameRestriction("CONT", seq1.COMPARE_STYLE_CONTAINS, "Europe");
// restrict position to contain 'manager'
EntityQueryResult resEntities = apiQuery.getEntities(seq1);
spit("[ Entity Result (begin) ]");
while (resEntities.hasNext()) {
spit(" b- ---------------------------");
List listEntities = resEntities.nextEntityList();
spit("count list " + listEntities.size());
for (int i = 0; i <= listEntities.size(); i += 2) {
String uri = String.valueOf(listEntities.get(i));
Entity ent = apiEntity.getEntity(uri);
// Aliases de la entidad
Iterator entIterator = ent.getAliases();
//spit("[ Document's Annotations (begin) ]");
while (entIterator.hasNext()) {
String key1 = (String) entIterator.next();
spit(" = GetAliases [" + key1 + "] :");
}
List relEntities = apiEntity.getRelatedEntities(listEntities,1);
}
}
}
catch (Exception x)
{
x.printStackTrace();
}
}
public static void spit(Object o)
{
System.out.println(o);
}
}
_______________________________________________
NOTE: Please REPLY TO ALL to ensure that your reply reaches all members of this mailing list.
KIM-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion_ontotext.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.484 / Virus Database: 269.11.19/956 - Release Date: 8/16/2007 9:48 AM