tags:

views:

17

answers:

1

I tried to add the data type property value in to my model..it works fine..when i wrote like this:

Literal link = model.createTypedLiteral("www.google.lk", XSDDatatype.XSDstring);
Statement value = model.createStatement(ind, pro, link);
model.add(value);

when i pass it as a argument:

Literal link = model.createTypedLiteral(onto.getlink(), XSDDatatype.XSDstring);

it will give an error:

org.apache.jasper.JasperException: Exception in JSP: /Onto web.jsp:54

51:       OntClass cul = model.getOntClass("http://www.owl-ontologies.com/Ontology1275995702.owl#srilanka");
52:    Individual ind = model.createIndividual("http://www.owl-ontologies.com/Ontology1275995702.owl#"+ onto.getIndividualname(),cul);
53:   
54:    Literal link = model.createTypedLiteral(onto.getLink(), XSDDatatype.XSDstring);
55:    Statement value = model.createStatement(ind, pro, link);
56:    model.add(value);
57:      


Stacktrace:
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause 

java.lang.NullPointerException
 com.hp.hpl.jena.graph.impl.LiteralLabelImpl.getDefaultHashcode(LiteralLabelImpl.java:429)
 com.hp.hpl.jena.datatypes.BaseDatatype.getHashCode(BaseDatatype.java:142)
 com.hp.hpl.jena.graph.impl.LiteralLabelImpl.hashCode(LiteralLabelImpl.java:419)
 com.hp.hpl.jena.graph.NodeCache.get(NodeCache.java:64)
 com.hp.hpl.jena.graph.Node.create(Node.java:285)
 com.hp.hpl.jena.graph.Node.createLiteral(Node.java:54)
 com.hp.hpl.jena.graph.Node.createLiteral(Node.java:91)
 com.hp.hpl.jena.rdf.model.impl.ModelCom.createTypedLiteral(ModelCom.java:545)
 org.apache.jsp.Onto_0020web_jsp._jspService(Onto_0020web_jsp.java:124)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

can some one help me to solve this...

thanks

A: 

Probably onto.getlink() returns null? It's not allowed to pass null as the first argument to Model.createTypedLiteral(value, type).

cygri