Showing posts with label nrhdb. Show all posts
Showing posts with label nrhdb. Show all posts

Tuesday, June 12, 2012

adding Open Graph Protocol metadata to XTF subject search results

Postscript:  After encountering some technical problems with the use of Facebook on the database site, I've removed all but the site-level OGP data.  The example code functions.  

Description of problem

I'm using Open Graph Protocol metadata to enhance user engagement with the Naval Reactors History Database. I've coded the top-level site with OGP metadata, which is a very straightforward process. The XTF platform is used to support discovery for this database. OGP metadata is simply embedded in the HTML markup for the main form, as defined in the XTF file searchForms.xsl. The outputted metadata makes the site's search page an object in the Facebook social graph and enables users to express a Like relationship with the site.

I am also interested in embedding OGP structured metadata into topical pages within the NRHDB site, which is a much more challenging task. In short, I want to display OGP metadata for some subjects prominently covered in the database, using the database's controlled vocabulary to identify each subject.

Solution

The key XTF file for this task is resultFormatter.xsl and I used both XTF's debug mode support and the Facebook Linter in implementing this functionality.

Here's a rough outline of the steps that I performed for one specific topical search:

1. Identify the simplest URL that can be used to pull up a subject search (example: http://navalreactorshistorydb.info:8080/xtf/search?f1-subject=S1W).

2. Open this URL in XTF's debug mode, step 4.

3. Save the raw XML results for the search to local disk; this is the XML that is fed to the resultFormatter.xsl stylesheet.

4. Analyze the XML structure, particularly the data returned under the /crossQuery/parameters/param elements. This will be used to guide the creation of the XPath expressions used in step 6.

5. Open resultFormatter.xsl and add a local parameter.


6. Add the following code, immediately after the head section's title element. This XSLT code performs a test on the XML data to determine, first, if it's a controlled vocabulary search and, second, if it's a search for the specific term. If both conditions are met, OGP metadata for the topic is inserted into the HTML output displayed on the results screen.


The OGP documentation should be consulted on structuring this metadata and for other rules, such as thumbnail size requirements.

The results can be viewed using the Facebook Linter. I'm still exploring how to best implement subsite or topical page OGP metadata for the Naval Reactors History Database and welcome any comments on this approach and procedure.

----

Addendum

This excerpt provides another example - adding the Open Graph metadata only when viewing the first set or screen of results. This requires the addition of another local parameter (countInfo, mapped to /crossQueryResult/query) and a second xsl:if statement.



Thus far, with some of the major subjects coded in the resultsFormatter.xsl file, performance doesn't seem to be a problem, in terms of the time to display the results screen.

Thursday, April 19, 2012

moving Facebook Social Plugins from IFrame to HTML5

This weekend, I migrated Facebook Social Plugins for the Naval Reactors History Database site from the legacy IFrame apps to HTML5 apps. I found this procedure to be helpful in accomplishing the migration. I'm embedding this JavaScript snippet into XTF's XSLT at appropriate points (the search and results pages code):

There are a number of benefits of moving from IFrame to HTML5 apps. As one example, I'm now including the Send button, along with the Like button, on the nrhdb site.

Note that you need to have claimed your Facebook e-mail account before the Send button will function. Here's a Facebook Developers discussion on this point; a poster describes this requirement in the thread.

This was a pretty easy upgrade and I like the result, though embedding the plugins in the context of XTF's structure made it more challenging.

Postscript: I obtained much better results for pulling in the comments stream for the Comments plug-in by mounting the information pages on an Apache server, instead of Tomcat 6. When the info pages were served by Tomcat, the comments stream pages were frequently truncated, with a status bar appearing on the screen indicating the content was being loaded.

Sunday, September 18, 2011

public AMI that enables rapid evaluation of XTF

At the upcoming LITA National Forum, I will be presenting on my work in blending the California Digital Library's XTF platform and EC2 cloud services. I'm using XTF and Amazon Web Services in support of the Naval Reactors History Database service, an online resource that I started building last year.

As part of my presentation, I've created a public Amazon Machine Image (AMI), ami-51f93b38 (or, just search the AMI catalog for 'xtf'). This is a US East region AMI. I created this image using the Amazon Linux 32-bit AMI as a base, then downloaded and configured the XTF 3.0 release, along with the XTF sample files that show XTF's use with a range of formats, including EAD, TEI, PDF, and HTML.

There is a README file in the ec2-user directory with more information on how to use the instance to test XTF. This info is also available at URL https://s3.amazonaws.com/ami-xtf/xtfAmiInformation.rtf.

In summary, this AMI will enable an institution or individual to quickly get XTF online and to review its features, starting from the release version of XTF and the samples that the CDL has made available.

Additional note: This is the first time that I've worked with the Amazon Linux AMI and I found it to be both easy to use and intuitive. I intend to use this OS option in the future.

Saturday, September 10, 2011

more on community / Naval Reactors History Database


I've continued with efforts to build community around the Naval Reactors History Database. As I think about this project, it has three major components: data, infrastructure, and community. I focused heavily on the infrastructure piece in the last nine months. I summarized my work with XTF and Amazon Web Services EC2 in a Code4Lib Northwest presentation this spring. But, in summary, the open source XTF digital content platform and AWS EC2 have enabled me to create a durable online presence at a low cost.

I've focused a lot on the community component in the last two months, with some positive results. This weekend, I've gotten Facebook commenting online, which was more challenging than I expected. The comments box appears in the footer section, along with the Facebook Like button. It was only in late June that I even thought about adding the Like button to the site, after hearing Eric Hellman's presentation at ALA Annual. I added the Like button to the site in late July and I've already been able to use it, along with some targeted display ads, to drive traffic to the NRHDB site and to learn more about the resource's users. I'm hopeful that the commenting will add another important dimension - enabling a public user dialogue within the site. As I've worked to build community, it's clear to me how important it is, and how difficult it is. I'm still thinking this through, but I do want to seriously engage other users in the Naval Reactors History Database. This may require me to modify the XTF interface to enable end users add comments relevant to specific database objects - images and documents. To start, there will be a unified comment stream for the site as a whole.

Also, I switched from the default Twitter widget to a Twitter Widget created through the vendor WidgetBox, for one narrow reason: an ability to customize to better customize the widget's look-and-feel. I am not a designer and, for that reason, I am using the XTF 3.0 look-and-feel with minimal customizations. The WidgetBox Twitter widget supports squared corners, which are part of the XTF default interface.

The final leg of the project's components, data, is going well; I will comment on this in more detail in a separate post.

Friday, July 22, 2011

starting point - to build NRHDB community


This month, I've made some changes to the Naval Reactors History Database, hoping to build a foundation for linking with the small community of users who have committed time to creating Wikipedia entries and other info in social network spaces:
  • An NRHDB Twitter account, in which I post database-related info; Twitter users can indicate interest in the database by following this user
It will take some time for these changes to have an impact. The Facebook development work really opens up a lot of options for communication - as Eric Hellman of Gluejar pointed out in his ALA Annual presentation, the Like button is the most popular Semantic Web application. Its use establishes a number of methods for me to communicate with other Facebook users who have interest in the NRHDB, including messages and even ads.

Monday, June 20, 2011

integrating text into the Naval Reactors History Database

With my XTF presentation at Code4Lib Northwest completed, I've begun to do some more significant modifications of the XTF instance that supports the Naval Reactors History Database service. One need was prompted by the inclusion of text content, in the form of documents that describe NR's work in Project Prometheus.

Previously, the database was composed solely of image files, many of which containing internal text metadata that is indexed by XTF. Now, I'm adding textual content, in PDF format, to the index. This change introduced a problem: In a displayed record, the Matches field displays text snippets from the image metadata and text files. These two types (image and text) need to be differentiated, so the display is more comprehensible.

Solution: Modify file resultFormatter.xsl so that the Matches display is contextually customized. Two xsl:if elements are added, with the differentiation based upon the data in the XML metadata's Dublin Core Type field:

I'm continuing to look at XTF programming possibilities, including those described in Rowan Brownlee's XTF guide.

Also, I have to say that in coding this change, I took the NRHDB site down for several seconds or even minutes. For that reason, I'll be testing changes in a test instance, running parallel to the production site, in order to eliminate downtime. I can do this using EC2 micro instances that I terminate upon completion of testing. It's at this point that the open source/cloud blend is most advantageous - instead of licensing commercial digital collections software to support production and test and running both servers locally, I can run the production instance 24/7/365 using an Amazon Web Services EC2 Reserved Instance and spin up an EC2 micro instance on demand for several hours to customize and extend XTF as needed. And since XTF and its supporting components are all open source, there's no software costs for this work.

Tuesday, June 7, 2011

customizing stop words in XTF

I've been immersing myself in the inner workings of the California Digital Library's XTF platform. I expect to make a number of changes to my XTF-based Naval Reactors History Database service in the next few months, in preparation for a fall LITA Forum presentation. The change described in this post is actually pretty trivial - adding a customized stop words list for an XTF instance - but it illustrates the kind of back-end customizations that are possible.

I decided to use the stop words list provided on the SEO Tools website.
To employ the index in XTF, I copied the file to xtf/conf/stopwords directory, replacing the existing stopwords.txt file that was included in the release version of XTF with the one that I obtained from the SEO Tools site.

I then stopped Apache Tomcat and rebuilt the XTF index. A clean build is recommended, as described in this XTF users group post. (I received the error described in the message before restoring to a clean build.) Upon restarting Tomcat, the new stop words list is in use.

Wednesday, December 22, 2010

why I'm excited by UC's extensible text framework

This year, I've basically migrated from being a Microsoft platform-oriented programmer to one working more with open source software. The game-changer for me, without a doubt, was my deepening use of Amazon Web Services generally, and EC2 specifically. EC2 gave me an easy-to-use development environment in which I could experiment with applications, and with extending applications.

One resource that I have built, in my own time, is an online Naval Reactors database. (I worked as an operator in the program for six years, qualifying on two reactor plants, and have continued reading about the program since leaving it.) I first built it using the AWS SimpleDB database and provided online access to the database using ASP.NET. But with EC2's availability, I happened across a tool that I've really gotten excited about - the University of California's Extensible Text Framework. XTF enables an institution or an individual to create a digital repository. It serves Encoded Archival Description (EAD) XML quite nicely, though I don't use EAD in the Naval Reactors database. It also supports the discovery and presentation of other digital formats, including photographic images.

Here are some URLs that show XTF in action:

-A search that retrieves all database objects

-A search that shows hits-in-context based upon metadata contained in image files

(The database migration is still in progress, but these URLs show the basic functionality.)

What was required to make this work? Downloading XTF and getting it running on an EC2 server (I am using Fedora 8 for the OS). Then, I went through the tutorials to become familiar with customization options. I also wrote some handlers for some additional file formats (JPEG, PNG) that weren't supported by the XTF software as-is and began building the database.

In short: out of the box faceted search; an elegant search and presentation system; and a solution that's being extended by a growing community of users. I am hoping to present on this work at the mid-2011 Code4Lib Northwest meeting.