You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Samir Hamitouche <21...@etu.unicaen.fr> on 2013/08/12 11:05:00 UTC

Reading RDF/XML file with jena beguineer

Hello,

i write a small java program to read an XML/RDF file in my desktop  in eclipse using the jena library this is the program:

import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Model;
import java.io.PrintWriter;
import java.util.Iterator;


public class web1 {
	
	 private String etudNS ="path .. /resDoc.rdf";

	/**
	 * @param args
	 */
			 public static void main(String[] args) {
		 web1 etudRDF = new web1();
		 }
		 public void load() {
		 Model model = ModelFactory.createDefaultModel();
		 model.read(etudNS);
		 model.write(System.out); 
		 model.write (new PrintWriter(System.out));
		 }       
}




when i compile i had this:


$ javac web1.java 
web1.java:1: error: package com.hp.hpl.jena.rdf.model does not exist
import com.hp.hpl.jena.rdf.model.ModelFactory;
                                ^
web1.java:2: error: package com.hp.hpl.jena.rdf.model does not exist
import com.hp.hpl.jena.rdf.model.Model;
                                ^
web1.java:18: error: cannot find symbol
		 Model model = ModelFactory.createDefaultModel();
		 ^
  symbol:   class Model
  location: class web1
web1.java:18: error: cannot find symbol
		 Model model = ModelFactory.createDefaultModel();
		               ^
  symbol:   variable ModelFactory
  location: class web1
4 errors


Anyone can help me

Thank you

Best regards

Samir
















Re: Reading RDF/XML file with jena beguineer

Posted by Andy Seaborne <an...@apache.org>.
On 12/08/13 10:05, Samir Hamitouche wrote:

Please don't reply to some unrelated message on the list.  People 
reading by threads may not see your message.

 > $ javac web1.java
 > web1.java:1: error: package com.hp.hpl.jena.rdf.model does not exist
 > import com.hp.hpl.jena.rdf.model.ModelFactory;
 >                                  ^

You must set the classpath for compilation.  Search the web for general 
instructions for doing this.  It is not Jena-specific.

It is easier to use an IDE such as Eclipse.  It is much easier and 
productive than doing everything on the command line.

	Andy



> Hello,
>
> i write a small java program to read an XML/RDF file in my desktop  in eclipse using the jena library this is the program:
>
> import com.hp.hpl.jena.rdf.model.ModelFactory;
> import com.hp.hpl.jena.rdf.model.Model;
> import java.io.PrintWriter;
> import java.util.Iterator;
>
>
> public class web1 {
> 	
> 	 private String etudNS ="path .. /resDoc.rdf";
>
> 	/**
> 	 * @param args
> 	 */
> 			 public static void main(String[] args) {
> 		 web1 etudRDF = new web1();
> 		 }
> 		 public void load() {
> 		 Model model = ModelFactory.createDefaultModel();
> 		 model.read(etudNS);
> 		 model.write(System.out);
> 		 model.write (new PrintWriter(System.out));
> 		 }
> }
>
>
>
>
> when i compile i had this:
>
>
> $ javac web1.java
> web1.java:1: error: package com.hp.hpl.jena.rdf.model does not exist
> import com.hp.hpl.jena.rdf.model.ModelFactory;
>                                  ^
> web1.java:2: error: package com.hp.hpl.jena.rdf.model does not exist
> import com.hp.hpl.jena.rdf.model.Model;
>                                  ^
> web1.java:18: error: cannot find symbol
> 		 Model model = ModelFactory.createDefaultModel();
> 		 ^
>    symbol:   class Model
>    location: class web1
> web1.java:18: error: cannot find symbol
> 		 Model model = ModelFactory.createDefaultModel();
> 		               ^
>    symbol:   variable ModelFactory
>    location: class web1
> 4 errors
>
>
> Anyone can help me
>
> Thank you
>
> Best regards
>
> Samir
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


RE: Reading RDF/XML file with jena beguineer

Posted by David Jordan <Da...@sas.com>.
Samir,
Andy already answered your question. Do you have a CLASSPATH set up that includes all the jars necessary for Jena? You may be using Eclipse, but you still need to set up the jar files to be included with the build. I am guessing you are new to Java and Eclipse?

-----Original Message-----
From: Samir Hamitouche [mailto:21209178@etu.unicaen.fr] 
Sent: Monday, August 12, 2013 10:23 AM
To: users@jena.apache.org
Cc: dev-subscribe@jena.apache.org
Subject: Reading RDF/XML file with jena beguineer



Hello,

i write a small java program to read an XML/RDF file in my desktop  using the IDE eclipse the jena library this is the program:

import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Model;
import java.io.PrintWriter;
import java.util.Iterator;


public class web1 {
	
	 private String etudNS ="path .. /resDoc.rdf";

	/**
	 * @param args
	 */
			 public static void main(String[] args) {
		 web1 etudRDF = new web1();
		 }
		 public void load() {
		 Model model = ModelFactory.createDefaultModel();
		 model.read(etudNS);
		 model.write(System.out); 
		 model.write (new PrintWriter(System.out));
		 }       
}




when i compile i had this:


$ javac web1.java
web1.java:1: error: package com.hp.hpl.jena.rdf.model does not exist import com.hp.hpl.jena.rdf.model.ModelFactory;
                                ^
web1.java:2: error: package com.hp.hpl.jena.rdf.model does not exist import com.hp.hpl.jena.rdf.model.Model;
                                ^
web1.java:18: error: cannot find symbol
		 Model model = ModelFactory.createDefaultModel();
		 ^
  symbol:   class Model
  location: class web1
web1.java:18: error: cannot find symbol
		 Model model = ModelFactory.createDefaultModel();
		               ^
  symbol:   variable ModelFactory
  location: class web1
4 errors


Anyone can help me

Thank you

Best regards

Samir

















Reading RDF/XML file with jena beguineer

Posted by Samir Hamitouche <21...@etu.unicaen.fr>.

Hello,

i write a small java program to read an XML/RDF file in my desktop  using the IDE eclipse the jena library this is the program:

import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Model;
import java.io.PrintWriter;
import java.util.Iterator;


public class web1 {
	
	 private String etudNS ="path .. /resDoc.rdf";

	/**
	 * @param args
	 */
			 public static void main(String[] args) {
		 web1 etudRDF = new web1();
		 }
		 public void load() {
		 Model model = ModelFactory.createDefaultModel();
		 model.read(etudNS);
		 model.write(System.out); 
		 model.write (new PrintWriter(System.out));
		 }       
}




when i compile i had this:


$ javac web1.java 
web1.java:1: error: package com.hp.hpl.jena.rdf.model does not exist
import com.hp.hpl.jena.rdf.model.ModelFactory;
                                ^
web1.java:2: error: package com.hp.hpl.jena.rdf.model does not exist
import com.hp.hpl.jena.rdf.model.Model;
                                ^
web1.java:18: error: cannot find symbol
		 Model model = ModelFactory.createDefaultModel();
		 ^
  symbol:   class Model
  location: class web1
web1.java:18: error: cannot find symbol
		 Model model = ModelFactory.createDefaultModel();
		               ^
  symbol:   variable ModelFactory
  location: class web1
4 errors


Anyone can help me

Thank you

Best regards

Samir