I decided to segment this from Native shell? - #101 by SamuraiCrow postings.
In that posting, the discussion involved thoughts about BFS and its database-like features. I think deserves its own attention versus the native shell discussions.
To begin with, Haiku inherited the BFS features from BeOS–so we already have the very primitive database ‘engine’. The BFS database would be equivalent to a flat file database, such as dBASE, FoxPro, and others. It will never be a relational database–but BFS is closer to No-SQL database, such as a structured graph database.
Let me explain by using an example from my Multimedia database now.
PART I
- Create a Database Data Type (i.e. Custom Filetype Group)
The database data type or schema name equates to the creation of a new Filetype group. This is accomplished via the Preferences–> FileTypes application.
For example, a new schema is created by adding a new group using the FileType: ‘Add…’ button:
a. For the ‘Group:’ select the ‘Add new group’ from the drop-down option
b. For the ‘Group name:’ enter ‘database’
c. Then, click on the ‘Add group’ button
From the FileTypes’ left panel, the new group ‘database’ is now listed. Highlight ‘database’ and update the following in the ‘Description’ section:
a. The ‘Internal name:’ is displayed
b. Enter the ‘Type name:’ as ‘Multimedia database schema’
c. Enter the ‘Description:’ as ‘Generic database schema’
- Database object (i.e. Custom FileType) creation is accomplished via FileTypes. It is at this point, we are defining the data object that will possess the data. In graph database terminology, this would be a ‘node’.
For example, a new data object is adding a new FileType to the new group ‘database’ by highlighting ‘database’ clicking on the FileType:‘Add…’ button:
a. For the ‘Group:’ select the ‘database’ from the drop-down option
b. For the ‘Internal name:’ enter ‘MusicDB’
c. Then, click on the ‘Add type’ button
From the FileTypes’ left panel, the new filetype ‘MusicDB’ is now listed. Highlight ‘MusicDB’ and update the following sections:
-
Add the file extensions linked to this new FileType so the system will recognize files by their extention. In the 'File recognition:" section, add the following extensions: ‘mp3’ and ‘MP3’
-
In the FileType description section, update the ‘Type name:’ and the ‘Description:’ options as follows:
Type name: Music (MP3) Database
Description: Track all your music files.
- The ‘Extra attributes’ will be equivalent to node properties in graph database design or columns in a database table.
In this section, we will enter all the custom attributes that we need for this FileType. Clicking the ‘Add…’ button opens a panel to enter all the data for the new attribute. You can edit an existing attribute with a double-click.
Complete Data Type design by entering the following oprions:
Attributename: Internal name: Type: Visible: Display as: Editable: Width: Alignment:Examples:
Artist database_MusicDB:Artist String X Default X 100 Left
Album database_MusicDB:Album String X Default X 100 Left
Title database_MusicDB:Title String X Default X 100 Left
…
Rating database_MusicDB:Rating Integer 32 bit X Default X 15 Left
Frontcover database_MusicDB:Frontcover String X Default X 60 Left
Comment database_MusicDB:Comment String X Default X 100 Left
-
There is no direct correlation to a database relationship or an edge in BFS, but this can be accomplished by group assignments in an attribute(s) of the file type. A few examples: in a Person type, group assignment as Family will link other Person FileTypes that are in the Family group together. Another is the album name linking all the tracks together or the Artist_name linking all the albums, and so forth. So, there is some flexibility to link data types within the FileType.
-
The Haiku-specific commandline applications provide basic database-wise operations. These commands can display, read, add, and remove attributes of the FileTypes: listattr, catattr, addattr, rmattr, and copyattr. We should consider enhancing these commands to better serve the database features of BFS operations.