[JAVA] Remove the datatypes for literals in SPARQL results


I ask an ontology OWL using SPARQL, but results show links as well as data. I want only the data. How can I remove the link and display the data? The result I get is:

===========================================================================================================================
| "5"^^<http://www.w3.org/2001/XMLSchema#decimal> | my:HotelCityPark | "Hotel"^^<http://www.w3.org/2001/XMLSchema#string> |
---------------------------------------------------------------------------------------------------------------------------


The output I want is (note that parts such as ^^<http://www.w3.org/2001/XMLSchema#decimal> ) are no longer present.


=================================
| 5 | HotelCityPark | Hotel |
---------------------------------


Thank you

Hello

It's very simple then. Suppose we have a graph with a few triples.

Oracle = new oracle.spatial.rdf.client.jena.Oracle ("JDBC: thin: @...", "scott", "password");
model = oracle.spatial.rdf.client.jena.ModelOracleSem.createOracleSemModel (oracle, "graph");
graph = model.getGraph ();
void = Node.createURI ("http://sub/a");
PRED = Node.createURI ("http://pred/a");
obj = NodeFactory.createLiteral ("1.234", com.hp.hpl.jena.datatypes.xsd.XSDDatatype.XSDdecimal);
Triple = Triple.create (pred, sub, obj);
Graph.Add (triple);

...

void = Node.createURI ("http://sub/a");
PRED = Node.createURI ("http://pred/a");
obj = Node.createURI ("http://pred/o");
Triple = Triple.create (pred, sub, obj);
Graph.Add (triple);

Say we want to get? links o following SPARQL query

sparqlQuery ="SELECT? o WHERE {? s? p? o} limit 30 ';

You can easily browse through the result set and get the literal value if the binding of variables is a literal.

varO = com.hp.hpl.jena.sparql.core.Var.alloc ("o");

Query = com.hp.hpl.jena.query.QueryFactory.create (sparqlQuery, com.hp.hpl.jena.query.Syntax.syntaxSPARQL);

qexec = com.hp.hpl.jena.query.QueryExecutionFactory.create (query, model);

RS = qexec.execSelect ();

While {(rs.hasNext ())}

resultBinding = rs.next ();

node = resultBinding.getBinding () .get (varO);

If (node.isLiteral ()) {}

System.out.println (node.getLiteralValue ());

}

else {}

System.out.println ("node". ToString());

}

}

==>

1.234

Hello

http://pred/o

It will be useful,

Zhe Wu

Tags: Database

Similar Questions

  • Remove the table for a photo table control framework

    Hello

    I need to create an array of 2D images. Due to the large amount of elements in the array, the width of the image is reduced to a minimum. However there are still a considerable gap between the 2 adjacent elements in the table (see the attached example), which is caused by the picture in the image control.

    I tried to affect the color of transparent photo frame, but even if it is invisible, it is still there. I tried to customize the control too, but I couldn't find a way to remove the framework (for classic and modern styles).

    (BTW, for the control of classical style, there is an option without color box control framework, but no option for 2D image control.) I need model/photos inside the element of control 2D image, so simple color 1 color box is not enough)

    Could someone help to suggest a way to remove the frame and optimize the density of space in the table? Thank you much in advance.

    PJI

    Hello, PJI,.

    You should be able to define the lower field in the area of the image of the control.

    -Right click Control and choose "Advanced Properties"-> "Customize.."

    -To the editor change order to 'Edit Mode'

    -from the menu, click on 'Window'-> 'display the parts.

    -In the part window, select the frame

    -set new values for top, left, height, and width, so that the image is behind the area of the photo

    I hope this helps.

    UliB

  • laptop resets date and time back to factory on each reboot. Also removes the drivers for the cards and the outlook settings.

    Machine removes the drivers for the wireless card, also changes some settings in outlook after each reboot.

    Hi Jim,.

    You could try replacing the CMOS battery, as it appears to have failed.

    http://www.computerhope.com/issues/ch000239.htm

    Chris
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Why Microsoft did remove the ability for Windows Vista to install on herself from one location other than being inside the BONE you want to fix it?

    No Option to install repair - SAD

    Hello

    Why Microsoft removed the ability for Windows Vista to install on herself from one location other than being inside the BONE you want to repair.

    I recently had a problem where Vista Business 64-bit would only boot to a black screen with a mobile cursor - KSOD.   Who, in searching the Web I found is a fairly common problem with Vista.  I discovered that my only option was about to reinstall Vista CLEAN and all the other programs I had installed under it.  I can't believe that Microsoft released the 'repair installation option"similar to that of Windows XP, where you can hit the"R"key during installation and we left with nothing but the"System Restore"options and"Startup Repair ".  Neither of which has helped in my situation.  Since then, this was a dual system boot with XP Pro, then any restore point has been removed from the partition to Vista anytime, I started another recognized problem, by Microsoft, which Microsoft has made no significant effort to fix, in addition to recommending that you hide the partion Vista in XP - a whole of XP.  That beats a little the entire purpose of dual boot.

    As I tried to start in safe mode, it left me at the same point as a normal boot - black screen with a cursor.  I tried ctrl + alt + delete and nothing. Two Windows RE options did not help me.  This left me no option but to the completely reinstall Vista.   Why Microsoft did remove the ability for Windows Vista to install on herself from one location other than being inside the BONE you want to repair.. Please don't tell me that it is because Vista uses an image file instead of an installation as XP system.   I see no other reason for not allowing the upgrade of outside BONE in addition to Microsofts greed and paranoia that he can transform the operating system easier to install illegally.  I hope that some third party has actually changed the Vista installation routine to allow you to install Vista on itself, because as it is, it's really hard for me to even recommend Vista as the operating system or install any where else, if not the only recourse after loading OS, is to reinstall completely.

    Adobe, Autodesk, and almost all other software publishers... allow you to perform a "REPAIR" of their software installation, if something prevents you to load after installation.  Even MS Office has a routine repair.  Ms has an internal version of the Setup routine which allows outside the OS upgrade option that you want to "Upgrade" / repair? ".  If not, why?

    -Todd w.

    "Why Microsoft removed the ability for Windows Vista to install on herself from one location other than being inside the BONE you want to repair."

    «.. . After using XP's repair function, the operating system itself would become less stable and frankly not in a good state of repair. »

    As Todd, is the answer.

    "This response does not hold water as on one of my computers I've been running Windows XP for about four years now, after a repair install.

    Then, you were lucky.  Try to replace the system files on a computer that does not start even at a desk or safe mode usually will get a return to office, but will probably repeat the same problem in a few weeks.  Tech professional would only use this function to retrieve the data before a complete reinstallation.

    "I thought that this area was a place to really get answers instead of the ole same"answers of bs that are on all the other forums."

    It is a place that will try to help you fix your computer if you have problems.  It has technicians in computing, no decision-makers, developers or executives.  We will try to answer technical questions about problems you might have with Windows Vista.

    If you want to have input on the future of Microsoft operating systems, then help you beta-test and provide feedback to the developers.  Windows 7 and IE 8 are currently in beta.

    Another possible place you could make suggestions which could see the developers would be:

    https://connect.Microsoft.com/default.aspx

    Brent
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Funds/wallpapers don't fit down to the size of my screen after removing the Dreamscene for Windows 7 64.

    My screen/origins don't fit down to the size of my screen after removing the Dreamscene for Windows 7 64.  I ran a 32-bit uninstall reg. by mistake and now larger images appear only partially filling to the top of the visible area of the screen.  I have a laptop of Toshiba A505 displaying 1366 x 768 with Windows 7 64. Does anyone know the registry tweaks on how to solve this problem? Thank you very much.

    For any question on Windows 7:

    http://social.answers.Microsoft.com/forums/en-us/category/Windows7

    Link above is Windows 7 Forum for questions on Windows 7.

    Windows 7 questions should be directed to the it.

    You are in the Vista Forums.

    See you soon.

    Mick Murphy - Microsoft partner

  • I can't open the system when he was sht down. But the system was the heat and I have to remove the battery for a while and it should re-sttart, what the problem.

    I can't open the system when he was sht down. But the system was the heat and I have to remove the battery for a while and it should re-sttart, what the problem.

    Too generic a question, can you clarify considerably more for us? Your question could be reformulated in the following way and always be true?

    "I can't start my computer once he has had a BSOD. Something overheated, but I don't know. I removed the CMOS battery and replaced in order to asure me that a bad overclock on a core component has not caused the problem. Now, it restarts correctly, what is / was the problem? »
    The foregoing, what I thought you meant. The above statement is correct?
  • Why the latest version has removed the padlock for sites that require a login?

    It takes too much time on the high speed cable, to log my banking online. My body's response was that the latest version of Firefox had removed the icon of the lock for sites that require a connection. I want to know why it was deleted.

    The padlock shows only that there is a secure connection and does not guarantee that you are connected to the right server. So you could always be connected to the wrong server if you make a typing mistake in the URL and someone said that mistyped the URL. The lock feature has been replaced by the identity button of the Site on the left end of the address bar (address).

    https://support.Mozilla.com/en-us/KB/site+identity+button

    http://www.mozilla.com/en-US/firefox/security/identity/
    

    This has actually existed since Firefox 3.0

    If you still want a padlock icon also then

    https://addons.mozilla.org/en-US/firefox/addon/padlock-icon/
    
  • Remove the battery for long term industry uses on Qosmio

    Hi everyone, I remember reading somewhere that if you use your laptop on the sector for a long time (which I do now), it's a good idea to remove the battery to extend its life when you use it on battery power only.

    Is this true and will it void warranty or something like that or break my laptop?

    Thank you very much

    I put t see any reasons why you shouldn't t remove the battery when you want to run Notepad on the main power supply.
    I also think that this procedure will increase the performance of the battery life for a longer period.

    The guarantee must be valid. Please see also the drums section in the user manual.
    There you will find plenty of information and how to manage the battery

  • How to remove the default for a limited only account gateway (with static ip address)

    I have 1 pc with 4 accounts 1 account administrator and user the rest is limited accounts. I use a static ip address and the question is how to remove the default gateway on these limited account so that they cannot access the internet

    The entry door is fixed to the adapter and selectively cannot set properties of the different adapter for different users, all users use the same adapter.

    With Internet Explorer (does not work with other browsers), you can configure a proxy server with a fake address, you can do this through Group Policy, or you can do it manually for each individual user through the Internet Options settings.  You can set the proxy server address map of loopback (127.0.0.1) or you can set it to a bogus address of your private address range (usually the range 192.168.xxx.xxx)

    If you are using other browsers, you can use NTFS permissions to deny access to the Explorer or the program directory or you can use software restriction policies to deny access to specific programs.

    Alternatively, you can use a logon script to activate the network connection service when you open a session and the other to turn it off when you log, but if you do this you will disable the entire network for limited users if it cannot be a solution for them.  The script can be a simple two-line script:

    Logon script:

    SC config Netman start = demand
    net start netman

    Logoff script:

    net stop netman
    SC config Netman start = disabled

    These can be useful:

    http://www.howtonetworking.com/Internet/restrictie11.htm
    http://www.christianblog.com/blog/abelajohnb/disable-Internet-access-in-Windows-for-specific-user-accounts/

    John

  • Cannot change or remove the password for the account.

    Hi - I want to change my user account password, but this is impossible. I'm running Vista Ultimate x 64 SP1 with all updates.

    My user account is the original, was created to windows install with administrator privileges.

    When I change my password, it accepts my old password and the new successfully, indicates that the password has been changed and indeed accepts the new password when you log back.

    But if I restart or turn off the PC, he returned to the old password, but still remember the new password hint. I tried to remove the password, and Vista indicates that the password is deleted, but after it is restarted the old password is back in force once again.

    It starts to drive me crazy, and I searched all over the internet, but could not find a similar problem elsewhere, not to mention a solution.

    Any help would be much appreciated. Thanks in advance.

    Hi HoverDonkey

    Thanks for posting on Microsoft Answers.

    You have another user, you can sign up with?  If this isn't the case, create another user and log in as this user.

    Change the password for the new user, restart and the connection as long as the new user.  Were you able to login with the new password?
    If Yes, then there is a problem with 'your' user account, possible corruption.  Here is a link on how to fix a corrupted profile (user account) - Please post back and let us know if it helped to solve the problem - thank you

    http://windowshelp.Microsoft.com/Windows/en-us/help/769495bf-035C-4764-A538-c9b05c22001e1033.mspx
    Ken
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to remove the password for an administrator account?

    How can I remove my administrator account password? I'm the only user. I tried the knob to no password in the control panel but didn't success.

    What about the Bryans

    Hi Bryan,.
     

    Thank you for choosing Windows 8 and please provide an opportunity to help you.
     

    You use a Microsoft (with Microsoft electronic mail connection) or a local account?
     

    If you use a Microsoft account, you will need to enter your email password to log into your account. If you have a local account, you can remove the password by following these steps:
     
    (a) press the Windows key + C, select settings
    (b) click change PC settings, select users
    (c) click on change password under sign in options
    (d) when you are prompted, type your current password and leave the password empty.
     
     
    I hope this helps. If you have any other questions, please get back to us and we would be happy to help you.
  • remove the overlay for ContentType.unassigned

    Hi Forum,

    I attributed to remove the overprint fill "pageItems or splineItems, but it does not work the bottom of case...»

    How can I remove the overprint fill to the contentType.unnassigned.  Here is my script...

    var doc = app.activeDocument;

    var items = doc.pageItems;

    list var = []; List unassigned frames

    for (i = 0; i < items.length; i ++) {}

    If (items [i] .contentType is ContentType.unassigned)

    Items [i] .overprintFill = false;

    }

    The scale is placed as a character inside the cell.  When selected the text tool no overprinting appears. but when he is selected as frame of overprint fill is shown... Please see the selected inside the image...

    Screen Shot 2013-02-12 at 10.39.50.gif

    I also tried with this method...

    try {}

    table = app.activeDocument.stories.everyItem ().tables.everyItem ();

    tcolors = table.cells.everyItem () .everyItem ();

    for (i = 0; i < tcolors.length; i ++) {}

    TColor = tcolors [i];

    If (tcolor.fillColor.name == 'Pantone 357') {}

    tcolor.overprintFill = false;

    }

    If (tcolor.fillColor.name == 'Pantone 357') {}

    tcolor.overprintFill = false;

    }}

    }

    catch (e) {}

    Thank you & best regards,

    ATLAST, I found it... Here is the result!

    myDocument var = app.documents.item (0);

    app.findObjectPreferences = NothingEnum.nothing;

    app.changeObjectPreferences = NothingEnum.nothing;

    app.findObjectPreferences.overprintFill = true;

    app.changeObjectPreferences.overprintFill = false;

    myDocument.changeObject ();

    app.findObjectPreferences = NothingEnum.nothing;

    app.changeObjectPreferences = NothingEnum.nothing;

    Thank you Forum...

  • How can I remove the cover for the printing of books

    Hello

    I just bought a 5510e Photosmart aio, B111a. It says in the manual that it is possible to print or scan books by unscrewing the lid. But how do you go? Seems I have to resort to violence!

    Hello I am

    I rechecked everything on the device. As in the image, press the left side of the back cover with your thumb. The lid should unclip. The first time the cover can be a little stubborn. After that the left side is out you can push the cover to remove the cover on the right side.

  • How can I remove the need for a password at boot up?

    I have to enter a password at the startup of Windows 7 is up. How to remove the password required before starting on windows 7?

    BIOS or are you referring to syskey? http://blogs.technet.com/b/steve_lamb/Archive/2005/11/25/415098.aspx

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/reset-SYSKEY-password/c4d52cdd-b8b1-43da-857b-8fe19fab10d5

    Effective questions get help faster!

  • I lost all my media files after removing the battery for blackBerry Smartphones

    My employer asked me to remove the battery from the phone, as they had no trace of the IMEI no to my phone.

    When I reinserted it all my media files - videos, sound time and pictures - were gone.

    Again, I have all my contacts and continues to receive emails from work, so the phone had not been restored to preset.

    I have never had a media card, so all the files are in the phone's memory, are they retrievable?

    Now when I use the phone it wont let me not record a video as it is also no card inserted media. It wasn't a problem before.

    Why the battery would cause the memory to wipe?

    can anyone help?

    What is a device issued to the employer?

    You are on a BES (BlackBerry Enterprise Service) business account?

    The card is inserted correctly?

    Options > memory, made it sets out a memory card?

Maybe you are looking for