vivo-project / VIVO

VIVO is an extensible semantic web application for research discovery and showcasing scholarly work
http://vivoweb.org
BSD 3-Clause "New" or "Revised" License
205 stars 128 forks source link

VIVO-705: Ontology list will not display due to Jena QueryParseException #2394

Closed chenejac closed 6 years ago

chenejac commented 10 years ago

Jon Corson-Rikert (Migrated from VIVO-705) said:

After trying to enter the SKOS ontology as a new ontology in a Vitro instance, using the URL http://www.w3.org/2004/02/skos/core#, I see the following error -- due to the #, or an extra space after the #? --

HTTP Status 500 - Encountered " "<" "< "" at line 2, column 1.

type Exception report

message Encountered " "<" "< "" at line 2, column 1.

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.hp.hpl.jena.query.QueryParseException: Encountered " "<" "< "" at line 2, column 1. Was expecting one of:

... ... ... ... ... ... "select" ... "graph" ... "optional" ... "minus" ... "bind" ... "service" ... "let" ... "fetch" ... "exists" ... ... "filter" ... "true" ... "false" ... ... ... ... ... ... ... ... ... ... ... ... ... ... "(" ... ... "{" ... "}" ... "[" ... ... com.hp.hpl.jena.sparql.lang.ParserARQ.perform(ParserARQ.java:86) com.hp.hpl.jena.sparql.lang.ParserARQ.parse(ParserARQ.java:39) com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:132) com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:69) com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:40) edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceImpl.createQuery(RDFServiceImpl.java:279) edu.cornell.mannlib.vitro.webapp.rdfservice.impl.jena.RDFServiceJena.sparqlAskQuery(RDFServiceJena.java:380) edu.cornell.mannlib.vitro.webapp.rdfservice.filter.LanguageFilteringRDFService.sparqlAskQuery(LanguageFilteringRDFService.java:309) edu.cornell.mannlib.vitro.webapp.dao.jena.RDFServiceGraph.execAsk(RDFServiceGraph.java:387) edu.cornell.mannlib.vitro.webapp.dao.jena.RDFServiceGraph.contains(RDFServiceGraph.java:168) edu.cornell.mannlib.vitro.webapp.dao.jena.RDFServiceGraph.contains(RDFServiceGraph.java:147) com.hp.hpl.jena.graph.compose.MultiUnion.graphBaseContains(MultiUnion.java:144) com.hp.hpl.jena.graph.impl.GraphBase.contains(GraphBase.java:270) com.hp.hpl.jena.graph.impl.GraphBase.contains(GraphBase.java:296) com.hp.hpl.jena.ontology.impl.OWLProfile$10.doCheck(OWLProfile.java:394) com.hp.hpl.jena.ontology.impl.OWLProfile.isSupported(OWLProfile.java:199) com.hp.hpl.jena.ontology.impl.OntologyImpl$1.canWrap(OntologyImpl.java:74) com.hp.hpl.jena.ontology.impl.OntologyImpl$1.wrap(OntologyImpl.java:62) com.hp.hpl.jena.enhanced.Personality.newInstance(Personality.java:84) com.hp.hpl.jena.enhanced.EnhGraph.getNodeAs(EnhGraph.java:130) com.hp.hpl.jena.ontology.impl.OntModelImpl$SubjectNodeAs.map1(OntModelImpl.java:3040) com.hp.hpl.jena.ontology.impl.OntModelImpl$SubjectNodeAs.map1(OntModelImpl.java:3033) com.hp.hpl.jena.util.iterator.Map1Iterator.next(Map1Iterator.java:35) com.hp.hpl.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:68) com.hp.hpl.jena.util.iterator.UniqueExtendedIterator.nextIfNew(UniqueExtendedIterator.java:61) com.hp.hpl.jena.util.iterator.UniqueExtendedIterator.hasNext(UniqueExtendedIterator.java:69) edu.cornell.mannlib.vitro.webapp.dao.jena.OntologyDaoJena.getAllOntologies(OntologyDaoJena.java:92) edu.cornell.mannlib.vitro.webapp.controller.edit.listing.OntologiesListingController.doGet(OntologiesListingController.java:36) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet.service(VitroHttpServlet.java:70) edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter.doNonDisplayPage(PageRoutingFilter.java:110) edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter.doFilter(PageRoutingFilter.java:101) edu.cornell.mannlib.vitro.webapp.filters.RequestModelsPrep.doFilter(RequestModelsPrep.java:115) edu.cornell.mannlib.vitro.webapp.filters.URLRewriterFilter.doFilter(URLRewriterFilter.java:38) edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter.doFilter(JSessionStripFilter.java:60) edu.cornell.mannlib.vitro.webapp.filters.CachingResponseFilter.produceBasicResponse(CachingResponseFilter.java:322) edu.cornell.mannlib.vitro.webapp.filters.CachingResponseFilter.doFilter(CachingResponseFilter.java:115) edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionFilter.doFilter(LocaleSelectionFilter.java:62) edu.cornell.mannlib.vitro.webapp.filters.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:25) edu.cornell.mannlib.vitro.webapp.filters.SessionTimeoutLimitingFilter.doFilter(SessionTimeoutLimitingFilter.java:39) edu.cornell.mannlib.vitro.webapp.filters.StartupStatusDisplayFilter.doFilter(StartupStatusDisplayFilter.java:64) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
chenejac commented 10 years ago

Jon Corson-Rikert said:

This then triggers an InvocationTargetException in the PropertyRetryController:

HTTP Status 500 - doPost() encountered InvocationTargetException while invoking PropertyRetryController

type Exception report

message doPost() encountered InvocationTargetException while invoking PropertyRetryController

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.RuntimeException: doPost() encountered InvocationTargetException while invoking PropertyRetryController edu.cornell.mannlib.vedit.controller.EditFrontController.doPost(EditFrontController.java:73) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet.service(VitroHttpServlet.java:70) edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter.doNonDisplayPage(PageRoutingFilter.java:110) edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter.doFilter(PageRoutingFilter.java:101) edu.cornell.mannlib.vitro.webapp.filters.RequestModelsPrep.doFilter(RequestModelsPrep.java:115) edu.cornell.mannlib.vitro.webapp.filters.URLRewriterFilter.doFilter(URLRewriterFilter.java:38) edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter.doFilter(JSessionStripFilter.java:60) edu.cornell.mannlib.vitro.webapp.filters.CachingResponseFilter.produceBasicResponse(CachingResponseFilter.java:322) edu.cornell.mannlib.vitro.webapp.filters.CachingResponseFilter.doFilter(CachingResponseFilter.java:115) edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionFilter.doFilter(LocaleSelectionFilter.java:62) edu.cornell.mannlib.vitro.webapp.filters.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:25) edu.cornell.mannlib.vitro.webapp.filters.SessionTimeoutLimitingFilter.doFilter(SessionTimeoutLimitingFilter.java:39) edu.cornell.mannlib.vitro.webapp.filters.StartupStatusDisplayFilter.doFilter(StartupStatusDisplayFilter.java:64)

root cause

java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) edu.cornell.mannlib.vedit.controller.EditFrontController.doPost(EditFrontController.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet.service(VitroHttpServlet.java:70) edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter.doNonDisplayPage(PageRoutingFilter.java:110) edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter.doFilter(PageRoutingFilter.java:101) edu.cornell.mannlib.vitro.webapp.filters.RequestModelsPrep.doFilter(RequestModelsPrep.java:115) edu.cornell.mannlib.vitro.webapp.filters.URLRewriterFilter.doFilter(URLRewriterFilter.java:38) edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter.doFilter(JSessionStripFilter.java:60) edu.cornell.mannlib.vitro.webapp.filters.CachingResponseFilter.produceBasicResponse(CachingResponseFilter.java:322) edu.cornell.mannlib.vitro.webapp.filters.CachingResponseFilter.doFilter(CachingResponseFilter.java:115) edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionFilter.doFilter(LocaleSelectionFilter.java:62) edu.cornell.mannlib.vitro.webapp.filters.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:25) edu.cornell.mannlib.vitro.webapp.filters.SessionTimeoutLimitingFilter.doFilter(SessionTimeoutLimitingFilter.java:39) edu.cornell.mannlib.vitro.webapp.filters.StartupStatusDisplayFilter.doFilter(StartupStatusDisplayFilter.java:64)

root cause

java.lang.RuntimeException: com.hp.hpl.jena.query.QueryParseException: Encountered " "<" "< "" at line 2, column 1. Was expecting one of: (as above)

chenejac commented 10 years ago

Jim Blake said:

Jon;

How do I reproduce this error?

Jim

chenejac commented 10 years ago

Jon Corson-Rikert said:

Jim -- I've reproduced it in a new Vitro by adding a space after the ontology URI when adding a new ontology. "http://www.w3.org/2004/02/skos/core#" works, but not "http://www.w3.org/2004/02/skos/core " -- so trimming the string and/or trapping for what the last character is and adding a / or if it's not either * or /, as well ensuring that it's a valid URI without spaces, would likely solve this.

This is undoubtedly not new to 1.6.1 but prevents listing ontologies or doing any property editing, so is a serious bug.

chenejac commented 10 years ago

Jim Blake said:

Modified OntologyDaoJena so it will trim leading and trailing blanks from the Ontology URI, at the same time that it removes a final #.

Also, check for URISyntaxException before creating the ontology, so an invalid character will be caught with a reasonable error message.