Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Multi step query
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1452876360

Message started by Derek Van Ittersum on Jan 15th, 2016, 11:46am

Title: Multi step query
Post by Derek Van Ittersum on Jan 15th, 2016, 11:46am

Back again with a query I can imagine, but not code properly.

I have a file with the following data structure:

/Citations/ : This container holds notes with the following relevant attributes: $CiteKey(string) and $Research_Article(boolean). It contains only one note per $CiteKey. E.g., 1 note for Smith 1985, 1 note for Jones 2005, 1 note for Frank 2001

/Coding/ : This container holds notes with the following relevant attributes: $CiteKey(string) and $Text. It contains many notes per $CiteKey (which are the same cite keys as above). E.g. 5 notes for Smith 1985, 20 notes for Jones 2005, 15 for Frank 2001.

I want to find all notes for a given citation for which $Research_Article is true.

$CiteKey=="Smith1985" & $Research_Article==true  however, only returns the single note from the "Citations" container, not the notes from the "Coding" container. I want all those as well. Is it possible to construct a query to get this? Even better, could I do it in the Attribute Browser?

Title: Re: Multi step query
Post by Mark Anderson on Jan 15th, 2016, 11:59am

It sounds like the notes in /Citations/ have $Reasearch_Article set to true and those in the other container set to false. that would give the results you describe. If you flip the last term, i.e.

$CiteKey=="Smith1985" & $Research_Article==false

What do you get?

~~~~~~~~~
Likely you can use attribute browser, thuogh the setting are mott until we figure your attribute values correctly.

Title: Re: Multi step query
Post by Derek Van Ittersum on Jan 15th, 2016, 12:15pm

Mark, you're right. Since I didn't have $Research_Article set as a KeyAttribute, I hadn't really considered the notes in /Coding/ as having that attribute at all, but you're right, they have it set to false.

The reason for this is that the different containers were created via different spreadsheets with different columns of data (except for $CiteKey, which was the connecting point between them).

Is there some way to efficiently flip the $Research_Article to "true" for all notes that have at least one note for which it is true? I wouldn't want to create an agent for each $CiteKey to do this ...

Title: Re: Multi step query
Post by Mark Anderson on Jan 15th, 2016, 1:32pm

Surely you want to set $Research_Article to true for every note in the /Coding/ container (or at least those that have a value for $CiteKey).

Solution #1.  Use a stamp. Good if experimentation along the want mean setting/inheritance can't be relied on. Make a stamp of $Research_Article=true and apply as equired.

Solution #2. Make a query for inside("Coding")& $CiteKey with an action of $Research_Article=true.

Title: Re: Multi step query
Post by Derek Van Ittersum on Jan 15th, 2016, 1:51pm

Unfortunately, it's more complicated than that :(

I have many types of data in the /Citation/ container: research articles, book reviews, editor introductions, announcements, etc. Each of these has a CiteKey, but only one kind is a "research article." (I'm doing an analysis of 20 years of a journal, coding all of its contents.)

I am coding each kind of data in the /Coding/ container. So, there may be many notes here with CiteKeys that are *not* research articles.

I also have a similar dilemma with another attribute: "Word_Processor". This is a boolean that is "true" if the text uses that term and false if not. I will also be wanting to sort these by "research articles" as well using the same method.

If manual is the only way to go, it will be painful but possible.  I wonder if there's some way to generate a list the relevant CiteKeys via this:

inside("Citations") & $Research_Article==true

Then use that to maybe create a set that then could be used to flip all the relevant notes from /Coding/ to $Research_Article=true?

Title: Re: Multi step query
Post by Mark Anderson on Jan 15th, 2016, 3:04pm

It's not but it has to be manual, but 'full disclosure'  ;) of the data layout helps.

I'm not 100% sure just flipping the default for $Research_Article isn't just punting a problem down the road. Some errors are best accepted and fixed manually (speaking from humiliating experience); next time, thuogh... .

However, I'm still not 100% clear. You've a container "Coding" where some items are citations-related and there are *no* featires apart from the human eye to tell them apart. It may be so, but clearly the lesson here is that if something has a special staus, it's worth marking - be it a boolean, a tag (list) value or whaever.

My hunch is there will be some query that even if it does find only the research cites at least weeds out lots of notes you won't have to manually review. Without seeing the data, it's hard to say  - my all means drop me a copy at mwra at mac dot com which I'll treat in confidence.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.