On 29 December 2011 06:12, Ankit Verma <[email protected]> wrote:
> Hi Andy,
>
> Can u pls help me in creating a new web application from scratch.
> Secondly i am trying to import wordnet model but facing some error can u pls 
> see
> the below error.
>

[snip]

> /**
> * Reads RDF from a file into a model
> * @param filename Name of the RDF file to read
> * @param model The model to read the RDF into
> * @throws FileNotFoundException if the file can't be located on the classpath
> */
> private static void readFileIntoModel(String filename, Model model)
> throws FileNotFoundException {
>
> // Use the class loader to find the input file
> InputStream in =
> ImportWordnet.class.getClassLoader().getResourceAsStream(filename);
>
> if (in == null) {
> throw new FileNotFoundException("File not found on classpath: "+
> filename);
> }
>
> // Read the triples from the file into the model
> model.read(in,null);
> }
> }
>
> and the error is
>
> "java.io.FileNotFoundException: File not found on classpath:
> wordnet_glossary-20010201.rdf"
>

That's because the file is not in the classpath; you mentioned a web
application, where the class loader might behave slightly different
from a standalone application. If I understand the rest of your code
correctly, you want to load this once in a database and then access it
from there. I would do this by opening the file manually instead of
going through the class loader to get an inputstream, so something
like:

InputStream in = new FileInputStream(new File(filename));

HTH,
I.

>
> Thanks and Regards
> Ankit Verma
> Associate Software Engineer
> Impetus Infotech (India) Pvt. Ltd.
> Phone: + 91-120.409.2200 x 2773
> www.impetus.com<http://www.impetus.com/> <http://www.impetus.com/>
>
>
>
> ________________________________
>
> New Impetus webcast on-demand 'Big Data Technologies for Social Media 
> Analytics' available at http://bit.ly/nFdet0.
>
> Visit http://www.impetus.com to know more. Follow us on 
> www.twitter.com/impetuscalling
>
>
> NOTE: This message may contain information that is confidential, proprietary, 
> privileged or otherwise protected by law. The message is intended solely for 
> the named addressee. If received in error, please destroy and notify the 
> sender. Any use of this email is prohibited when received in error. Impetus 
> does not represent, warrant and/or guarantee, that the integrity of this 
> communication has been maintained nor that the communication is free of 
> errors, virus, interception or interference.

Reply via email to