Commit graph

32 commits

Author SHA1 Message Date
Dan Stillman
6c88563ded Changed translators.type column to INT and added index
Updated scraper updated mechanism to handle new translator schema, roughly
2006-06-29 07:58:50 +00:00
Dan Stillman
7328a3eab3 Add notes to the sample data 2006-06-29 07:04:24 +00:00
Dan Stillman
2d23ba97e5 See Also functionality for items and notes
Item.addSeeAlso(itemID)
Item.removeSeeAlso(itemID)
Item.getSeeAlso() -- array of linked items

Relationships are mutual

Closes #82, Notes: see also table
2006-06-29 01:37:53 +00:00
Simon Kornblith
45b9234996 addresses #78, figure out import/export architecture
- changes scrapers table to translators table; all import/export/web translators now belong in this table
- adds Scholar.Translate to handle translation issues. eventually, Scholar.Ingester.Document will become part of this interface
- adds Scholar_File_Interface (in fileInterface.js) to handle UI for export and eventually import. (David, when you have time, please connect Scholar_File_Interface.exportFile to a button.)
- adds an export translator for MODS. all of our metadata, but not our hierarchy (projects, etc.) translates directly and unambiguously into valid MODS. eventually, we can use RDF or another format to handle hierarchy.
- adds utilities.getVersion() and utilities.inArray() for simplified scraper coding
- fixes minor interface issues with the nifty chrome scraping status window
2006-06-29 00:56:50 +00:00
Dan Stillman
52f7ed62d0 Closes #31, tag data infrastructure
New methods:

Item.addTag(tag)
Item.getTags() -- array of tagIDs
Item.removeTag(tagID)

Tags.getName(tagID)
Tags.getID(tag)
Tags.add(text) -- returns tagID of new tag
Tags.purge() -- purge obsolete tags

The last two are for use by Item.addTag() and Item.removeTag(), respectively, and probably don't need to be used elsewhere.
2006-06-28 18:06:36 +00:00
Dan Stillman
d6fa0455e1 Fixes #29, independent notes
- Added 'note' item type

- Updated API to support independent note creation

Notes are, more or less, just regular items, with an item type of 1. They're created through Scholar.Notes.add(text, sourceItemID), which returns the itemID of the new note. sourceItemID is optional--if left out, an independent note will be created. (There's currently nothing stopping you from doing getNewItemByType(1) yourself, but the note would be contentless and broken, so you shouldn't do that.) Note data could've been stuffed into itemData, but I kept it separate in itemNotes to keep metadata searching faster and to keep things cleaner.

Methods calls that can be called on all items:

isNote() (same as testing for itemTypeID 1)

Method calls that can be called on source items only:

numNotes()
getNotes() (array of note itemIDs for a source)

Method calls that can be called on note items only:

updateNote(text)
setNoteSource(sourceItemID) (for changing source--use empty or false to make independent, which is currently what happens when you delete a note--will get option with #91)
getNote() (note content)
getNoteSource() (sourceItemID of a note)

Calling the above methods on the wrong item types will throw an error.


*** This will break note creation/display until David updates interface code. ***
2006-06-27 15:14:07 +00:00
Dan Stillman
480f9d56f6 Fixes #14, Add a callNumber field to all item types, and fixes #75, Add an "extra" field to all item types
I also added accessionNumber to all types (except website), since that's what Endnote does, but we may or may not think that's necessary
2006-06-25 18:10:27 +00:00
Dan Stillman
720960feb9 Addresses #5, Add as many item types as possible
New item types from Elena
2006-06-24 08:28:37 +00:00
Dan Stillman
726364d091 Scholar.History -- i.e. undo/redo functionality
Partially integrated into data layer, but I'm waiting to commit that part until I'm sure it won't break everything
2006-06-22 14:01:54 +00:00
Dan Stillman
4904c04e3e Add dateCreated and dateModified columns to itemNotes
Update itemNotes.dateModified on item update
2006-06-16 16:09:18 +00:00
Dan Stillman
7ef16e0a38 Reverted sample data to remove notes field (independent notes will need a field for that but we'll deal with that later)
I didn't increment the schema version, since I doubt anyone actual updated in the last 20 minutes... (If so just delete your DB or use SCHOLAR_CONFIG['DB_REBUILD'])
2006-06-16 07:56:24 +00:00
Dan Stillman
fd85af40f8 Many-to-one item note support in the schema and data layer -- still some issues on (I think) the interface side 2006-06-16 07:32:48 +00:00
Dan Stillman
70216ea2c7 - Added automatic scraper update mechanism (more details on Basecamp: http://chnm.grouphub.com/C2687015)
- Removed localLastUpdated field from scrapers table and renamed centralLastUpdated to lastUpdated; updated scraper queries accordingly

- Added query in scrapers.sql to update version table 'repository' row to prevent immediate downloads of newly installed scrapers

- Get version property from extension manager in Scholar.init() and assign to Scholar.version
2006-06-15 06:13:02 +00:00
Dan Stillman
d42258b168 Changed schema of scrapers table to use single GUID for scraperID
Assigned guids to scrapers, replaced INSERT queries with REPLACE queries, and removed table DELETE query at top -- this will allow scrapers to be updated without deleting any others that may exist (e.g. that someone is developing, third-party, etc.)
2006-06-12 15:43:24 +00:00
Dan Stillman
9daa0d3303 Added 'notes' field to fields table and sample data (changes are less messy than they look--I just put 'notes' after 'rights' and 'source' and incremented the other fieldIDs)
scholar.properties addition is just to keep metadata panel from breaking and could probably be removed once interface is hard-coded to not display the notes field there
2006-06-08 21:30:22 +00:00
Dan Stillman
393d19ca85 Fix SQL error on middle creator remove
Added creatorTypeID to the PK in itemCreators, because a creator could conceivably have two roles on an item

Throw an error if attempt to save() an item with two identical creator/creatorTypeID combinations, since, assuming this shouldn't be allowed (i.e. we don't have a four-column PK), there's really no way to handle this elegantly on my end -- interface code can use new method Item.creatorExists(firstName, lastName, creatorTypeID, skipIndex), with skipIndex set to the current index, to make sure this isn't done
2006-06-08 00:16:35 +00:00
Dan Stillman
393807b152 This isn't quite done (I'm discussing changing the scrapers schema with Simon to better handle scraper updates) but in the interest of getting the scrapers in for testing, I'll commit this now.
Integrated the scrapers with the schema update mechanism. Changed a bunch of schema methods to handle both schema.sql and scrapers.sql (or others, if need be) and altered the version table to track mu
ltiple versions for different files. This theoretically should detect that the version table has changed and force a reinitialization of the DB--let me know if there are problems.
2006-06-07 15:27:21 +00:00
Dan Stillman
448fde9ff1 Made the schema update system moderately less convoluted
- Broke schema functions into separate object and got rid of DB_VERSION config constant in favor of a toVersion variable in the _migrateSchema command (which isn't technically necessary either, since the version number at the top of schema.sql is now always compared to the DB version at startup) but will help reduce the chance that someone will update the schema file without adding migration steps)

- Removed Amazon scraper from schema.sql, as it will be loaded with the rest of the scrapers
2006-06-07 01:02:59 +00:00
Dan Stillman
1d9fa85c15 Missing association of ISSN with journalArticle type -- added to sample data (thanks Simon) 2006-06-04 18:53:22 +00:00
Dan Stillman
8572aefbcb Forgot DROP TABLE IF EXISTS for scrapers table 2006-06-01 21:58:03 +00:00
Dan Stillman
db1b85881c Scrapers table and sample scraper from Simon 2006-06-01 06:35:33 +00:00
Dan Stillman
03637a6c63 Updated schema for new collections ("projects"?) model and updated sample data accordingly; added a couple extra indexes; made 'rights' and 'source' regular metadata fields so that items can be used for things like notes
Overhauled data access layer to support new model:

	- Changed Item.getParent to Item.getCollections() to get ids of parent collections
	- Removed Item.setPosition() -- item positions are set internally when items are added to and deleted from collections, but the orderIndex is not currently used or manipulatable externally
	- Item constructor/Items.getNewItemByType()/Items.add() no longer take folderID and orderIndex as parameters
	- Split getTreeRows() into Scholar.getCollections(parent) and Scholar.getItems(parent), which return root collections or all library items, respectively, if no parent given
	- All references to folders in object/method/property names changed to collections
	- New methods Collection.addItem(itemID), Collection.hasItem(itemID), Collection.removeItem(itemID)
	- Collection.erase() takes optional deleteItems parameter to delete items from DB -- otherwise just removes association and leaves item in library (does, however, delete all descendent collections from DB regardless)

* Note: This will break displaying of items until interface code is updated. *
2006-06-01 00:22:18 +00:00
Dan Stillman
deea149235 Moved creatorTypeID into itemCreators and changed code accordingly; updated sample data
Added Scholar.CreatorTypes with methods getTypes() (multi-dim array with 'id' and 'name') and getTypeName(creatorTypeID)

Fixed bug in Scholar.Creators.purge() causing SQL error when deleting a non-existent creator

Fixed incorrect field order for itemCreators INSERT queries in save()

Changed setCreator() to take empty creator names (causing DELETE in itemCreators but without shifting up creators below it (or down and above, depending on your perspective) like removeCreators())
2006-05-20 15:18:36 +00:00
Dan Stillman
c8b3863b9c Delete old tables 2006-05-19 11:37:33 +00:00
Dan Stillman
fec3bc0129 New functions:
Scholar.ItemTypes.getTypes() -- returns associative array of all itemTypes, with 'id' and 'name'

Scholar.ItemTypes.getTypeName(itemTypeID) -- returns pre-l10n type name (e.g. 'book', 'journalArticle')
2006-05-18 20:39:38 +00:00
Dan Stillman
c8b0d3daed Renamed 'objects' to 'items' in DB and code -- all remaining uses refer to actual JS objects (with the exception of sidebar.js, in which only the calls to data access methods were changed) 2006-05-18 11:25:10 +00:00
Dan Stillman
bfdcbd831b Moved folderID and parentFolderID out of objects/folders into treeStructure and removed level column; updated sample data and SQL calls
Removed getLevel()

Updated Object.setPosition() to handle setting the position of new objects without committing, so it can be used within save(). May or may not actually work--my money's on no.

Added Folder.isEmpty()

No Folder.setPosition() yet, but, then, no editing or saving of folders at all--coming soon
2006-05-16 21:51:09 +00:00
Dan Stillman
3f398783d1 Fixed object level calculation (containing folder's level+1, not folder's level itself); updated schema to match 2006-05-16 07:21:31 +00:00
Dan Stillman
e14470db5a Added level column in folders table to track hierarchical level needed by treeView
Added getLevel() functions to Scholar.Object and Scholar.Folder -- save() and setPosition() not yet updated

Updated sample data to include levels

Added orderIndex (from treeOrder table, now) back into Scholar.Object data
2006-03-23 20:03:21 +00:00
Dan Stillman
d21638c465 Added in basic folder support to data access framework (no editing folders, no level information)
New Scholar.Objects method for treeView: getTreeRows() -- returns mixed array of all Folder and Object objects in the proper order, type testable with instanceof (e.g. if (obj instanceof Scholar.Folder))

Scholar.Objects.get() and getAll() return arrays hashed by objectID again, since they're no longer used directly by treeView

Scholar.Objects.get() now returns the object directly if only one argument and scalar (i.e. one id)

Updated schema and sample data to handle folder ordering
2006-03-23 08:51:05 +00:00
Dan Stillman
93c2b8c2ee DROP TABLE IF EXISTS now available in mozStorage 2006-03-22 16:42:22 +00:00
Dan Stillman
50eddb05ee Lots of DB-related updates:
Moved schema file out of chrome and removed XML tags, since it will no longer be accessed by XMLHTTP

Changed schema updater to use XPCOM components rather than XMLHTTP

Converted DB class to a singleton named Scholar_DB

Scholar_DB.query() now returns associative array similar to mysql_fetch_assoc() for SELECT statements rather than a mozIStorageStatementWrapper -- the mozStorage executeDataSet() function doesn't work yet, so we do it this way

Added DB functions:

   - beginTransaction(), commitTransaction(), rollbackTransaction()
   - columnQuery() -- one column, multiple rows, returned as array indexed by row
   - getColumns() and getColumnHash

DB query functions can now handle bind parameters passed as an array of object literals: e.g. [{'int':2},{'string':'foobar'}]

valueQuery() now returns an int for COUNT(*) queries, so the result can be tested without a "0" being true

Changed _initializeSchema to drop existing tables before creating new ones, hacked with try/catch until DROP TABLE IF EXISTS works with the mozStorage extension (it's already in the latest SQLite release)

Added DB_REBUILD config flag to manually trigger schema regeneration

Added debug logging at level 5 for all SQL queries

Updated sample data
2006-03-14 11:34:17 +00:00
Renamed from chrome/chromeFiles/content/scholar/schema.xml (Browse further)