Exception in the code

2016-07-13 Thread kumar rohit
Hi
I have the following code in which I want to create an instance/individual
of the class Student. The student name is entered in a text box (in a
button even handler). But it gives exception.

_

public class NewJFrame extends javax.swing.JFrame {

public static void readOntology( String file, OntModel model )
{

InputStream in = null;
try
{
in = new FileInputStream( file );
model.read(in, "RDF/XML");
in.close();
} catch (IOException e)
{
e.printStackTrace();
}

My main() is the following.



public static void main(String args[]) {



OntModel model = ModelFactory.createOntologyModel();
String file="D://std.owl";
readOntology(file , model );
___

Button handler to get student name from text box is:

 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {




String str=jTextField1.getText();

read(str, null);
}
_

WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
Relative URIs are not permitted in RDF: specifically 



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javaapplication4.NewJFrame.read(NewJFrame.java:50)
at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)


job advert for distribution on the mailing list.

2016-07-13 Thread Aoife Brady
Hello,

I would like to send the following software engineer role job advert on the 
mailing list.

Thank you,

Aoife.

Dr Aoife Brady (Geodata Product Manager)
IGS (International Geoscience Services) Ltd.
Geoscience Innovation Hub
British Geological Survey
Environmental Science Centre
Keyworth
Nottingham
NG12 5GG
Office: +44 (0) 115 937 4469
Mobile: +44 (0) 749 691 1837
www.igsint.com
[IGS logo]   [Logo two] 
IMPORTANT - If you are not the intended recipient of this e-mail or attachments 
please notify the originator immediately, delete it from your computer and 
destroy any copies. This e-mail and any attachments are confidential, may be 
legally privileged, and are intended for the addressee only. Dissemination in 
any form is prohibited and may be illegal. The opinions and views contained in 
this e-mail and any attachments, unless otherwise stated, are not those of the 
company or any person in relation to whom the company would have vicarious 
liability or responsibility. This e-mail or any attachments are not guaranteed 
to be free from viruses, so it is strongly recommended that you check for these 
before downloading onto your computer.



Fwd: Exception in the code

2016-07-13 Thread kumar rohit
Hi
I have the following code in which I want to create an instance/individual
of the class Student. The student name is entered in a text box (in a
button even handler). But it gives exception.

_

public class NewJFrame extends javax.swing.JFrame {

public static void readOntology( String file, OntModel model )
{

InputStream in = null;
try
{
in = new FileInputStream( file );
model.read(in, "RDF/XML");
in.close();
} catch (IOException e)
{
e.printStackTrace();
}

My main() is the following.



public static void main(String args[]) {



OntModel model = ModelFactory.createOntologyModel();
String file="D://std.owl";
readOntology(file , model );
___

Button handler to get student name from text box is:

 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {




String str=jTextField1.getText();

read(str, null);
}

And read() is following
___


 private static void read(String str, OntModel model)
{
String ns="http://www.semanticweb.org/untitled-ontology-112/";;
 OntClass univer = model.createClass(ns + str);
try {

FileWriter out=new FileWriter("D://std.owl");

 model.write( out, "RDF/XML-ABBREV" );
} catch (IOException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
null, ex);
}
__



WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
Relative URIs are not permitted in RDF: specifically 



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javaapplication4.NewJFrame.read(NewJFrame.java:50)
at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)


Re: Fwd: Exception in the code

2016-07-13 Thread Andy Seaborne

On 13/07/16 16:58, kumar rohit wrote:

Hi
I have the following code in which I want to create an instance/individual
of the class Student. The student name is entered in a text box (in a
button even handler). But it gives exception.

_

public class NewJFrame extends javax.swing.JFrame {

 public static void readOntology( String file, OntModel model )
 {

 InputStream in = null;
try
{
in = new FileInputStream( file );
model.read(in, "RDF/XML");
in.close();
} catch (IOException e)
{
e.printStackTrace();
}

My main() is the following.



public static void main(String args[]) {



 OntModel model = ModelFactory.createOntologyModel();
 String file="D://std.owl";
readOntology(file , model );
___

Button handler to get student name from text box is:

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {




String str=jTextField1.getText();

read(str, null);
}

And read() is following
___


  private static void read(String str, OntModel model)
 {
 String ns="http://www.semanticweb.org/untitled-ontology-112/";;
  OntClass univer = model.createClass(ns + str);


if you pass null as model, then indeed it will NPE.



 try {

 FileWriter out=new FileWriter("D://std.owl");

  model.write( out, "RDF/XML-ABBREV" );
 } catch (IOException ex) {
 Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE,
null, ex);
 }
__



WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
Relative URIs are not permitted in RDF: specifically 



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javaapplication4.NewJFrame.read(NewJFrame.java:50)
at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)





Re: Exception in the code

2016-07-13 Thread Andy Seaborne

This looks rather similar to ;

http://stackoverflow.com/questions/38351713/creating-individual-in-jena

I suggest local collaboration.

On 13/07/16 16:37, kumar rohit wrote:

Hi
I have the following code in which I want to create an instance/individual
of the class Student. The student name is entered in a text box (in a
button even handler). But it gives exception.

_

public class NewJFrame extends javax.swing.JFrame {

 public static void readOntology( String file, OntModel model )
 {

 InputStream in = null;
try
{
in = new FileInputStream( file );
model.read(in, "RDF/XML");
in.close();
} catch (IOException e)
{
e.printStackTrace();
}

My main() is the following.



public static void main(String args[]) {



 OntModel model = ModelFactory.createOntologyModel();
 String file="D://std.owl";
readOntology(file , model );
___

Button handler to get student name from text box is:

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {




String str=jTextField1.getText();

read(str, null);
}
_

WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
Relative URIs are not permitted in RDF: specifically 



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javaapplication4.NewJFrame.read(NewJFrame.java:50)
at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)





OntModel imports not loaded (2.11.0 behavior broken in 3.0.1)

2016-07-13 Thread Martynas Jusevičius
Hey,

I upgraded Jena from 2.11.0 to 3.0.1 and OntModel imports stopped
working when getOntology() is called.

I traced the problem to AdapterFileManager.readModelWorker(Model
model, String filenameOrURI, String baseURI, String syntax), where

  model.read(in, baseURI, syntax)

was at some point replaced with

  RDFDataMgr.read(model, mappedURI, baseURI, lang)

and therefore OntModelImpl.read() doesn't get called, and
OntModelImpl.loadImports() doesn't get called.

Respective stacktraces provided below. Is there a workaround?

3.0.1

at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:134)
at 
org.apache.jena.riot.adapters.AdapterFileManager.readModelWorker(AdapterFileManager.java:282)
at org.apache.jena.util.FileManager.readModel(FileManager.java:341)
at org.apache.jena.util.FileManager.readModel(FileManager.java:325)
at 
org.apache.jena.ontology.OntDocumentManager.read(OntDocumentManager.java:1062)
at 
org.apache.jena.ontology.OntDocumentManager.getOntology(OntDocumentManager.java:584)

2.11.0

com.hp.hpl.jena.ontology.impl.OntModelImpl.loadImports(OntModelImpl.java:1980)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:2250)
at 
org.apache.jena.riot.adapters.AdapterFileManager.readModelWorker(AdapterFileManager.java:302)
at com.hp.hpl.jena.util.FileManager.readModel(FileManager.java:362)
at com.hp.hpl.jena.util.FileManager.readModel(FileManager.java:346)
at 
com.hp.hpl.jena.ontology.OntDocumentManager.read(OntDocumentManager.java:1063)
at 
com.hp.hpl.jena.ontology.OntDocumentManager.getOntology(OntDocumentManager.java:585)


Martynas
atomgraph.com


Re: Exception in the code

2016-07-13 Thread kumar rohit
The error message no changed to : I dont think its UI problem


ERROR [main] (RDFDefaultErrorHandler.java:44) - Premature end of file.
Exception in thread "main" com.hp.hpl.jena.shared.JenaException:
org.xml.sax.SAXParseException; Premature end of file.
at
com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler.fatalError(RDFDefaultErrorHandler.java:45)
at
com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler.fatalError(ARPSaxErrorHandler.java:35)
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.warning(XMLHandler.java:225)
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.fatalError(XMLHandler.java:255)

On Wed, Jul 13, 2016 at 2:27 PM, Andy Seaborne  wrote:

> This looks rather similar to ;
>
> http://stackoverflow.com/questions/38351713/creating-individual-in-jena
>
> I suggest local collaboration.
>
>
> On 13/07/16 16:37, kumar rohit wrote:
>
>> Hi
>> I have the following code in which I want to create an instance/individual
>> of the class Student. The student name is entered in a text box (in a
>> button even handler). But it gives exception.
>>
>> _
>>
>> public class NewJFrame extends javax.swing.JFrame {
>>
>>  public static void readOntology( String file, OntModel model )
>>  {
>>
>>  InputStream in = null;
>> try
>> {
>> in = new FileInputStream( file );
>> model.read(in, "RDF/XML");
>> in.close();
>> } catch (IOException e)
>> {
>> e.printStackTrace();
>> }
>>
>> My main() is the following.
>>
>> 
>>
>> public static void main(String args[]) {
>>
>>
>>
>>  OntModel model = ModelFactory.createOntologyModel();
>>  String file="D://std.owl";
>> readOntology(file , model );
>> ___
>>
>> Button handler to get student name from text box is:
>>
>>   private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
>>
>>
>>
>>
>> String str=jTextField1.getText();
>>
>> read(str, null);
>> }
>> _
>>
>> WARN [main] (RDFDefaultErrorHandler.java:36) - unknown-source: {W136}
>> Relative URIs are not permitted in RDF: specifically 
>>
>>
>>
>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
>> at javaapplication4.NewJFrame.read(NewJFrame.java:50)
>> at javaapplication4.NewJFrame.jButton2ActionPerformed(NewJFrame.java:266)
>> at javaapplication4.NewJFrame.access$000(NewJFrame.java:27)
>> at javaapplication4.NewJFrame$1.actionPerformed(NewJFrame.java:103)
>> at
>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
>> at
>>
>> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
>> at
>>
>> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
>> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
>>
>>
>