Commit graph

174 commits

Author SHA1 Message Date
Simon Kornblith
9144b56772 addresses #131, make import/export symmetrical
closes #163, make translator API allow creator types besides author

import and export in the multi-ontology RDF format should now work properly. collections, notes, and see also are all preserved. more extensive testing will be necessary later.
2006-08-05 20:58:45 +00:00
Dan Stillman
1ce4de835b Fixes #167, Item note cache is not set on new note creation 2006-08-05 07:42:32 +00:00
Dan Stillman
8dd972dea1 Make Collection.getDescendents() a[n officially] public method and add second param to limit results to 'collection' or 'item' 2006-08-05 06:39:15 +00:00
Dan Stillman
701762a11f Fixes #166, Scholar.ItemTypes.getID("journalArticle") throws "Invalid item type journalarticle"
Fixed ignoreCase logic (and also set all but CharacterSets to false, since there's no reason for them to be true)

Also made CachedTypes.getID() and getName() return false and '', respectively, on unknown types rather than letting them hit the error (there's still the 'invalid * type' debug message)
2006-08-04 19:39:53 +00:00
Dan Stillman
9d58fac7e0 Abstracted the Scholar.*Types logic to a base function that can be extended and added singletons for the various types -- rock the JS prototype model 2006-08-04 04:34:16 +00:00
Simon Kornblith
b4c8dbe700 closes #157, add database infrastructure for different CSL styles
CSL is stored in a new "csl" table. only metadata relevant to updates and selection (ID, date updated, and title) is stored in columns.
2006-08-03 04:54:16 +00:00
Simon Kornblith
30af2c89df - closes #130, add progress bar for import/export
- eliminates "unresponsive script" message on import/export

i tried to make a progress bar that actually provides useful information, but for some reason, XUL interface updates are done asynchronously, and thus don't actually happen as long as the import/export operation continues. the code is there, but disabled, if there's some solution to this issue, but i searched and couldn't find one.
2006-08-02 21:06:58 +00:00
Dan Stillman
5c6d9de4b8 Addresses #77, maintain database backups
Temporarily added in a check of the backup file on startup, since I'm not entirely convinced that the backup mechanism on shutdown couldn't create a corrupt file under certain conditions

If you run with debug output on and notice the "Backup file was corrupt" message, let me know.
2006-08-01 23:32:18 +00:00
Dan Stillman
d3bc693dab Closes #77, maintain database backups
The Scholar database is backed up on browser close. On startup, if the main database is damaged, the extension saves a copy of the damaged file and tries to restore from the last automatic backup. If it fails, it creates a new database file.

New methods:

Scholar.getScholarDatabase(string [ext])
Scholar.backupDatabase()
Scholar.moveToUnique(file, newFile) -- find a unique filename using the leafName of newFile as the suggested name (using the built-in Mozilla functionality) and move the file there
Scholar.Date.getFileDateString(file)
Scholar.Date.getFileTimeString(file)
2006-08-01 23:10:31 +00:00
Dan Stillman
9a0457b43e Register shutdown handler to call Scholar.shutdown() on exit 2006-08-01 18:01:56 +00:00
Dan Stillman
40ef9f669d Closes #90, Add flag to delete child notes when a source is deleted
Item.erase(true) deletes child items as well instead of just unlinking
2006-07-31 06:05:19 +00:00
Dan Stillman
526d368aaf Closes #117, permit dashes and commas in "pages" field
Closes #118, add "translator" creator type
Closes #122, add DOI and abbreviated journal title fields
Addresses #45, reorder item fields -- source/rights moved down to bottom; date fields not yet moved
2006-07-31 04:31:44 +00:00
Dan Stillman
9da1c210a0 Change repository check time back to once a day 2006-07-31 03:38:02 +00:00
Dan Stillman
1adeb840bf Closes #98, Cache note content to avoid repeated DB calls 2006-07-30 21:49:34 +00:00
Dan Stillman
6ab7fd1e18 Closes #119, When Item.isNote(), Item.getField('title') should return first line of note
Returns the first 80 characters of the note content as the title

Also changed setField() to use the loadIn parameter for primary fields so it can be used instead of this._data without affected _changedItems
2006-07-30 21:01:23 +00:00
Dan Stillman
82106afc95 JavaScript, how I love thee.
Fixes URL not being stored with saved web pages.
2006-07-28 16:20:48 +00:00
Simon Kornblith
6305e4cada closes #55, export bibliography to printable version
closes #4, Make printable version

- moves functions for creating and deleting hidden browser objects to scholar.js (from ingester.js), since these are necessary for printing as well
- allows saving bibliography in HTML or printing bibliography. style support is not yet complete (pending finalization of 0.9 version of CSL specification).
2006-07-27 23:01:55 +00:00
Dan Stillman
441696767a Don't return non-independent file items in Scholar.getItems() (thanks David) 2006-07-27 15:55:03 +00:00
Dan Stillman
c093e7b62b Item.isRegularItem() = !(Item.isNote() || Item.isFile()) 2006-07-27 15:04:22 +00:00
Dan Stillman
c50dedc90a Addresses #17, add filesystem/ability to store files
Not finished, but enough to give David something to work with

No BLOBs -- just linking/importing of files and loaded documents


New Scholar.Item methods:

incrementFileCount() (used internally)
decrementFileCount() (used internally)
isFile()
numFiles()
getFile() -- returns nsILocalFile or false if associated file doesn't exist (note: always returns false for items with LINK_MODE_LINKED_URL, since they have no files -- use getFileURL() instead)
getFileURL() -- returns URL string
getFileLinkMode() -- compare to Scholar.Files.LINK_MODE_* constants: LINKED_FILE, IMPORTED_FILE, LINKED_URL, IMPORTED_URL
getFileMimeType() -- mime type of file (e.g. text/plain)
getFileCharset() -- charsetID of file
getFiles() -- array of file itemIDs this file is a source for

New Scholar.Files methods:

importFromFile(nsIFile file [, int sourceItemID])
linkFromFile(nsIFile file [, int sourceItemID])
importFromDocument(nsIDOMDocument document [, int sourceItemID])
linkFromDocument(nsIDOMDocument document [, int sourceItemID])

New class Scholar.FileTypes -- partially implemented, not yet used

New class  Scholar.CharacterSets -- same as other *Types classes:
getID(idOrName)
getName(idOrName)
getTypes() (aliased to getAll(), which I'll probably change the others to as well)

Charsets table with all official character sets (copied from Mozilla source)

Renamed Item.setNoteSource() to setSource() and Item.getNoteSource() to getSource() and adjusted to handle both notes and files
2006-07-27 09:16:02 +00:00
Dan Stillman
4959535aff Scholar DB now stored in scholar subfolder of profile directory
New methods for retrieving profile directory, scholar subdirectory and scholar/storage subsubdirectory
2006-07-27 08:45:48 +00:00
Simon Kornblith
cbe3611182 references #110, implement CSL for citation styling
add Scholar.Cite and Scholar.CSL for parsing items into a bibliography using CSL. unfortunately, the output is not very good at the moment, and the format likely needs some changes, but I'm working with a few other people on getting it to that point.
2006-07-22 01:25:46 +00:00
Simon Kornblith
c64e5c841f closes #78, figure out import/export architecture
closes #100, migrate ingester to Scholar.Translate
closes #88, migrate scrapers away from RDF
closes #9, pull out LC subject heading tags
references #87, add fromArray() and toArray() methods to item objects

API changes:
all translation (import/export/web) now goes through Scholar.Translate
all Scholar-specific functions in scrapers start with "Scholar." rather than the jumbled up piggy bank un-namespaced confusion
scrapers now longer specify items through RDF (the beginning of an item.fromArray()-like function exists in Scholar.Translate.prototype._itemDone())
scrapers can be any combination of import, export, and web (type is the sum of 1/2/4 respectively)
scrapers now contain functions (doImport, doExport, doWeb) rather than loose code
scrapers can call functions in other scrapers or just call the function to translate itself
export accesses items item-by-item, rather than accepting a huge array of items
MARC functions are now in the MARC import translator, and accessed by the web translators

new features:
import now works
rudimentary RDF (unqualified dublin core only), RIS, and MARC import translators are implemented (although they are a little picky with respect to file extensions at the moment)
items appear as they are scraped
MARC import translator pulls out tags, although this seems to slow things down
no icon appears next to a the URL when Scholar hasn't detected metadata, since this seemed somewhat confusing

apologizes for the size of this diff. i figured if i was going to re-write the API, i might as well do it all at once and get everything working right.
2006-07-17 04:06:58 +00:00
Simon Kornblith
d65328c830 adds Biblio/DC/FOAF/PRISM/VCard RDF export type. Bruce D'Arcus, author of CiteProc and co-lead on the OpenOffice bibliographic project, is currently using this as his ontology, and we can unambiguously encode all of our metadata with it.
caveats:
- it's not human readable. mozilla doesn't nest blank nodes, so everything's scattered throughout the file. it would be relatively easy to do post-processing with E4X or even regexps to correct this.
- there's no generic callNumber field, so all callNumbers are encoded as LCC.

adds container creation routines to dataMode rdf

changes Dublin Core export to Unqualified Dublin Core, and removes DC Terms qualifiers
2006-07-07 18:41:21 +00:00
Simon Kornblith
c02666fcd3 add an API for Mozilla's RDF data source, so that import/export translators will be able to create and parse RDF with minimal effort
convert Dublin Core export to new API
2006-07-06 21:55:46 +00:00
Dan Stillman
40b3ecc996 Addresses #87, Add fromArray() and toArray() methods to Item objects
Item.getTags() (which toArray() uses) now returns actual tags rather than ids -- separate method getTagIDs to return ids
2006-07-06 13:06:32 +00:00
Simon Kornblith
2d8ed16d88 adds export of tags to MODS.
adds export of seeAlso info and project hierarchy to RDF. for now, this is embedded in the modsCollection root element.

uses nodeIDs for Dublin Core RDF.
2006-07-06 03:39:32 +00:00
Simon Kornblith
c0251085a9 Add export filters for RIS and Dublin Core RDF 2006-07-05 21:44:01 +00:00
Simon Kornblith
8b4a44be0f fixes a bug that made the Google Books translator not appear
adjusts the Google Books translator to work with the latest revision of the site

renames the MODS translator to just MODS, because "Metadata Object Description Schema (MODS)" was too long for the export dialog
2006-06-30 19:21:36 +00:00
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
35eb1292a5 Changed getRandomID() to use the full SQLite three-byte range if unable to find a two-byte id in 3 tries 2006-06-29 07:03:24 +00:00
Dan Stillman
b495bb6334 Use getRandomID() for new item ids rather than auto-increment 2006-06-29 06:28:50 +00:00
Dan Stillman
72ca609b52 Addresses #87, Add fromArray() and toArray() methods to Item objects
Changed _getDescendents to take _nested_ flag, be extensible later for smart folders and other types, and include the collection name in the dataset

Added Collection.toArray()

Sample array:

'0' ...
	'id' => "13"
	'type' => "item"
'1' ...
	'id' => "14"
	'type' => "item"
'2' ...
	'id' => "7373"
	'name' => "A Sub-project!"
	'type' => "collection"
	'children' ...
		'0' ...
			'id' => "15"
			'type' => "item"
		'1' ...
			'id' => "9233"
			'name' => "A Sub-sub-project!"
			'type' => "collection"
			'children' ...
2006-06-29 05:18:55 +00:00
Dan Stillman
9b23e1ecdc Addresses #87, Add fromArray() and toArray() methods to Item objects
toArray() improvements:

- seeAlso support (array of itemIDs)

- Added itemID to source notes

- Fixed bug in creator handling
2006-06-29 03:56:22 +00:00
Simon Kornblith
77282c3edc - fixes a bug that could result in scrapers using utilities.processDocuments malfunctioning
- fixes a bug that could result in the Scrape Progress chrome thingy sticking around forever
- makes chrome thingy disappear when URL changes or when tabs are switched
2006-06-29 03:22:10 +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
Dan Stillman
098b7b1b9e Allow single bound parameters not in arrays in DB.query() calls 2006-06-29 01:06:02 +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
e45520b871 Updated obsolete references to itemKeywords table to use itemTags (this was breaking item delete and search) 2006-06-28 19:12:35 +00:00
Dan Stillman
20bad3609d Moving Scholar.Notes in the code -- ignore 2006-06-28 18:30:20 +00:00
Dan Stillman
e22bdaab33 Disallow setting note source to another note (presumably that's what See Also is for) 2006-06-28 18:28:09 +00:00
Dan Stillman
cef196529c Return the tagID, new or otherwise, in Item.addTag() 2006-06-28 18:12:38 +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
b75376c1c1 Fixes #96, When notify() is called for a new note, getNote() on the item returns false
Item.save() changed to not call notify() if a transaction is in progress, which is totally going to trip someone up at some point, and probably me, but it's better than a new parameter
2006-06-28 15:47:58 +00:00
Dan Stillman
cb8f961639 Removed Scholar.HTTP, now that its functionality has been incorporated back into Scholar.Utilities.HTTP 2006-06-27 23:24:02 +00:00
Dan Stillman
312f32f505 Fixes #96, When notify() is called for a new note, getNote() on the item returns false
getNote() now returns an empty string rather than false on a new item

David, I assume this is what you meant--if not, reopen
2006-06-27 22:55:43 +00:00
Dan Stillman
2dece39ad3 Fixes #95, Notes.add() fails when sourceitem is null 2006-06-27 22:14:28 +00:00
Dan Stillman
91b732c3e1 Addresses #87, Add fromArray() and toArray() methods to Item objects
Item.toArray() implemented -- builds up a multidimensional array of item data, converting all type ids to their textual equivalents -- currently has empty placeholder arrays for tags and seeAlso

Sample source output:

'itemID' => "2"
'itemType' => "book"
'title' => "Computer-Mediated Communication: Human-to-Human Communication Across the Internet"
'dateAdded' => "2006-03-12 05:25:50"
'dateModified' => "2006-03-12 05:25:50"
'publisher' => "Allyn & Bacon Publishers"
'year' => "2002"
'pages' => "347"
'ISBN' => "0-205-32145-3"
'creators' ...
	'0' ...
		'firstName' => "Susan B."
		'lastName' => "Barnes"
		'creatorType' => "author"
'notes' ...
	'0' ...
		'note' => "text"
		'tags' ...
		'seeAlso' ...
	'1' ...
		'note' => "text"
		'tags' ...
		'seeAlso' ...
'tags' ...
'seeAlso' ...


Sample note output:

'itemID' => "17"
'itemType' => "note"
'dateAdded' => "2006-06-27 04:21:16"
'dateModified' => "2006-06-27 04:21:16"
'note' => "text"
'sourceItemID' => "2"
'tags' ...
'seeAlso' ...

sourceItemID won't exist if it's an independent note.

We'll use the same format in reverse for fromArray, so Simon, let me know if you need more data (preserving type ids, etc) or want anything in a different form.
2006-06-27 20:45:41 +00:00
Dan Stillman
22296470c3 Item.getCreators() to return multidim array of creator data (same as doing a loop to numNotes() and using getCreator()) 2006-06-27 20:26:44 +00:00
Dan Stillman
5ab37dacd5 Notification improvements for notes
Missing query() call for unlinking notes in Item.erase()
2006-06-27 19:42:02 +00:00