emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [feature request] Org as an Excerpt Database (or Multivalue Properties)
@ 2011-12-10 21:50 Sven Bretfeld
  2011-12-11  0:09 ` Herbert Sitz
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Bretfeld @ 2011-12-10 21:50 UTC (permalink / raw)
  To: emacs-org

Hi all

Is it possible to give a property more than one value? 

I have an org file with a collection of citations and I want to give
them a number of keywords. For example:

* Ethics of a Hacker's Life
  :PROPERTIES:
  :author: Richard Stallmann
  :source: http://www.brainyquote.com/quotes/authors/r/richard_stallman.html
  :keywords:  money, code-writing, career, ethics
  :END:
  I could have made money this way, and perhaps amused myself writing
  code. But I knew that at the end of my career, I would look back on
  years of building walls to divide people, and feel I had spent my life
  making the world a worse place.

A property search for "code-writing" should match this citation and all
others with this property. An additional search for "career" should
narrow the matches down. But orgmode understands "money, ... ethics" as
ONE value, not FOUR. That's the problem.

Of course, this could be done with Tags, but with more than four or five
tags the line would become unreadable. It would also be possible to have
several properties "keyword_1: money", "keyword_2: code-writing" etc.
But then property searches would be useless (because sometimes you have
"money" as keyword_1, sometimes as keyword_2 or keyword_15).

*Why I consider this a worthwhile feature request:*

It is meant for authors or researchers. When I read something, I use to
make and collect excerpts of passages I find useful or interesting. When
writing an article or book, this excerpt-collection can be queried like
a database for certain keywords in order to find what you have read on
the topic. I think that many of us could use such a possibility. 

This should be a fairly easy thing to do with orgmode. Is there already
a module capable of doing what I want?

Thanks

Sven

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [feature request] Org as an Excerpt Database (or Multivalue Properties)
  2011-12-10 21:50 [feature request] Org as an Excerpt Database (or Multivalue Properties) Sven Bretfeld
@ 2011-12-11  0:09 ` Herbert Sitz
  2011-12-11  8:00   ` Christian Moe
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Sitz @ 2011-12-11  0:09 UTC (permalink / raw)
  To: emacs-orgmode

Sven Bretfeld <sven.bretfeld <at> gmx.ch> writes:
> 
> 
> A property search for "code-writing" should match this citation and all
> others with this property. An additional search for "career" should
> narrow the matches down. But orgmode understands "money, ... ethics" as
> ONE value, not FOUR. That's the problem.

Sven -- 

I think you should be able to get results you want using "regular expression"
searches on your 'keyword' field.  E.g., the following tags-todo search should
find headings that have both 'career' and 'code-writing' in a 'keyword' property:

keyword={career}keyword={code-writing}

This search would find headings that had one or the other or both:

keyword={career\|code-writing}

Regular expressions start out simple but can get very complex.  I expect there's
a way to get whatever you want out of the "multi-value" property strings you
want to use.

-- Herb

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [feature request] Org as an Excerpt Database (or Multivalue Properties)
  2011-12-11  0:09 ` Herbert Sitz
@ 2011-12-11  8:00   ` Christian Moe
  2011-12-11 16:21     ` Sven Bretfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Moe @ 2011-12-11  8:00 UTC (permalink / raw)
  To: Herbert Sitz; +Cc: emacs-orgmode

Hi,

I've successfully used the regular expression searches Herbert Sitz 
describes to search and query a small (~ 500 kB) Org database of all 
my source materials (text clippings) for a project, where some of the 
properties I used had multiple values.

You will find Matt Lundin's Advanced searching tutorial invaluable:

http://orgmode.org/worg/org-tutorials/advanced-searching.html

Org has some basic support for multivalue properties, mainly for 
editing (getting, putting, adding, removing) and also a membership 
test. See the manual:

[[info:org#Using%20the%20property%20API]]

Note that unlike your example setup, the values are not comma-separated.

The multivalue support does not, as far as I remember, extend to match 
expressions for searches etc. This would probably be non-trivial to 
implement. Something could probably be cobbled up with 
org-entry-member-in-multivalued-property. But regexp searches are 
fairly simple to use, and work now.

You'll want to think carefully about what you put in properties, what 
you put in tags, and what you put in multi-value properties, with a 
view to making this easy to search and change as your file grows.

Yours,
Christian



On 12/11/11 1:09 AM, Herbert Sitz wrote:
> Sven Bretfeld<sven.bretfeld<at>  gmx.ch>  writes:
>>
>>
>> A property search for "code-writing" should match this citation and all
>> others with this property. An additional search for "career" should
>> narrow the matches down. But orgmode understands "money, ... ethics" as
>> ONE value, not FOUR. That's the problem.
>
> Sven --
>
> I think you should be able to get results you want using "regular expression"
> searches on your 'keyword' field.  E.g., the following tags-todo search should
> find headings that have both 'career' and 'code-writing' in a 'keyword' property:
>
> keyword={career}keyword={code-writing}
>
> This search would find headings that had one or the other or both:
>
> keyword={career\|code-writing}
>
> Regular expressions start out simple but can get very complex.  I expect there's
> a way to get whatever you want out of the "multi-value" property strings you
> want to use.
>
> -- Herb
>
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [feature request] Org as an Excerpt Database (or Multivalue Properties)
  2011-12-11  8:00   ` Christian Moe
@ 2011-12-11 16:21     ` Sven Bretfeld
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Bretfeld @ 2011-12-11 16:21 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Herbert Sitz

Hi Christian and Herbert

Christian Moe <mail@christianmoe.com> writes:

> I've successfully used the regular expression searches Herbert Sitz
> describes to search and query a small (~ 500 kB) Org database of all
> my source materials (text clippings) for a project, where some of the
> properties I used had multiple values.
>
> You will find Matt Lundin's Advanced searching tutorial invaluable:
>
> http://orgmode.org/worg/org-tutorials/advanced-searching.html
>
> Org has some basic support for multivalue properties, mainly for
> editing (getting, putting, adding, removing) and also a membership
> test. See the manual:
>
> [[info:org#Using%20the%20property%20API]]
>
> Note that unlike your example setup, the values are not comma-separated.
>
> The multivalue support does not, as far as I remember, extend to match
> expressions for searches etc. This would probably be non-trivial to
> implement. Something could probably be cobbled up with
> org-entry-member-in-multivalued-property. But regexp searches are
> fairly simple to use, and work now.

This is a fairly good solution. Thanks for hinting me to that solution
and the worg-site. After having worked with regexp-searches for a day, I
see that I can do what I want. Anyway it's quite an amount of typing.

For some reasons I noticed a strange bug (?) connected to
regexp-searches. Whenever I do a org-tags-view, some of my org-files get
the double asterisk in the status-bar. They haven't changed but Emacs
tells me that they had. This always happens to the same three files,
other org-files are untouched. 

Does anybody else have that phenomenon?

Greetings,

Sven

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-11 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-10 21:50 [feature request] Org as an Excerpt Database (or Multivalue Properties) Sven Bretfeld
2011-12-11  0:09 ` Herbert Sitz
2011-12-11  8:00   ` Christian Moe
2011-12-11 16:21     ` Sven Bretfeld

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).