Re: Substring query

From: BP Margolin <bpmargo_at_attglobal.net>
Date: Fri, 16 Feb 2001 12:48:05 -0500
Message-ID: <#XxNUAEmAHA.1364_at_tkmsftngp05>


James,

It's a bit clearer, though I still do not understand either what "s" is or what you mean by the "entrys' key" in the following ...

> lookupA(s) = the set of entries such that s matches the pattern defined
> by the entrys' key
>
> or
>
> lookupB(s) = the set of entries such that the entrys' key is a
> substring of s

Again, might I ask for specific sample data (are the two URL's you posted sample data ?), and the specific results you are looking for given the sample data. It might help if you assume that I am a complete and total idiot, and that you have to explain everything to me. While I can't say that I'm looking to a 10K post from you, if you could perhaps post table schemas (CREATE TABLE's), and sample data (INSERTs) it would start putting it into database terms. Given data in a table, can you indicate what you want pulled from that table?



BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which can be cut and pasted into Query Analyzer is appreciated.

"James Avery" <avery_at_wapmore.com> wrote in message news:3A8D2CD9.9B1C07A0_at_wapmore.com...
>
>
> BP Margolin wrote:
> >
> > James,
> >
> > Would it be possible for you to post some sample data, and the results
 you
> > are looking for using that sample data?
> >
> > Perhaps it's just me, but I really can't make heads or tails out of what
 you
> > are requesting. Remember that you know your data and application, but we
> > don't, so examples are frequently very helpful in explaining a problem.
>
> I'm sorry if I didn't make sense. Here is an explanation of the problem
> using more words.
>
> The specific case in question goes thus:
>
> When given an URL, it may contain CGI-variables - some of which
> contribute to deciding the nature of the content that is returned (e.g.
> "function=weather"), and some of which are irrelevant (e.g. "usrid=..."
> or similar).
>
> Similarly, an URL may have parts that are generated based on e.g. the
> current date or on a previous CGI query.
>
> The task at hand is to bind some information to a "logical" resource, or
> in other words, a class of URLs that in some way are equivalent - and to
> look up this information using an instance of that class.
>
> For example: foo.org has a weather forecast that, given the date as
> parameters, tells you how the weather will be. When you log in, you
> choose your language, and a full instance of an
> URL might be
>
> "http://www.foo.org/bar/Chinese/weather.php?month=2&day=3"
> or "http://www.foo.org/bar/Dansk/weather.php?day=28&month=12&year=2002".
>
> Using either of these URLs as a query string for a lookup should give
> the same result.
> In this case, the requirement could be that the query string match the
> pattern defined by the
> regular expression:
>
>
>
/^http\:\/\/(www\.)?foo\.org\/bar\/([^\/]+)\/weather.php\?((month|day|year)\ =[^\&]*)+/
>
> So to reiterate the original question, what I am looking for is
> something that will allow me
> to write
>
> lookupA(s) = the set of entries such that s matches the pattern defined
> by the entrys' key
>
> or
>
> lookupB(s) = the set of entries such that the entrys' key is a
> substring of s
>
> If the first case is possible then we are done.
>
> In the second case, the database would have entries containing tuples on
> the form
>
> "foo.org/bar"
> =>
>
(/^http\:\/\/(www\.)?foo\.org\/bar\/[^\/]+\/weather.php\?((day|month|year)\= [^\&]*)+/,
> Info_for_weather)
> "foo.org" => (/^http\:\/\/(www\.)?foo\.org\/[^\/]+\/index\.html/,
> other_info)
> ...etc.
>
> lookupB(), using one of the two exaple-urls as the argument, would
> return both of the entries above, since both entries' keys are
> substrings of the query string, and one could check against the regular
> expressions in turn and find that only the first entry matches.
>
> I hope this makes my question clearer.
>
> Thanks in advance.
>
> --
> Med venlig hilsen,
> James Avery <avery_at_wapmore.com>
Received on Fri Feb 16 2001 - 18:48:05 CET

Original text of this message