On 18/08/16 19:39, Azra Nicolas wrote:
Hello Andy,
Thank you very much for your help
the problem is resolved and now I don't have any error but when I run my
class I got several errors concerning jena as:
at
org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.error(ErrorHandlerFactory.java:128)
at
org.apache.jena.riot.lang.LangRDFXML$ErrorHandlerBridge.error(LangRDFXML.java:246)

There is an error in your RDF/XML data.

The error will have been printed out - you don't show it here.

    Andy

at
org.apache.jena.rdfxml.xmlinput.impl.ARPSaxErrorHandler.error(ARPSaxErrorHandler.java:37)
at
org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:196)
at
org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:173)
at
org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:168)
at
org.apache.jena.rdfxml.xmlinput.impl.ParserSupport.warning(ParserSupport.java:194)
at org.apache.jena.rdfxml.xmlinput.states.Frame.warning(Frame.java:55)
at
org.apache.jena.rdfxml.xmlinput.states.WantLiteralValueOrDescription.startElement(WantLiteralValueOrDescription.java:38)
at
org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.startElement(XMLHandler.java:111)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(Unknown
Source)
and I don't have any result of my query. my query is like this:

 InputStream in = FileManager.get().open("D:/universityexample.owl");
     if (in == null) {
         throw new IllegalArgumentException( "File: " +
 "D:/universityexample.owl" + " not found");
     }
                   OntModel model =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RDFS_INF);

        model.read(in , "","RDF/XML");

 try{
 if (keyword.contains("Students and their school"))
      {
 String sparqlQuery =
                  "PREFIX personne:<
http://www.semanticweb.org/hp/ontologies/2016/6/untitled-ontology-87#>\n" +
                   "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
+
                   "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n" +
                   "PREFIX swrl:<http://www.w3.org/2003/11/swrl#>\n"+
                   "PREFIX swrlb:<http://www.w3.org/2003/11/swrlb#>\n" +
                                   "SELECT ?Students " +
              "WHERE {\n" +
                "?Students rdf:type personne:students.\n" +

                 "} ";

               Query query = QueryFactory.create(sparqlQuery) ;
              Dataset dataset=DatasetFactory.create(model);
               QueryExecution qexec =
QueryExecutionFactory.create(query,dataset) ;
                   ResultSet resultset = qexec.execSelect() ;

Thank you for your help :)



2016-08-16 13:33 GMT+01:00 Andy Seaborne <[email protected]>:

Azra - as I said in the offlist message when you tried to subscribe, the
package names are wrong.

[[
BTW com.hp.hpl is the old Jena2 package naming.

See http://jena.apache.org/documentation/migrate_jena2_jena3.html
]]


On 16/08/16 12:59, A. Soroka wrote:

You are using Eclipse, clearly, and this is a question about basic
Eclipse usage; setting up your dependencies. It has nothing to do with
Jena. Please redirect your question to an appropriate forum. You may wish
to begin here:

http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclips
e.jdt.doc.user%2Freference%2Fref-properties-build-path.htm

---
A. Soroka
The University of Virginia Library

On Aug 16, 2016, at 7:52 AM, Azra Nicolas <[email protected]> wrote:

Thank you Soroka;
ok I have some errors in these imports
"import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.DatasetFactory;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;"
they are not accepted in my program and they are indicated as errors.
when
I try to know where is the problem the error indicate
"Remove unused import
Organize imports
Fix project Setup
"
I hope that the idea is clear. As I tell you I add all the jar file in
Protege and in jena 3
Thanks in advance



2016-08-16 12:40 GMT+01:00 A. Soroka <[email protected]>:

There are no attached figures. I'm fairly sure that this mailing list
does
not permit attachments. Please use a service like Gist or Pastebin or
copy
the errors directly into your email.

https://stackoverflow.com/help/mcve

---
A. Soroka
The University of Virginia Library

On Aug 16, 2016, at 6:43 AM, Azra Nicolas <[email protected]>

wrote:


Hello,
I try to execute an SPARQL query from my ontology that is created with
protege 5.0.0
for that I download the last version of jena apache from this link
https://jena.apache.org/download/index.cgi
I unzipe it and I add all jars to my project (adds external jars).
I add also the Jar file of Protege
Unfortunately I got several errors in my code that are shown in the
attached figures
I think that the problem is in the Jar files.
how may I resolve this problem please

Thanks in advance








Reply via email to