Click here to Skip to main content
14,580,625 members
   

Java

 
PinnedForum Guidelines - PLEASE READ PinPopular
Chris Maunder28-Jul-09 2:36
cofounderChris Maunder28-Jul-09 2:36 
QuestionMessage Closed Pin
8-Jul-20 23:07
MemberMember 148849118-Jul-20 23:07 
QuestionMessage Closed Pin
5-Jul-20 21:58
Memberathenna5-Jul-20 21:58 
QuestionJava tuition/courses Pin
jopag80003-Jul-20 8:54
Memberjopag80003-Jul-20 8:54 
QuestionSSLSocket.getInputStream() hangs when called Java 11 Pin
nrmad1-Jul-20 8:35
Membernrmad1-Jul-20 8:35 
QuestionIntegration Pin
GauravSahu911-Jul-20 0:39
MemberGauravSahu911-Jul-20 0:39 
AnswerRe: Integration Pin
OriginalGriff1-Jul-20 0:41
mveOriginalGriff1-Jul-20 0:41 
QuestionHow to dynamically RDF resources in java ? Pin
Member 1487416726-Jun-20 8:26
MemberMember 1487416726-Jun-20 8:26 
I have a jframe with a jcomboBox and two buttons, the first button allows to add dynamically jcomboBoxes and the second to generate the RDF file.
the elements of comboBoxes are URIs that I extracted from an ontology.
My goal is to generate an RDF file to describe the URIs of the comboBoxes, for example I add 3 comboBoxes to my jframe by clicking on the button "add comboBox" so the final jframe will have 4 comboBoxes, for each combBoxes, I select a different URI and I click on the "generate RDF" button to generate the RDF file, but the problem is that it only works for the first URI and the other three URIs will be identical.
this is my code to add combBoxes :

 add.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent e) {
c4 = new JComboBox ();
req1 ();
panel_2.add (c4);
panel_2.revalidate ();
}

this is my code to generate RDF file :
<pre>btnGenerateRdf.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent arg0) {
String u = c2.getSelectedItem (). ToString ();
String uu = c4.getSelectedItem (). ToString ();

Model model = ModelFactory.createDefaultModel ();
String u1 = u.substring (u.lastIndexOf ("#") + 1);
String str = u1.replace ('_', '');
String uu1 = uu.substring (uu.lastIndexOf ("#") + 1);
String str1 = uu1.replace ('_', '');
    

Resource node = model.createResource (u)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, str));


Resource node1 = model.createResource (uu)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, str1));



Resource node11 = model.createResource (uu)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, str1));
String s = c4.getSelectedItem (). ToString ();
if (add.getActionListeners ()! = null)
{
Resource [] nodes = new Resource [panel_2.getComponentCount () - 2];
for (int i = 0; i <panel_2.getComponentCount () - 2; i ++)

{
String s1 = s.substring (s.lastIndexOf ("#") + 1); // to get the final substring
String s2 = s1.replace ('_', '');
nodes [i] = model.createResource (s)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, s2));


}}


try {
FileOutputStream fout = new FileOutputStream ("C: \\ Users \\ me \\ Desktop \\ file2.xml");
model.write (fout);
} catch (IOException e) {
System.out.println ("Exception caught" + e.getMessage ());
}
}
});

how can i fix this?
AnswerRe: How to dynamically RDF resources in java ? Pin
Richard MacCutchan26-Jun-20 22:24
mveRichard MacCutchan26-Jun-20 22:24 
QuestionNeed help to simplify the solution Pin
User-862169523-Jun-20 18:02
MemberUser-862169523-Jun-20 18:02 
AnswerRe: Need help to simplify the solution Pin
Richard MacCutchan23-Jun-20 21:53
mveRichard MacCutchan23-Jun-20 21:53 
QuestionSSL Error erroneous? Pin
GenJerDan15-Jun-20 0:45
MemberGenJerDan15-Jun-20 0:45 
Questiondiagram of gantt and java swing Pin
Member 1484673228-May-20 15:12
MemberMember 1484673228-May-20 15:12 
QuestionBuying a computer for development in Java ecosystem Pin
Member 1484653628-May-20 7:55
MemberMember 1484653628-May-20 7:55 
AnswerRe: Buying a computer for development in Java ecosystem Pin
Dave Kreskowiak28-May-20 15:54
mveDave Kreskowiak28-May-20 15:54 
AnswerRe: Buying a computer for development in Java ecosystem Pin
stonde202029-Jun-20 20:36
Memberstonde202029-Jun-20 20:36 
Questionplz, someone should help me to debug this error my i can asses my database but my next button is not working with it it keep getting this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Employees.Workers.btnNextActio Pin
Member 1484280524-May-20 22:47
MemberMember 1484280524-May-20 22:47 
AnswerRe: plz, someone should help me to debug this error my i can asses my database but my next button is not working with it it keep getting this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Employees.Workers.btnNextA Pin
Richard MacCutchan24-May-20 22:56
mveRichard MacCutchan24-May-20 22:56 
GeneralMessage Closed Pin
25-May-20 3:26
MemberMember 1484309125-May-20 3:26 
GeneralRe: plz, someone should help me to debug this error my i can asses my database but my next button is not working with it it keep getting this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Employees.Workers.btnNextA Pin
Richard MacCutchan25-May-20 4:38
mveRichard MacCutchan25-May-20 4:38 
GeneralRe: plz, someone should help me to debug this error ... Pin
Richard Deeming27-May-20 1:08
mveRichard Deeming27-May-20 1:08 
GeneralRe: plz, someone should help me to debug this error ... Pin
Richard MacCutchan27-May-20 1:50
mveRichard MacCutchan27-May-20 1:50 
QuestionJava 1st Year Project Pin
Member 1483530117-May-20 18:12
MemberMember 1483530117-May-20 18:12 
AnswerRe: Java 1st Year Project Pin
Richard MacCutchan17-May-20 21:05
mveRichard MacCutchan17-May-20 21:05 
QuestionReturn negative number as 0 Pin
and180y17-May-20 3:38
Memberand180y17-May-20 3:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.