Problem with executing SPARQL command using jdbc or jena in Java

Hi everybody
I am new to Oracle and SPARQL, so I'm sorry if my question is the elementry one!
select s, p, o  from table(SEM_MATCH( '(?s ?p ?o) (?s <htt...> ?o) ', SEM_Models('OWlTEST'), null, null, null ))
I have an SPARQL command which runs on Oracle correctly and returns 8 Rows. So far so good!
I tried two ways to use this command in java code:
Using java.sql.jdbc
stmt = conn.createStatement();
rs = stmt.executeQuery(...the whole command above ....);
if (rs.next()){
System.out.println(rs.getString("O"));
Problem: resultset returns only One row, which is the first row, althogh in debug mode I can see validRow=8!!!
Using com.hp.hpl.jena
Model model = ModelFactory.createDefaultModel();
String queryStr = "PREFIX : <.....> SELECT ?s ?p ?o  FROM  <...> WHERE {?s prefix:property ?o}";
Query query = QueryFactory.create(queryStr);
QueryExecution qexec = QueryExecutionFactory.create(query, model);
com.hp.hpl.jena.query.ResultSet results = qexec.execSelect();
for (;results.hasNext();) {
Problem: it returns nothing!!
Do you any Idea,
Thanks in advance
Sara

Sara,
I don't know about SPARQL not about jena, but for Java you need to change:
{code}
if (rs.next()) {..
{code}
to
{code}
while (rs.next()) {..
{code}
Otherwise you just fech and see only first row.
Look at : http://www.java2s.com/Code/JavaAPI/java.sql/ResultSetnext.htm
HTH
Thomas

Similar Messages

  • Problem while executing a command using exec()

    I'm trying to execute a command on Unix O/S with the help of java program. For this I have used Runtime class available in java.lang. It works fine for some of the basic unix commands like 'ls','cp' but when I tried to execute command "sqlldr userid=<user>/<pwd> control=/u01/dw/snb/log/sp_shd05721_ins_stg_sqlldr.ctl" , then it's not getting executed. Please advise.

    You may be having a problem with the command path, which I don't think Runtime.exec() uses. Try specifying the full path

  • Execute SQLPLUS command using JDBC

    Hi,
    I was wondering if its possible to execute sqlplus command (eg set define off, change date format ..etc) using JDBC ?
    Can anyone please post me some sample codes about this ?
    Any help will be appreciated

    Hi,
    But the Runtime.exec() and the JDBC application have
    their own connection to the database, and the sqlplus
    commands that i need to run are session based (only
    valid during the connection). eg set define off
    How do I overcome this ?
    Huh?
    You put anything you want into a input file. You feed the input file to sqlplus. If there are results then you put them into an output file.
    None of that has anything to do with JDBC nor even with java. When you call Runtime.exec() you are running a completely different process. What you do with that process is up to you.

  • Problem with AT^SJOTAP command using Siemens TC65

    I am trying to use OTAP to install a jar file onto a TC65 module using the AT^SJOTAP command. I have the jar and jad file on my server, and when I issue the AT command I can see the jad file being read but that's as far as it gets before timing out. I have the notify URL set but I don't receive any error codes.
    Using the syslog AT command I get this output.
    [OTAP] Parameters set per AT command:
    [OTAP] JAD File URL: http://[myserver]:8081/TC65apps/myapp.jad
    [OTAP] App Dir: a:
    [OTAP] Bearer: GPRS
    [OTAP] Apn Or Num: goto.virginmobile.uk
    [OTAP] Net User: user
    [OTAP] Notify URL: http://[myserver]:8081/RES/services/RES/register
    [OTAP] Parameters set per AT command:
    [OTAP] JAD File URL: http://[myserver]:8081/TC65apps/myapp.jad
    [OTAP] App Dir: a:
    [OTAP] Bearer: GPRS
    [OTAP] Apn Or Num: goto.virginmobile.uk
    [OTAP] Net User: user
    [OTAP] Notify URL: http://[myserver]:8081/RES/services/RES/register
    [OTAP] Parameters for current procedure:
    [OTAP] JAD File URL: http://[myserver]:8081/TC65apps/myapp.jad
    [OTAP] App Dir a:
    [OTAP] Http User:
    [OTAP] Http Pwd:
    [OTAP] Bearer: GPRS
    [OTAP] Apn Or Num: goto.virginmobile.uk
    [OTAP] Net User: user
    [OTAP] Net Pwd:
    [OTAP] Dns: 0
    [OTAP] Notify URL: http://[myserver]:8081/RES/services/RES/register
    [OTAP] Try to establish a GPRS connection ...
    [OTAP] GPRS connection established.
    [OTAP] Try to get http://[myserver]:8081/TC65apps/myapp.jad ...
    [OTAP] Connected.
    [OTAP] ERROR: Otap timer expired!
    [OTAP] Reboot now.
    Sometimes I will actually get an empty jad file in my app dir, but that's it. I've read through all the documentation several times and searched this forum to no avail.
    Any insight would be much appreciated.

    Hi Kiran,
    Generally double click works with 'F2' but try using this sy-ucomm value '&IC1'.
    You can as well validate your logic using system fields like sy-lilli for clicking and sy-lisel for the values that have been stored on your click.
    Hope it helps!
    Much Regards,
    Amuktha.
    Edited by: Amuktha Naraparaju on Feb 16, 2009 12:22 PM

  • Problem to execute cvs command using Runtime.exec method

    Hello,
    I want execute this cvs command, with this options:
    cvs -d :pserver:[email protected]:/home/cvs/cvsroot rlog -S -d "2007/05/01<now" Project
    I tried to execute with Runtime.exec() :
    Runtime.exec("cvs -d :pserver:[email protected]:/home/cvs/cvsroot rlog -S -d \"2007/05/01<now\" Project");
    But I have an error because the smaller character is interpretate as a redirection, no as a smaller symbol.
    How I can do to use this command with Runtime.exec ?
    Thanks.
    Regards.

    Sorry,
    I had a typing mistake.
    I want say:
    Runtime.exec("cvs -d :pserver:[email protected]:/home/cvs/cvsroot rlog -S -d \"2007/05/01<now\" Project");
    Regards.

  • Problem with executing runtime command

    Hi everyone,
    when i execute the following command on a command line it is done within one minute:
    d:\Applikationen\usr\local\wbin\sed.exe -e "/^#/d" D:\dokumente\file_1.txt > D:\dokumente\file_2.txtUnfortunately when i call the same command from within my application then nothing seems to happen:
           Runtime rt = Runtime.getRuntime();
           System.out.println("Runtime obtained");
           Process p = rt.exec(cmd);
           System.out.println("Command executed");
           int ex = p.waitFor();
           System.out.println("Exit code "+ex);

    Read this
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Just installed Lion and the Magic TrackPad and I am having a problem with one click commands.  I have to hit the pad fairly hard with one finger to get it to accept the command.  Is this normal, is there another way that I am suppose to execute commands?

    Just installed Lion and the Magic TrackPad and I am having a problem with one click commands.  I have to hit the pad fairly hard with one finger to get it to accept the command.  Is this normal, is there another way that I am suppose to execute commands?

    No you just need to turn on Tap to Click. Go into System Preferences - Trackpad and click the Point to Click tab and select the first box which will say Tap to Click and you should be in business.

  • Problem with Progress DB while using to connect using JDBC Adapter

    Hi,
      I am facing Problem with Progress DB while using to connect using JDBC Adapter. I am getting the following error in auditlog file like,
    Error during database connection to the database URL  jdbc:JdbcProgress:T:156.5.31.65:2545:/mfgprodev/devbadb 
    /devsche/i_apoext.db using the  JDBC driver "com.progress.sql.jdbc.JdbcProgressDriver" : com.sap.aii.adapter.jdbc.sql.DriverManagerException: Unable to locate a suitable JDBC driver to establish a connection to URL " jdbc:JdbcProgress:T:156.5.31.65:2545:/mfgprodev/devbadb 
    /devsche/i_apoext.db "
    I tried using the following all URLs,
    1. jdbc:JdbcProgress:T:156.5.31.65:2545:i_apoext.       
    2. jdbc:JdbcProgress:T:156.5.31.65:2545:i_apoext.db     
    3.                                                      
    jdbc:JdbcProgress:T:156.5.31.65:2545:/mfgprodev/devbadb 
    /devsche/i_apoext.                                      
    4.                                                      
    jdbc:JdbcProgress:T:156.5.31.65:2545:/mfgprodev/devbadb 
    /devsche/i_apoext.db.                                  
    Can anyone please help me out in solving this issue.
    May be the cause for this is :
    1) The Wrong URL  format
    2) CLASSPATH is not setted properly..
    Can you look more into this stuff.
    Thanks,
    Soorya.

    Hi,
    To access any database fromm XI, using the JDBC adapter, the corresponding drivers have to be installed on the XI server.
    Just check this note 831162.
    Also, check this PDF to install Drivers in XI,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3867a582-0401-0010-6cbf-9644e49f1a10

  • Problems with the vba command sendkeys in Access 2013.

    Hi, I have problems with the vba command sendkeys in Access 2013.
    I use a text field (no control) in a form. By means of the VBA command SendKeys "+ {DELETE}", 1  I get the text in memory from the text field, then place (paste) the text in a Word document. The command line sendkeys
    is followed by moving the focus to a particular control. In Access 2003, which went smoothly. Now the sendkeys command is executed only in Access 2013 in the control that then receives focus. If the procedure ends with the sendkeys command then it works well.
    The procedure with the sendkeys command is activated by a button on a form.
    Who can help me?
    private user

    Hi H.Plmp,
    Based on the description, you want to call the sendkeys from a button.
    >> use a text field (no control) in a form. By means of the VBA command SendKeys "+ {DELETE}", 1  I get the text in memory from the text field<<
    What did you mean that you no control? And how did you get the text in memory from the text field? Also I am not able to understand the exact reason that the command doesn't works in Access 2013.
    And based on the test, sendkeys "+ {Delete}" works well for me when I set a focus for the textbox control. Here is th test code:
    Me.Controls("txtField1").SetFocus
    SendKeys "+ {DELETE}", 1
    If I misunderstood, please feel free to let me know.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problem with 'Edit Locally' command -- Due to IISProxy?

    Hi,
    We have a problem with 'Edit Locally' command since we are using Windows Authentication. Our architecture is:
    SAP EP 6.0 SP2 Patch 28 (Solaris)
    IIS Proxy (Windows 2003)
    The situation is:
    If we access to SAP Portal using old url (directly to Solaris) using form-based authentication we do not have any problem with 'edit locally' command.
    However, if we access to SAP Portal using IISProxy and Windows Authentication we get an 'Operation failed' error message.
         Java plug-in console shows the following message:
    cargar: clase com/sapportals/wcm/app/docapplet/DocApplet.class no encontrada.
    java.lang.ClassNotFoundException: com.sapportals.wcm.app.docapplet.DocApplet.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Where is the problem? Is due to authentication method? SAP Portal or IISProxy configuration?
    Thanks,

    Thanks for your comment,
    Now, we have tested with version 1.5.0_01 plugin version but the result is the same: 'Operation failed'
    This is a very important topic to solve before installing Windows Authentication in a productive environment.
    Has anybody any solution?
    Damiá

  • Problem with FNDLOAD upload command for Concurrent Program

    Hi Apps Gurus,
    I am facing a peculiar problem with the FNDLOAD command.
    My customer has a concurrent program which is running fine in Prod, and now they have requeseted for a change in the program, the change requested was to modify the parameters and the name of the program. I have done the changes and when I try migrating this change from DEV instance to IAT using FNDLOAD commands it is not getting migrated. There does not seem to be any problem with the LDT file, There is no error message in the log as well.
    However I have noticed something very peculiar.* In the target instance (IAT) , when i run the FNDLOAD command directly the migration is unsuccessful but when i delete the existing parameters of the prog and rename the concurrent program and then run the FNDLOAD command the migration is sucessful and the changes are getting reflected!!. I dont understand why this is happening. This is happening in preprod as well , the migration is unsucessfull initially when i directly run the command, when i modify the name and parameters of the prog and then run the command the migration is sucessful. Now i do not have access to prod and this trick of changing prog name and parameters cannot be done in prod , so I need a proper solution for the migration.
    Any pointers to resolve this issue will be helpful.
    Thanks,
    Mahesh

    I am facing a peculiar problem with the FNDLOAD command.
    My customer has a concurrent program which is running fine in Prod, and now they have requeseted for a change in the program, the change requested was to modify the parameters and the name of the program. I have done the changes and when I try migrating this change from DEV instance to IAT using FNDLOAD commands it is not getting migrated. There does not seem to be any problem with the LDT file, There is no error message in the log as well.
    However I have noticed something very peculiar.* In the target instance (IAT) , when i run the FNDLOAD command directly the migration is unsuccessful but when i delete the existing parameters of the prog and rename the concurrent program and then run the FNDLOAD command the migration is sucessful and the changes are getting reflected!!. I dont understand why this is happening. This is happening in preprod as well , the migration is unsucessfull initially when i directly run the command, when i modify the name and parameters of the prog and then run the command the migration is sucessful. Now i do not have access to prod and this trick of changing prog name and parameters cannot be done in prod , so I need a proper solution for the migration.
    Any pointers to resolve this issue will be helpful.What are the commands you used for the download/upload?
    Do you get any errors in the log files?
    Please see (FNDLOAD Download / Upload Concurrent Programs Fails To Load Parameters [ID 1101946.1]).
    Thanks,
    Hussein

  • I had a problem with slowness so I used "reset". The popup ran forever so I stopped it. Now I can't remove or add the program.

    I had a problem with slowness so I used "reset". The popup ran forever so I stopped it. Now I can't use, remove, or add the program. How do I proceed?
    TIA,
    BWSwede

    You can paste that path in the command line in the Windows Explorer file manager.

  • Facing Problem while executing a command through WLST

    Hi,
    Iam using Weblogic 11g(10.3.2).Whenever I execute the below command in WLST on windows it is working fine.
    reassociateSecurityStore(domain="base_domain",admin="cn=orcladmin",password="welcome1",ldapurl="ldap://<hostname>:389",servertype="OID",jpsroot="cn=jpsroot_idm_idmhost1")
    But whenever i execute the same in Linux,it is throwing the error as below:
    wls:/base_domain/serverConfig> reassociateSecurityStore(domain="base_domain",admin="cn=orcladmin",password="welcome1",ldapurl="ldap://<hoistname>:389",servertype="OID",jpsroot="cn=jpsroot_idm_idm1")
    Traceback (innermost last):
    File "<console>", line 1, in ?
    NameError: reassociateSecurityStore
    Please suggest....
    Regards
    Pavan

    Facing Problem while executing a command through WLST

  • TS3899 With Yahoo Mail, and anotare account (Inacap Mail), I can only receive mails but I can't send emails. I don't know if this is a problem of the iPad or it is a problem with yahoo mail, because using Gmail and the email of my job I don' have this pro

    With Yahoo Mail, and anotare account (Inacap Mail), I can only receive mails but I can't send emails. I don't know if this is a problem of the iPad or it is a problem with yahoo mail, because using Gmail and the email of my job I don' have this problem.

    Google them to confirm the settings that you need for the outgoing server, then check the setting you entered on the pad.  Pay real close attention to the outgoing server name, and port.  You may need to change in on the pad. 

  • Problems with a shared calendar using Outlook 2007 and Exchange 2010

    Hello all,
    We are having a problem with sharing a calendar using Outlook 2007 and Exchange 2010.
    I will start with some background. I have just started my position with this company. I have been working with networks for awhile at the small business level. I have not had much production experience with exchange. There is only myself and my supervisor
    who has inherited a midsized network which was built by five previous techs that are no longer with the company. Of course, the previous techs did not leave much documentation, so the original hows and whys for our system setup has been lost.
    One of the managers has a calendar she shares with some of our users. I believe this calendar has been in use since sometime in 2006. A mailbox was created to hold this calendar to keep it separate from the managers calendar. I am not sure what version
    of exchange they were using at that time, but I assume there was one or two migrations of it getting to its current state on our exchange 2010 server. At some point it was observed that the other workers she was sharing with were not able to access it correctly.
    I am not fully sure what the original problem was (possibly some people not being able to see or connect to the calendar), but it was decided to give everyone who needed access to this calendar full access permissions through exchange. Correct me if I
    am wrong, but I believe that gave everyone connected the ability to do anything with the calendar. Of course the manager was not happy about that. This is where I started working on the problem.
    I removed everyone, except the manager who wants to control the calendar, from having "Full Access Permissions". This did have the effect of making some people just able to see the calendar and not make changes. Though there were others that were
    able to connect to the calendar who I thought would not be able to. The manager that originally created the calendar did try to manage access to it through the Outlook interface, though it currently does not seem to be fully in effect.
    So, to get to the point of what we are trying to do, is there a way to get the original manager back into control of the calendar though Outlook? It would be preferred to be able to keep the history of what they tracked of this calendar, so starting a new
    one would be something we would rather avoid. After that, getting all of the users that need to connect to the calendar reconnected with the correct access permissions and making sure they are all synchronized.
    I realize this is a big mess, and your help would be greatly appreciated.

    Hi Nigel,
    How is the impact, just one user or all users, Outlook or OWA?
    If just one user, it seems like an issue on the Outlook Client side.
    Please trying to re-create new profile to fresh the caches.
    Please runing Outlook under safe mode to avoid some AVs, add-ins and firewall.
    Found a similar thread for your reference:
    Calendar Sharing not available error message
    http://social.technet.microsoft.com/Forums/exchange/en-US/d9b33281-d7bb-4608-8025-16fb26643d0d/calendar-sharing-not-available-error-message?forum=exchangesvrclientslegacy
    Hope it is helpful
    Thanks
    Mavis
    Mavis Huang
    TechNet Community Support

Maybe you are looking for

  • Share Screen on ARD Does not work unless the user is logged on

    Since Upgrading to Lion, I have been unable to get the Share Screen in Apple Remote Desktop fuction working from Any machine. All Clients are on the latest agent of ARD and are completely upto date. When i try running the task when the clients are at

  • No progress of installation for windows 10 (10041)

    Is there any way to know the progress of installation. The message 'just a moment' is displayed for a long time and the internet connection is being used. The instllation is not progressing. What is the download requirement during installation from i

  • 8.1.6 (Thin) drivers with J2EE???

    Hello all, I am trying to use the 8.1.6 THIN drivers as an XA datasource in J2EE. Has anyone else made this work? I keep getting a ClassCastException thrown while starting the J2EE server. It DOES work if I create an older NON-XA datasource, so I kno

  • Safari quit when I open Facebook

    I have just updated my Mac, and the first thing I notice soon after is that my Safari quit when I try to load anything from the Facebook page after it opens. And a message show that safari exit unexpectedly, and a report is attached. Can anyone help

  • Need an UNDO button

    Title says it all.