Adding Waypoints to Neatline maps w/Mechanize

I have a several maps with dozens of items on them, and I'd like the items to show up on the Waypoints list. Enabling Waypoints individually for each item is kind of a chore, so I was hoping to automate it with Ruby and Mechanize. The problem I've hit is that the code I see in view source/the code Mechanize sees is completely different from what I see when I'm inspecting elements. When I print the title text using Mechanize, I get the "Neatline Editor: Map title". When I print the links present on the page, I get

  • Cancel
  • Yes, delete
  • Cancel
  • Parse
  • Close (repeated for each item in the map)

I was hoping I'd be able to click the link to #records, or load /editor/[mapno]/#records in order to list the items and add their Waypoints, but no dice.

Any ideas? Does the javascript make using Mechanize impossible?

Hey sheepeeh,

Actually, Neatline has a built-in feature designed for exactly this type of task, which comes up constantly when working with large amounts of content - the editor makes it possible to use a Neatline-inflected dialect of CSS to apply bulk updates to large numbers of records. Check out the documentation here:

http://docs.neatline.org/neatline-stylesheets.html

For your use case, if you just want _all_ the items in the exhibit to be displayed on the Waypoints panel, just do:

.all {
  widgets: Waypoints;
}

Where .all is a special tag that matches all records. Or, you could tag sets of records and just apply styles to those groups:

.your_tag_here {
  widgets: Waypoints;
}

-David

Oohhh.. I would be making it too hard on myself.

That is amazingly useful, especially with the ability to select by tags.

Thanks, I really appreciate it!

Digging around in the forums, this is the closest to the question I wanted to ask...

The CSS is useful, but actually tagging each item is really tedious, when I have 60+ items on several exhibits.

# Is there any way to tag multiple neatline records at once?

Meaning, select multiple records, and add a tag to each of them, rather than drilling down into the style tab of each individual record.

I noticed that there is a feature request for importing Omeka tags; this would be ideal, and solve the problem as well. But if that is not available, at least being able to select more than one neatline record would be helpful.

Any thoughts?
Thanks!

Hi fivel,

There's not an option for this is the interface. Right now the only way to do this would be with some SQL directly in the database. I think what you're proposing is also a slightly different feature, would would be equally (if not more) useful. Would you mind adding this as a feature request over on our issue tracker? https://github.com/scholarslab/neatline/issues

If you're not freaked out by executing SQL queries against your data, we can help you write a bit of SQL to update the tags for the Neatline records...

Wayne

Hi Wayne,
Thanks for the info (and sorry for my slow reply).

I added the issue to the github tracker, though I'm guessing someone else needs to label it as a feature request?

I have little experience working with SQL, but this is a learning experiment that I'm working on anyway, so I'm not particular afraid of screwing up or breaking anything. If it is not too much trouble to explain/help me write what I need to in order to batch edit tags, it would be super appreciated (and allow me to experiment with my project in the ways I'd like to). Thanks much!

Fivel,

It's bee a crazy week; I'll hopefully have something on this that's (marginally) tested by the end of the week...

Wayne

Fivel,

Here is some quick SQL that you can run. Please make database backups before you try this...

Take a look at all the neatline records first with:


SELECT id,title,tags
FROM
omeka_neatline_records;

Then figure out which ones need to be tagged and note the ids of each. In this example, I want to updates the tags of records 1 and 2 to be "foo,bar".


UPDATE
omeka_neatline_records
SET tags = "foo, bar"
WHERE id in (1,2);

I would suggest writing these out in a script file or using MySQLWorkBench (or something along those lines) as the cli can make this unnecessarily painful.

Good luck!

Wayne

Hi Wayne,
Just replying to let you know this has worked out just fine!
Nothing broken yet *fingers crossed*

One update I'll add: the main reason I wanted this capability is because I'm actually using the same Omeka items to build several different maps (I'm thinking of it as a small atlas). Neatline seems to create a new id for each item on an exhibit, even if it exists on another exhibit (and both link back to the same Omeka record); however, in the SQL database, only the first instance of the item gets a title, afterwards it is left NULL.

So there are two variations I found to help with this. One, the column that matches to the Omeka record is item_id, so if I want to edit tags across several exhibits by Omeka record, I found that I can more easily use:

UPDATE omeka_neatline_records
SET tags = "foo, bar"
WHERE item_id in (1,2);

then every instance of an Omeka record (rather than neatline record) gets updated at the same time (which is precisely what I want).

Another option is that item_title (rather than simply title) DOES display the title from the Neatline record, so it becomes visible what the record is rather than reading NULL. So that request, which is a change in the first step, would read:

SELECT id,item_title,tags
FROM omeka_neatline_records;

which I imagine is more useful if you are using different tags on different exhibits for the same Omeka record.

Thanks again for your help with this! This will allow me to test some things I want to try without a lot of manual repetition of work.

-Fivel