Click here to Skip to main content
15,849,030 members
Home / Discussions / Java
   

Java

 
QuestionJava tuition/courses Pin
jopag80003-Jul-20 9:54
jopag80003-Jul-20 9:54 
AnswerRe: Java tuition/courses Pin
Richard MacCutchan10-Jul-20 23:08
mveRichard MacCutchan10-Jul-20 23:08 
QuestionSSLSocket.getInputStream() hangs when called Java 11 Pin
nrmad1-Jul-20 9:35
nrmad1-Jul-20 9:35 
AnswerMessage Closed Pin
17-Feb-22 0:05
Weent1917-Feb-22 0:05 
AnswerMessage Closed Pin
17-Feb-22 0:05
Weent1917-Feb-22 0:05 
QuestionIntegration Pin
GauravSahu911-Jul-20 1:39
GauravSahu911-Jul-20 1:39 
AnswerRe: Integration Pin
OriginalGriff1-Jul-20 1:41
mveOriginalGriff1-Jul-20 1:41 
QuestionHow to dynamically RDF resources in java ? Pin
Member 1487416726-Jun-20 9:26
Member 1487416726-Jun-20 9: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 :

Java
 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 :
Java
<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 23:24
mveRichard MacCutchan26-Jun-20 23:24 
QuestionNeed help to simplify the solution Pin
User-862169523-Jun-20 19:02
User-862169523-Jun-20 19:02 
AnswerRe: Need help to simplify the solution Pin
Richard MacCutchan23-Jun-20 22:53
mveRichard MacCutchan23-Jun-20 22:53 
QuestionSSL Error erroneous? Pin
GenJerDan15-Jun-20 1:45
GenJerDan15-Jun-20 1:45 
Questiondiagram of gantt and java swing Pin
Member 1484673228-May-20 16:12
Member 1484673228-May-20 16:12 
QuestionBuying a computer for development in Java ecosystem Pin
Member 1484653628-May-20 8:55
Member 1484653628-May-20 8:55 
AnswerRe: Buying a computer for development in Java ecosystem Pin
Dave Kreskowiak28-May-20 16:54
mveDave Kreskowiak28-May-20 16:54 
AnswerRe: Buying a computer for development in Java ecosystem Pin
stonde202029-Jun-20 21:36
stonde202029-Jun-20 21:36 
AnswerRe: Buying a computer for development in Java ecosystem Pin
Sarbjit Grewal8-Sep-20 20:20
professionalSarbjit Grewal8-Sep-20 20:20 
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 23:47
Member 1484280524-May-20 23: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 23:56
mveRichard MacCutchan24-May-20 23:56 
GeneralMessage Closed Pin
25-May-20 4:26
Member 1484309125-May-20 4: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 5:38
mveRichard MacCutchan25-May-20 5:38 
GeneralRe: plz, someone should help me to debug this error ... Pin
Richard Deeming27-May-20 2:08
mveRichard Deeming27-May-20 2:08 
GeneralRe: plz, someone should help me to debug this error ... Pin
Richard MacCutchan27-May-20 2:50
mveRichard MacCutchan27-May-20 2:50 
QuestionJava 1st Year Project Pin
Member 1483530117-May-20 19:12
Member 1483530117-May-20 19:12 
AnswerRe: Java 1st Year Project Pin
Richard MacCutchan17-May-20 22:05
mveRichard MacCutchan17-May-20 22:05 

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.