blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
7.06k stars 415 forks source link

Annotating multiple entities per file #874

Open jiri opened 2 years ago

jiri commented 2 years ago

Is your feature request related to a problem? Please describe. I'd like to store a lot of very small entities in my Vault (think items in inventory). I'd like to be able to use DataView to process them, however it's frustrating to create a separate file for tons of entries that could be stored in a table / list.

Describe the solution you'd like I'd love to see a way to include multiple distinct entities in a single file. Similar to how every task in a file is treated as a separate object with its own fields, I'd like a way to annotate plain lists or perhaps even sections (headings) in a file. Something akin to:

## Item 1
field1:: <value>
field2:: <value>

## Item 2
field1:: <value>
field2:: <value>

Describe alternatives you've considered I'd like to replicate some of the ways I've used Notion's databases for this, which do technically create a page for every table row, but in a fully automated fashion so it's not a hassle.

Additional context Not applicable.

jiri commented 2 years ago

I've looked into this a bit further and tasks already include the subheading they're under and can be easily grouped by that. Perhaps adding support for normal list items, not just tasks, would be enough?

aubreyz commented 2 years ago

I agree with this. It would allow simple semantic markup. Currently I abuse tasks for this -- but the checkbox presents a problem. Extending dataview to single lines of data in files marked in way other than a task would make dataview (and obsidian) the ultimate semantic tool.

mbafford commented 2 years ago

release 0.4.23 (briefly) included all list items, not just tasks, which got a lot of the way there, so when that's re-released with the issues fixed, it should help.

I think the next logical step is to make all headings available in the same way as tasks are currently, and "items" were temporarily in 0.4.23.

I used the items feature (for the brief period it was live and before it bugged out and froze my obsidian instance) to make "timeline" entries across my journal that I could then query out in an index file. (Still had to write JS to extract the tags from an individual list item). But my ideal would be able to pull the headings that contain a tag into my index page instead and skip the list items requirement. That way it can just naturally flow from my normal journal format. Just need to add a #timeline tag.

aubreyz commented 2 years ago

Not sure I would go with the headings idea (that would create a problem with markup) or every list item (system overload). I think what is needed instead is an exact emulation of what already exists for tasks. The main problem with using tasks for semantic markup is a) tasks are used for other stuff - i.e. tasks b) it can be a pain to get rid of the checkboxes in dataview but can be done c) want different flavours potentially.

I think you need to consider how this would be used and how powerful it could be. Let us suppose I am marking up news reports on the Ukraine war. I want to collate different things without breaking the articles into atomic sentences one per file. Let's suppose I want to be able to collate a) what individual people did or said on particular dates and b) The geographical location something took place and on what date.

I think we can accept that we are not talking about inline markup, but that the user will have to make statements on their own lines interspersed with the text or at the end of the article. Inline markup which will also produce a seamless output will be too hard.

Currently I could use tasks. lets say as (design your own system)

- [ ] [[2022]] []02-22]] [[Putin Vlad]] announces he has put his nuclear weapons on high alert
- [ ] [[2022]] []02-21]] [[Johnson Boris]] Holds a party at 10 Downing Street
- [ ] [[2022]] ][02-21]] #location [[loc -3.3213,0.342]] Bomb dropped

or maybe

- [ ] [year:: 2022] [day:: 17] [month:: 02] [[Johnson Boris]] Holds a party at 10 Downing Street

You can do all sorts of fancy searches on that, and it already works great

What I would imagine is having something like (perhaps)

- (tracker::people) [[2022] [02-21] [[Johnson Boris]] Holds a party at 10 Downing Street

Perhaps as list items, or perhaps just as single line blocks, but basically doing exactly what tasks are currently doing.

With existing tasks it would be nice to be able to switch off the checkbox in a tasks dataview without having to go through convolutions

AB1908 commented 2 years ago

This is actually doable via DVJS but is rather painful as the entries are being indexed into an array.

AB1908 commented 2 years ago

DV now indexes lists. Does that help with your use case?

danielo515 commented 1 year ago

DV now indexes lists. Does that help with your use case?

That is more a workaround than a real solution. I also want to be able to query,group by and display results as sections were separate sources. Basically I want the ability to display each sections and the data they contain as an individual table row. How is that doable with DVJS?

athanhat commented 1 year ago

Hi, I have recently started playing with DataView and DatabaseFolder. I tried to create views from multiple records that are written in a single file, each record is represented with the same number of inline fields.

You can easily create a DataView in a note like

TABLE WITHOUT ID ws_id, ws_title, ws_url, ws_company, ws_description
FROM "DB/Records"

image

ws_id:: 1
ws_company:: Morpheus
ws_description:: Kamala Login Page
ws_lastVisit:: 2017-02-23 00:00:00
ws_title:: Kamala Collaborative Knowledge Database
ws_type:: SOFTWARE
ws_url:: https://kamala.mssm.nl/login
ws_userEmail:: info@example.eu
ws_userName:: foo

ws_id:: 2
ws_company:: Hewlett-Packard Enterprise
ws_description:: My Vertica Account Home Page
ws_lastVisit:: 2017-02-23 00:00:00
ws_title:: "Vertica cluster - column-oriented DBMS"
ws_type:: SOFTWARE
ws_url:: https://my.vertica.com
ws_userEmail:: info@example.eu
ws_userName:: VOID

But sorting does not work, I always get the same view no matter what I tried, and I don't know how to search for a record or click a row (field) in the table and get a full details view of the specific record.

I have also watched several videos from Obsidian pod-casters and I have not seen anyone to cover the case of creating multiple records data view from a single file-note as a data source. Neither documentation covers this case. Please correct me if I am wrong.

Therefore it would be great if this extra functionality is properly implemented and you make it work like dataviews of metadata from separate notes in a folder.

Kudos to all contributors of Dataview and DatabaseFolder

PS1: If there is a solution on this problem I would like to see a concrete example that explain how to solve it

PS2: The functionality I described, (data view of specific columns with order + searching + sorting + full record view) is implemented in Logseq with live queries and you can view the record by clicking on the row because it behaves like a block reference. Nevertheless Obsidian/Dataview is more powerful. For example it is amazing that you can construct dynamic templates with values from the properties !!!

PS3: Related issues are mentioned in

1480 - Query fields by section instead of aggregate array

1387 - Group keys in same file