Sparql query using variable paths

Hi,
I have a following graph in Oracle that I like to query using Jena 2.6.4 and OracleJenaAdaptor 11.2.0.3
ind:123 :hasA ind:124
ind:124 :hasB ind:125
ind:125 :hasC ind:126
ind:123 :hasD ind:127
Is there a way to construct a sparql query to return all ind: without "hard-conding" the full property name? Something in these lines (note, this query doesn't really work).
select *
where { ind:123 (:has*)+ ?x }
Thanks.

:hasA rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf :hasRelation .
:hasB rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf :hasRelation .
:hasC rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf :hasRelation .
:hasD rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf :hasRelation .
String q1 = "SELECT ?x, ?y
where {?x (:hasRelation)+ ?y} ";
Stirng q2 = "SELECT ?x, ?y
where {?x :hasRelation ?y} ";
Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
Attachment attachment = Attachment.createInstance(new String[]{"my_asset","my_model"},
new String[]{"OWLPRIME"}, InferenceMaintenanceMode.UPDATE_WHEN_COMMIT, QueryOptions.ALLOW_QUERY_INVALID_AND_DUP);
GraphOracleSem graph = new GraphOracleSem(oracle, "vm_model", attachment);
ModelOracleSem inferencedModel = new ModelOracleSem(graph);
Query query = QueryFactory.create(q1);
Edited by: a1239090 on Aug 15, 2012 4:54 PM

Similar Messages

  • Why parallel query use direct path read ??

    I think because access buffer cache needs latch and buffer block lock,if parallel query don't use direct path read ,parallel query will be impacted by Serialization mechanism such as latch and lock .so oracle choose direct path read to avoid it .
    anybody have a good idea ??
    Edited by: jinyu on Dec 8, 2008 7:52 AM

    jinyu wrote:
    I think because access buffer cache needs latch and buffer block lock,if parallel query don't use direct path read ,parallel query will be impacted by Serialization mechanism such as latch and lock .so oracle choose direct path read to avoid it .Jinyu,
    basically, yes I think that's it. The purpose of parallel query is to scan a very large segment, because the overhead of communication between the processes and maintaining/starting up the parallel slave renders the operation inefficient for small segments.
    Therefore I guess the assumption is that the segment to scan is probably very large, the fraction of the blocks in the buffer cache would be only very small in comparison to the blocks to scan, and therefore the reduced overhead of directly reading the blocks bypassing all the serialization issues of the buffer cache should outweigh the "un-buffered" blocks issue and save the buffer cache for objects that benefit more from being cached.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • How to query using CGI path for 'IN' sql statement

    Some problems that requires help:
    I have a report that requires a query which has 'IN' statement in SQL query. For example: SELECT EMP_ADDRESS1 FROM EMPLOYEE WHERE EMP_NO IN (:EMP_NO).
    I am going to query the result of this query using CGI. My peoblem starts here - I can't be passing a list of parameter for ':EMP_NO' because the path does not accept escape characters. I can't be put a query path below:
    <HTML>http://172.188.2.7/dev60cgi/rwcgi60.exe?server=9iAS&mode=default&destype=localfile&desformat=\\pri_wnt\generic&report=gcgd1.rdf&userid=comm/comm@employee<B>&emp_no='A','B','C'<B></HTML>
    What I am doing is that I will have a front end written in JAVA and display a listing of Employee available in the company. The user will be able to choose whatever employee on the front end. Then, I will call the CGI path to display the result to the user.
    Pls help. Kindly email personally([email protected]) or reply here.
    Thank you

    You'll need to escape your single quotes using %XX where XX is the hex code corresponding to the special character you want to use. I'm not sure what the escape code is for quotes. I know that if you wanted to have a space, this:
    ....../rwcgi60.exe?key+P_city='San Francisco'+....
    would need to look like:
    .../rwcgi60.exe?key+p_city=San%20Francisco+...
    You'll need to find out what the number for quote is. HOpe that helps a bit.
    Toby

  • WITH CLAUSE in SPARQL - Running SPARQL query using JENA

    Hi,
    Can anybody help me how to use WITH Clause in SPARQL. Below is my Query. I am using Jena 2.6.3 to Run my Query.
    "PREFIX assc: <http://www./.../> " +
    "WITH " +
         "( " +
                        " select ?associate" +
                        " where {?associate assc:belongsTo <http://www./../Relationship>} " +
                        " AS :associateList" +
         " )" +
                   " select ?client ?associate " +
                   " where { ?client assc:Sees ?associate . ?associate assc:belongsTo <http://www./../Relationship> ." +
                   " :associateList(?associate) }" ;
    Thanks and Regards,
    Manish Hardasmalani

    Hi Zhe,
    Actually i am looking for example say,
    I have a select query where i get id , name and mark this output as a relationshipName
    And then use this relationshipName as a function in second select query.
    Example:
    WITH
    SELECT ... WHERE {...} AS relationName
    SELECT ... FROM <graph> where {... :relationName(...) [FILTER(...)]}
    In the above pseudo code relationName is populated in first select and used in second select. I am searching something similar to this.

  • Select query using variable

    Hi all,
    If I have a variable with multiple value (returned from bulk collect), how can I pass it into a select query as a condition?
    Eg.
    set serveroutput on
    declare
    type v_LockSessInfo is table of integer;
    empdata v_LockSessInfo;
    begin
    select unique sid bulk collect into empdata from v$lock;
    [select sid,serial#,username from v$session where sid in (empdata)]
    end;
    I hope to be able to pass in the variable collected, into the next select statement. How can I achieve it?
    Thanks in advance.
    Eugene

    Sorry for any confusion caused, I have almost 0 knowledge on pl/sql, only can survie on normal sql query.
    Further elaboration, the intention of my query is to query out any locking that exists in my DB. It meant to serve as a report to management, so I have to break it down into couple of sections for easier reference (minimising the complication that may arise from others who view the report).
    Couple of steps/procedures I am thinking of:
    1) query out the unique sid that exists in v$lock (blocking and blocked sessions) <<< this set of returned record (SIDs) should be stored in a variable.
    Eg. achived by the select statement "select unique sid from v$lock into [variable]"
    2) query v$sessions for the lock details from step 1's output. Username, sid, serial#, machine etc.
    Eg. To be achieved by "select sid,serial#...... from v$session where sid in [variable]; Same condition applies to 2 and 3.
    3) query v$locked_object to identify which are the blocking/blocked sessions, and who's blocking who from step 1's output.
    4) query the locked object and locked record (based on rowid locked) from step 1's output.
    This is all that I can think of at the moment. Any opinions that can perform the above activity will be appreciated alot. Hope I'm able to clear up any confusion triggered.
    PS: I can't re-query the SID as the SID may change or be lost upon the re-query therefore losing any evident. Thus I was thinking of putting it into a variable for consistent querying for step 2,3 and 4. All 4 steps will be performed within a single script.
    Regards
    Eugene
    Edited by: eteo78 on May 28, 2009 8:40 AM

  • Maximum Size of bind variables/model names in a SPARQL query

    I was wondering what the maximum field size is for a bind variable (?'' being used in the subject or object within a triple) in a SPARQL query using the Jena Adapter for Oracle? The reason for this is that I keep getting Oracle exception (ORA-00972: identifier is too long) when executing queries.
    The other question dealt with the max size of the model names? Is there anyway to increase this length by extending certain classes within the Jena Adapter for Oracle?
    Thanks,
    Rahul

    Hi,
    For model names, because we use model names together with some suffixes to create namespace tables, application tables, and indexes, the length
    has to be shorter than 30 bytes - 11 bytes = 19 bytes.
    Note that 30 bytes limit is imposed by Oracle database. You cannot create a table with a name longer than 30 bytes.
    11 bytes is the maximum suffix length imposed by Jena Adapter. We are considering to reduce it to 4 for the next Jena Adapter release.
    For variable names, because we translate SPARQL to SQL queries (and variable name to column alias), there is the same 30 bytes limit.
    Note that there are suffixes for variable names as well. For example, $RDFVID, $RDFLTYP, ... These suffixes are used internally.
    Some simple tests for illustration purpose.
    SQL> create table a23456789012345678901234567890(i int);
    Table created.
    SQL> create table a234567890123456789012345678901(i int);
    create table a234567890123456789012345678901(i int)
    ERROR at line 1:
    ORA-00972: identifier is too long
    -- Assume table X has a column I
    SQL> select i as "v23456789012345678901234567890" from x;
    no rows selected
    SQL> select i as "v234567890123456789012345678901" from x;
    select i as "v234567890123456789012345678901" from x
    ERROR at line 1:
    ORA-00972: identifier is too long
    Hope it helps,
    Zhe Wu

  • Crystal Reports with BEx Query using Custom Exit Variable

    Hi,
    We have BW BEx Query using Customer User Exit variable to derive  the Fiscal Week for Last Year (called it VAR2) based on another user input variable Current Fiscal Week (called it VAR1).
    VAR2 is derived from VAR1 in CMOD via some codings and thus it DOES NOT have the "Variable is Ready for Input" flag ticked in the BEx. VAR1 is user input variable, so it has "Variable is Ready for Input" flag ticked in the BEx.
    When we create a Crystal Reports with the BEx Query using variable VAR2, and when we run it we got an error message saying "Failed to execute query; '[]<java.lang.UnsupportedOperationException: No Selection State Support!ZP_MI_LYPUBWEEK>'. Redesign your query or contact the data source maintainer to solve the problem".  (note: ZP_MI_LYPUBWEEK is VAR2 in this case).
    Could anyone please assist? Surely, CR supports BEx customer user exit variables like the above, right?. I also refer to the forum below as it seems to have a similar issue (except mine with an error message), but it does not provide a solution in it.
    Crystal Reports with BEx Query using Custom Exit Variable
    Thanks,
    Andy

    Hi Vibhav,
    We have the SAP Crystal Reports for Enterprise XI4.0 Version 14.0.0. Not sure if SP0 or other SP, got to check with Basis Team later.
    We tried that "mandatory" option and did not work either.
    Anyway, SAP has now come back again saying it is something they will fix it in next release/version. We got a phone call from them and a reply below to our OSS.
    23.08.2011 - 08:20:49 CET - Info for Customer by SAP  
    I have raised this issue on the Idea#s Place as an enhancement request
    on the below link:
    https://cw.sdn.sap.com/cw/ideas/5586
    This ER contains the information of including the customer exit
    variables in the report without checking the #input for ready# option.
    This ER can be considered for being implemented in the future
    versions. You can refer to SAP Note: 1515837 - How To: Enhancement
    Request Process - "Idea Place" for more information regarding the Idea
    Place.
    Cheers,
    Andy

  • Averages in a query using a variable with Replacement Path: Replacement wit

    I have two queries. Query1 has a handful of characteristics, one of which is used in a formula where I used replacement path in order to be able to use it in some calculated key figures. I also have a couple of key figures that are not calculated and they are averages.
    The second query has a characteristic value variable that is replaced with the first query. This replacement value variable is placed into the filter section and the characteristic itself is placed in the rows section. I am bringing in the same calculated key figures that were in my first query as well as the normal key figures that are averages.
    The issue I am having is the regular key figures that I am bringing in are coming in summed up instead of as averages. Is it possible to bring the normal key figures in Query1 as averages into Query2?
    There is more information in the thread below if you need more background.
    [Replacement Path and Aggregation;
    PS - I am using 7.0.

    Hi Satyakam,
    In the text variable properties make sure that in the replacment path you have chosen "Text" to appear date as per user setting . Other wise as in your case it must be set to "Key" which always shows in the format YYYYMMDD.
    Hope that helps.
    Regards
    Mr Kapadia

  • How do I...Mimic Replacement Path with Query using Customer Variable Exits?

    Hello SDN:
    We are on BW 3.5 SP16.
    We are currently using a replacement path Query(RP) with variables
    to populate a variable in another Query(T).
    The problem we are having is with performance.
    The entry of variables in replacement path Query(RP) is optional (This is necessary there cannot be required values)
    When results from Replacement Path Query are small performance is fine. (e.g. 10 seconds)
    When results from Replacement path query are large performance suffers. (e.g. 1+ minutes)
    Users are free to leave the replacement path variables empty resulting in a large set of data to be replaced. This is the worst performance case.
    We would like to discover a way to conditionally execute the replacement path query. That is if users do not enter values for the replacement Query(RP) variables do not execute the replacement path query(RP).
    Does anyone know if this is possible within reason and in customer exit space?
    We have reviewed the situation from all angles and the requirement for the replacement path FUNCTIONALITY and the freedom for the user to leave variable values blank remains.
    I've been searching and reading SDN and SAP notes for about a week and do not find threads which address this situation.
    We are also exploring Customer variable exits to mimic replacement path functionality
    (different topic subject="How do I...Mimic Replacement Path with Query using Customer Variable Exits?")
    Any help will be appreciated
    Many thanks
    David Schuh

    My appologies-I posted this message with the wrong subject. I will repost it with appropriate subject.
    dave schuh

  • How to feed a query using a variable defined as Replacement Path-Query

    Scenario description : BI NetW 2004S - InfoCube with the following characteristics Customer, OrderDate, OrderYear and the following KeyFigure Number of Pieces.
    Objective: I need a query "QB" that shows how many pieces a set of customers has ordered in the year 2008. The set of customers is defined as all customers that in the previous years (the user can select one or more years) have ordered more than 500 pieces within the same year.
    Implementation: In general terms the idea is to build a query "QB" with the characteristic "Customer"  that is restricted (filtered) using a variable that is fed by another query "QA" (Replacement Path-Query).
    In order to have the selection of customers that for each of previous years (2007, 2006, 2005,...) have ordered more than 500 pieces, in the query "QA":
    - I put OrderYear as filter and defined a variable in order to ask the user which year/s he wants to analyse to define the selection
    - I put Customer and OrderYear in row
    - I put the KeyFigure Number of Pieces in column
    - I've defined the following condition: Number of Pieces > 500 with the option Caracteristic Assignment = All Characteristics in the Drilldown Indipendently
    Now if I run the query "QA" it works correctly showing me all customers that in the selected years have ordered more than 500 pieces within of the same year.
    If I run the query "QB" it shows a correct result only if I enter only one year (for example 2006) in the OrderYear field (coming from the query "QA"); if I enter more than one year (for example 2006 and 2007) the selection of customers showed is not the same defined by the first query "QB": I was expecting to see all customers defined from the first query less all customers that have no ordered any piece in 2008.
    Questions
    1) Why is query "QA" working on a different selection of customers when the user selects more than one year?
    2) Cosidering the scenario and the objective described above do you have any other idea?
    Thanks
    Ciao
    Roberto

    Hi Christophe,
         it's ok for me if I consider the customer only once in the final selection of customers that feeds the final query, this is my objective.
    However as test I've created 2 "input" queries, one related to 2006 and one related to 2007, and then in my destination query I've tried to restrict the customer using 2 variables of type replacement path-query (one attached to the 2006 query and one attached to the 2007 query). Unfortunately when I try to check and save the destination query, Query Designer tells me it is not possible to restrict the characteristic in this way.
    Could you please describe me steps you run in to order to restrict a characteristic using more than one variable of type replacement path-query?
    Thank you in advance for your answer.
    Ciao,
    Roberto

  • Formula variable using Replacement path not working

    Dear All,
    I am using a query to calculate YTD values in the report. I am using a formula variable to calculate the number of months. Formula is
    Month To - Month From+1
    When I am giving the range from 001 to 006 for period in th evariable screen,
    I am gettung Month To as 6 and Month From as 6 with total no . of months as 1.
    I think Month From is not being caculated properly. I created another formul variable using Replacement path, for characteristic Posting period, replace with a Key and dimension ID as number with out any offset.
    Still not working.
    Any suggestions.
    Thanks and Regards,
    Srini
    Edited by: Srinivas on Apr 24, 2008 11:13 AM

    Hello,
    I have seen this document already. It is slightly different from what I am trying to do here than what the post shows. How ever,  I did everything right, atleast seems to be and don´t know why I am not getting the From value from the posting period selected. To value variable is coming right.
    Any more sugegstions.?
    Thanks and Regards,
    Srini

  • Using Variable Replacement Path with Hierarchies

    Hi,
    I have a requirement where I have two product hierarchies.
    In my report I want the user to be able to select which hierarchy they view at run time.
    I want them to be able to see this hierarchy as a tree,in order for me to do this I first must inlcude one variable to specify which hierarchy i am going to use, then the next Variable2 is populated by Variable1 and allows the users to expand on that hierarchy tree.
    E.g
    At Run Time
    Selection 1: User selects Product Hierarchy1
    Selection 2: Gets automatically populated based on selection 1 to show the product hierarchy tree for this variable.
    I have tried using replacement paths to do this but it does not allow this.
    Any ideaS?
    Thanks

    It finally worked, looks like the reason it was not working was a Query Designer exception issue whihc went with a re-start of Query Designer.
    All good

  • Create a formula variable using replacement path for current date

    Hi All,
    I created a formula variable using replacement path for current date.
    But when i used this variable am getting an error message saying .
    " This Variable cannot be used in this query".
    Could you please let me know the reason?
    Thanks,
    Zehra

    Hi All,
    Thanks for all your help...
    I just found a solution via the below link
    in Bex Formula variabel, Current calander day(sap exit) missing.
    Here he is trying to use the existing formula variable.
    My doubt here is, Even i could not find this varaible in BEX formula variable, But could see this in BI Content path as mentioned in the above link.  DO i have to transport this varaible , or i simply can activate it in production?
    I just could find this in BI Content but not in MetaData Repository.
    Thanks,
    Zehra

  • How to use Replacement Path Variables to perform Date Calculations

    Hi Experts,
    Can anyone make me clear about:How to use Replacement Path Variables to perform Date Calculations???????
    Thankyou in advance..
    shankar

    In left panel select the time Dimension
    Then hit new variable in that
    give the Name and Description for the Variable
    In processing by hit Replacement Path
    In reference characterisitcs use Calendar Day...
    As ur intention is to use it for Date
    Then in adjacent tab use
    Replace variable with Query / Variable
    Then u can use Offset length and offset start for controoling the display of your variable.
    Use as single, multiple single, interval, selection option as uwish
    HIt okey
    and you are good to go

  • How to get a field that using variable in order to create a query

    Hi,
    I found a difficulty when creating a query. so, I would like to ask you some question.
    1. How to get a field that using variable which that field I want to put it in my query?
    For example, I would like to take quantity field in inventory audit report. And when I put my cursor in
    quantity field, there was only variable, item, etc. How to get this and put it in query?
    2. How to combined the invoice quantity with inventory audit report quantity?
    3. I have a query like this:
    SELECT distinct T0.[DocDate] as 'Tanggal', T0.[DocNum] as 'No.Faktur', T1.[ItemCode] as 'Kode Barang',
    T1.[Dscription] as 'Deskripsi', T1.[Quantity] as 'Quantity', ((T1.[LineTotal])/(T1.[Quantity])) as 'Harga
    Satuan', T1.[LineTotal] as 'Harga Total', T3.[CalcPrice] as 'HPP Satuan', ((T3.[CalcPrice]) * (T1.
    [Quantity])) as 'HPP Total', T4.[ItmsGrpNam] as 'Jenis Barang', T5.[SlpName] as 'Nama Sales', T1.
    [WhsCode] as 'Kode Gudang' FROM [dbo].[OINV] T0 INNER JOIN [dbo].[INV1] T1 ON T0.DocEntry =
    T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OINM T3 ON T2.ItemCode
    = T3.ItemCode INNER JOIN OITB T4 ON T2.ItmsGrpCod = T4.ItmsGrpCod INNER JOIN OSLP T5 ON
    T0.SlpCode = T5.SlpCode WHERE T3.[TransType] = '13' and T3.[CreatedBy] = T1.[DocEntry] and T0.
    [DocDate] >=[%0] and T0.[DocDate] <=[%1] and T4.[ItmsGrpNam] =[%2] and T1.[WhsCode] =[%3]
    Is it possible if I just take one invoice with invoice quantity and only show up at once although I have a
    lot item cost for that item? (because I'm using FIFOmethod).
    Please help me.. cause I'm stuck with this thing :l.
    Thank you very much, and I'm waiting your respon soon.
    Regards,
    Sisca

    Try this one:
    SELECT distinct T0.DocDate as 'Tanggal', T0.DocNum as 'No.Faktur', T1.ItemCode as 'Kode Barang',
    T1.Dscription as 'Deskripsi', T1.Quantity as 'Quantity', ((T1.LineTotal)/(T1.Quantity)) as 'Harga
    Satuan', T1.LineTotal as 'Harga Total', T3.CalcPrice as 'HPP Satuan', ((T3.CalcPrice) * (T1.
    Quantity)) as 'HPP Total', T4.ItmsGrpNam as 'Jenis Barang', T5.SlpName as 'Nama Sales', T1.
    WhsCode as 'Kode Gudang'
    FROM dbo.OINV T0 INNER JOIN dbo.INV1 T1 ON T0.DocEntry =T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OINM T3 ON T2.ItemCode = T3.ItemCode AND T3.TransType = '13' and T3.CreatedBy = T1.DocEntry AND T3.Warehouse = T1.WhsCode
    INNER JOIN OITB T4 ON T2.ItmsGrpCod = T4.ItmsGrpCod
    INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
    WHERE T0.DocDate >=[%0\] and T0.DocDate <=[%1\] and T4.ItmsGrpNam =[%2\] and T1.WhsCode =[%3\]
    Thanks,
    Gordon

Maybe you are looking for

  • WebEx SSO with Microsoft AD 2008

    Hello Everyone, We are trying to setup our Microsoft AD to sync our accounts with WebEX Connect, using the SSO (Single Sign ON) We are only able to use the Domain credencials when we are inside on the corporate network and logging on the WebIM. Do we

  • Why can't I download my photos from Canon camera. Every thing worked fine with iPhoto

    I can not down load my canon photos to the new Photos app!!?? What's the story and how can it be fixed!!!!!

  • HTTP Response as Attachment

    Hello, I have a synchronous http scenario. I use a SOAP receiver adapter with "Do not use SOAP envelope" marked. However when checking monitoring for the http response I just have "MainAttachment (text/html)" displayed in Payload. So obviously there

  • Western Digital 320gb "not readable" by Mac OS

    I plug my Western Digital My Passport 320gb drive into my eMac, and I get the message "the disc you inserted is not readable by this computer." It works fine on Windows XP and my Eee PC 701 (running the default Xandros OS.) Can anyone help? Thanks in

  • Reader 11.0.05 Mui update

    Is there not a mui update for this version? The webpage only shows one for "All Languages". In the past there has been one for MUI and "All Languages". Is this update not applicable to MUI? I dont see not of it in the bullentin.