Thanks, Steve.

I may have to use dc:identifier. Creating a RELS-EXT stream just to solve this particular issue isn't worth the effort.

As for objective: I'd like to use the PID's namespace to distinguish between 'approved' objects and objects which are 'work-in-progress'. The approved objects will be indexed and searchable via Lucene/Solr on a public web-site whereas the 'work-in-progress' objects will deliberately be excluded from that index.

Consequently, my data management application needs to retrieve 'work-in-progress' objects by PID namespace. That's possible via the REST API 'findObjects' method - but it doesn't have the 'order by' clause so I'd have to do any ordering within my application - certainly possible but less efficient. I'd hoped to use iTQL to have Mulgara do the ordering.

I guess I'll have to request an enhancement to the REST API.


Janna


Steve Bayliss wrote:
I believe that dc:identifier is your only option - unless you create your own triple in RELS-EXT, with a literal object corresponding to the PID - there is no other triple that is automatically created that as the PID as a literal object. I see that you are actually restricting your query on the PID being "demo*" - ie on the namespace part of the PID. What is your overall objective with this "PID=demo*" part of the query? Are you trying to exclude "system" objects and only include "user" objects? -----Original Message-----
*From:* Janna Wemekamp [mailto:[email protected]]
*Sent:* 15 April 2009 01:45
*To:* Steve Bayliss
*Cc:* [email protected]; 'Gramsbergen, Egbert'
*Subject:* Re: [Fedora-commons-users] Questions re iTQL queries involving PIDs

    Yes, querying the DC identifier will work but  I'd really prefer
    not to build that assumption into my application.

    One of the reasons I'm experimenting with FC's Resource Index
    Search API is that iTQL has an *'order by'* clause unlike the REST
    API's *'findObjects'* method. If the REST API provided an *'order
    by'* clause, I probably wouldn't need to use iTQL.

    Thanks for your suggestion, though.


    Janna


    Steve Bayliss wrote:
    I think using
and $object <dc:identifier> 'demo*' in <#ri-fullText>
    in the full-text part of your where clause should work (ie the
equivalent of has-pid is to search for the dc:identifier). Obviously this depends on what values you are actually putting in
    dc:identifier in the DC datastream; I'm assuming from your
    earlier examples that you are just putting the PID in this field.
NB you need to make sure you have turned on full-text indexing. -----Original Message-----
    *From:* Janna Wemekamp [mailto:[email protected]]
    *Sent:* 14 April 2009 02:20
    *To:* Steve Bayliss
    *Cc:* [email protected]
    <mailto:[email protected]>;
    'Gramsbergen, Egbert'
    *Subject:* Re: [Fedora-commons-users] Questions re iTQL queries
    involving PIDs

        Hi all,

        Thanks very much Steve; your comments did help!

        I had mis-interpreted the Mulgara documentation on
        <mulgara:is> which states that it requires a non-variable
        value as its object. I had assumed the non-variable value had
        to be a literal.

        (My apologies to Egbert who indicated that earlier.)

        Still unresolved is the more general query I posed in the
        original posting:

            select $object, $label, $identifier
            from <#ri>
            where $object <fedora-model:label> $label
            and     $object <dc:identifier> $identifier
            and     $object <has_pid> 'demo*' in <#ri-fullText>

        How does one specify the <has_pid> predicate/property in this
        query?
        I suspect it's not possible - anyone able to confirm that?


        Cheers!


        Janna


        Steve Bayliss wrote:
        You've got a mistake still in your query
> /and $object <mulgara:is> 'info:fedora/demo:10' /
        You should be specifying your Fedora object identifier as a
        URI, not a literal, ie
// /and $object <mulgara:is> <info:fedora/demo:10> /
        There's no such thing as "the '$object' concept" - $object
        is simply a variable; you can substitue $object with $x (or
        $pid) and get the same results.
NB for debugging, it's sometimes useful to show all
        relationships for a particular object, so that you can see
        what triples actually exist whilst debugging a query, for
        this you can use something like
select $s $p $o
        from <#ri>
        where
        $s $p $o
        and
        $s <mulgara:is> <info:fedora/demo:10>
Hope that helps Steve

            -----Original Message-----
            *From:* Janna Wemekamp [mailto:[email protected]]
            *Sent:* 09 April 2009 04:31
            *To:* Gramsbergen, Egbert
            *Cc:* [email protected]
            <mailto:[email protected]>
            *Subject:* Re: [Fedora-commons-users] Questions re iTQL
            queries involving PIDs

            Thanks for the responses.

            However, the query

            /select $object $label $identifier $state
            from <#ri>
            where $object <fedora-model:label> $label
            and   $object <dc:identifier> $identifier
            and   $object <fedora-model:state> $state
            and   $object <mulgara:is> 'info:fedora/demo:10'/

            doesn't return any results either. (Yes, there is an
            object with pid demo:10.)

            I'm beginning to wonder whether '$object' and 'pid' are
            considered quite
            different beasties by FedoraCommons even though they
            'look' the same in a query
            result...

            (And, I have read the documentation on the mulgara
            web-site several times. It
            doesn't define the '$object' concept.)

            Cheers.

            Janna Wemekamp


            Gramsbergen, Egbert wrote:

            Back to the original question: try with

            $object <mulgara:is> <info:fedora/demo:10>

            That should work.
            Success,

            Egbert Gramsbergen
            -----Original Message-----
            From: arne anka [mailto:[email protected]]
            Sent: Wed 4/8/2009 12:37 PM
            To: [email protected]
            <mailto:[email protected]>
            Subject: Re: [Fedora-commons-users] Questions re iTQL
            queries involving PIDs

            fighting with itql since yesterday again ...


            > (1) The query:
            >
            >     select $object from <#ri> where $object
            <mulgara:is> 'demo'
            >
            > returns a single element:
            >
            >     <result>
            >       <object>demo</object>
            >     </result>
            >
            > even though there is no object in the repository with
            this PID.


            of course it does -- you defined that $object _is_ 'demo'.
            so, that's what you get.


            > I'd like to be able to issue queries like:
            >
            >     select $object $label $identifier $state
            >     from <#ri>
            >     where $object <fedora-model:label> $label
            >     and   $object <dc:identifier> $identifier
            >     and   $object <fedora-model:state> $state
            >     and   $object <mulgara:is> 'demo:10'
            >
            > This query returns no results even though the PID
            'demo:10' exists.
            > What am I doing wrong?

            you never really got $object -- what you do is saying
that $object has the model $label.
            but since $label is never assigned a value ...



            > (2) I'd also like to perform wild-card searches on
            PIDs; for example
            >
            >     select $object, $label, $identifier
            >     from <#ri>
            >     where $object <fedora-model:label> $label
            >     and     $object <dc:identifier> $identifier
            >     and     $object <has_pid> 'demo*' in <#ri-fullText>
            >
            > How does one specify the <has_pid> predicate/property
            in this query?


            you might be able to taht with 'having'


            > The following works quite happily but I'd not like to
            assume that the DC
            > identifier always matched the PID.
            >
            >     select $object $label $identifier
            >     from <#ri>
            >     where $object <fedora-model:label> $label
            >     and   $object <fedora-model:ownerId> $ownerId
            >     and   $object <dc:identifier> $identifier
            >     and   $object <dc:identifier> 'demo*' in
            <#ri-fullText>
            >

            well, basically, $object should be your id -- what you
are doing wrong is getting $object at all.
            imo it has to go like that:

select $object $label $identifier from <#ri> where $object <fedora-model:hasModel> <info:fedora/my:model> and ...

            or for your label (untested) something like:

select $object $label $identifier from <#ri> where $object <fedora-model:label> 'a label name' and ...

            see http://docs.mulgara.org/itqlcommands/select.html

            
------------------------------------------------------------------------------
            This SF.net email is sponsored by:
            High Quality Requirements in a Collaborative Environment.
            Download a free trial of Rational Requirements Composer
            Now!
            http://p.sf.net/sfu/www-ibm-com
            _______________________________________________
            Fedora-commons-users mailing list
            [email protected]
            <mailto:[email protected]>
            https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
            This SF.net email is sponsored by:
            High Quality Requirements in a Collaborative Environment.
            Download a free trial of Rational Requirements Composer Now!
            http://p.sf.net/sfu/www-ibm-com
_______________________________________________
            Fedora-commons-users mailing list
            [email protected] 
<mailto:[email protected]>
            https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to