Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Documentation
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
snac
Documentation
Commits
b90c5599
Commit
b90c5599
authored
Feb 17, 2016
by
Tom Laudeman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding table of contents
parent
67fb98c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
Schema SQL.md
Specifications/Schema SQL.md
+25
-6
No files found.
Specifications/Schema SQL.md
View file @
b90c5599
...
@@ -6,6 +6,14 @@ You may be interested in the large schema diagram: [Large schema png file](Speci
...
@@ -6,6 +6,14 @@ You may be interested in the large schema diagram: [Large schema png file](Speci
There is an interactive schema web site:
[
Schema web site
](
http://shannonvm.village.virginia.edu/~twl8n/schema_spy_output/
)
There is an interactive schema web site:
[
Schema web site
](
http://shannonvm.village.virginia.edu/~twl8n/schema_spy_output/
)
### Table of contents
[
How versioning works.
](
#How-versioning-works.
)
[
Foreign key related records
](
#Foreign-key-related-records
)
[
Vocabulary table history and rationale
](
#Vocabulary-table-history-and-rationale
)
[
Vocabulary separate SQL file
](
#Vocabulary-separate-SQL-file
)
[
Common fields and their meaning
](
#Common-fields-and-their-meaning
)
[
Identical text tables.
](
#Identical-text-tables.
)
### How versioning works.
### How versioning works.
...
@@ -263,13 +271,24 @@ Still, inserting values into fk_table seems like a fine, if redundant idea.
...
@@ -263,13 +271,24 @@ Still, inserting values into fk_table seems like a fine, if redundant idea.
All controlled vocabulary terms are in a single table. A vocabularies share a common set of fields:
All controlled vocabulary terms are in a single table. A vocabularies share a common set of fields:
value(term), uri, description. Storing all vocabulary in a single tables makes it easy to add a new
value(term), uri, description. Storing all vocabulary in a single tables makes it easy to add a new
vocabulary.
vocabulary. At this time, vocabulary is mono-lingual, that is, term and description exist in a single
language, and might be duplicated in another language.
```
create table if not exists vocabulary (
id int primary key default nextval('vocabulary_id_seq'),
type text, -- Type of the vocab
value text, -- Value of the controlled vocab term
uri text, -- URI for this controlled vocab term, if it exists
description text -- Textual description of this vocab term
);
```
A proposed alternative w
ould be storing each vocabulary type in a separate table, but there is a down
A proposed alternative w
as to store each vocabulary type in a separate table, but that has down side. Adding a
side. Adding a new type would require creating a new table with identical field names to existing vocabulary
new type would require creating a new table (with identical field names to existing vocabulary tables) as well
tables, and this is more work than simply inserting new vocabulary data with a new type. Tables which are
a new insert and select functions, and this is more work than simply inserting new vocabulary data with a new
identical except for table name means that table name is data. In this case table name would be exactly
type. When tables are identical except for table name, table name is data. In this case table name would be
equivalent to vocabulary type.
e
xactly e
quivalent to vocabulary type.
SQL databases give us an additional hint that vocabulary should be in a single table. We can prepare SQL
SQL databases give us an additional hint that vocabulary should be in a single table. We can prepare SQL
queries, and use placeholders. However, table name is not avaiable as a placeholder. The twenty vocabulary
queries, and use placeholders. However, table name is not avaiable as a placeholder. The twenty vocabulary
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment