Skip to content
.NET library developed at FJM to interact with Islandora´s core elements such as Fedora and Solr.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
IslandoraFJM
.gitattributes
.gitignore
README.html
README.md
licence.txt

README.md

Islandora FJM .NET Library

This is a .NET library developed at Fundación Juan March (Madrid,Spain) to interact with Islandora´s core elements such as Fedora, Solr and RISearch. At this stage only a few modules and classes are included in this library but we plan to release more. The modules and classes included in this release are:

In further releases we will include other modules and classes to interact with RISearch and classes to create and edit MODS or EAC-CPF records.

So far this library has been used for digital collections such as All our art catalogues since 1973, Sim Sala Bim, library of illusionism and Fernandez-Shaw and the musical theatre.

Some documentation

Working with Fedora objects and datastreams

Once configured the right variables in the file IslandoraFJM/ModuleVariables.vb, we can go ahead and create a new digital object

Dim obj As New DigitalObject("testobject:1", "this is a new object", True)

and modify the label of the object with

obj.ModifyObjectLabel("testobject:1", "this is the new label", "log message to change label")

or add an image as a new datastream

obj.add_datastream("IMG", "M", "IMAGE", "image/jpg", "adding an image datastream", "http://digital.march.es:8080/fedora/objects/cat:1/datastreams/JPG_PORTADA/content", False)

and add some metadata as a new datastream

obj.add_datastream("MODS", "M", "MODS", "text/xml", "Adding metadata", "http://digital.march.es:8080/fedora/objects/cat:1/datastreams/MODS/content", False)

We can remove the metadata datastream

obj.remove_datastream("MODS")

Or add relationships to the RELS-EXT

obj.add_relationship("testobject:1", "info:fedora/fedora-system:def/relations-external#/isMemberofCollection", "info:fedora/collection1:CollectionModel", False)
obj.add_relationship("testobject:1", "info:fedora/fedora-system:def/model#/hasModel", "info:fedora/collection1:ContentModel", True)

We can remove the relationship

obj.remove_relationship("testobject:1", "info:fedora/fedora-system:def/model#/hasModel", "info:fedora/collection1:ContentModel", True)

' Or add a relationship to the RELS-IN

obj.add_relationship("testobject:1" & "/IMG", "info:islandora/islandora-system:def/pageinfo#/width", "500px", True)

'Or load an existing object to perform the previous actions

Dim obj2 As New DigitalObject("islandora:root")

Working with Solr

This module allows to run queries against your Solr index and obtain the results in datasets Check if Solr is running

Dim IsSolrUp as Boolean = Solr_Status_OK

Build the URL for a simple Solr Query

Dim Solr_URL, Query as String 
Solr_URL="http://localhost:8080/solr/collection1/select?"
Query="mods_title:Quijote"

Dim SolrURLQuery as String = Generate_Solr_Search_URL (Solr_URL, Query)

More complex queries are supported with filter queries, sorting and specified fields to return, pagination and facets

Dim Solr_URL, Query, FilterQuery,Sort,FieldsToReturn as String 
Solr_URL="http://localhost:8080/solr/collection1/select?"
Query="mods_title:Quijote"
FilterQuery="mods_genre:book"
Sort="mods_dateCreated asc"
FieldsToReturn="mods_title,mods_dateCreated,mods_genre"

Dim SolrURLQuery as String = Generate_Solr_Search_URL (Solr_URL, Query, FilterQuery, Sort, FieldsToReturn)

Once we have constructed the Solr Query we can run the query and get the results in a datatable

Dim results as New DataSet
Dim drupal_URL as String ="http://myIslandorasite.com" ' to build URLs to access the datastreams
Dim Fields, Datastreams as Dictionary(Of String, String)

Fields.Add("PID_admin", "PID")
Fields.Add("Title", "mods_title")
Fields.Add("Date", "mods_dateCreated")

Datastreams.Add("High Res Image","JPG")
Datastreams.Add("Thumbnail","TN")

results = ReturnDatasetFromSearch(Solr_Query_URL, Drupal_URL, Fields, Datastreams)

Working with PowerTools

This module contains useful functions to work with images and pdfs.

With images it is possible get their height and width or rescale them

Dim img_path, img_name as String
img_path ="C:/Images/"
img_name ="Image1.jpg"

height = getImgHeight(img_path & img_name)
width = getImgWidth(img_path & img_name)

Dim scale as Integer
scale=250

rescaleJPG(img_name,img_path, scale)

With PDFs you can count the number of pages, OCR them or split them into pages

Dim myfile As String = "myPDF.pdf"
Dim pathIn As String = "C:\Temp\"
Dim pathOut As String = "C:\Temp\"

' convert pdf to images
pdf2JPG(myfile, pathIn, pathOut)

'convert pdf to swf file
pdf2swf(myfile, pathIn, pathOut)

'ocr a pdf to json or text files
Dim firstpage As Integer = 1
Dim lastpage As Integer = 10
pdf2json(myfile, pathIn, pathOut, firstpage, lastpage)
pdf2txt(myfile, pathIn, pathOut)

' calculate number of pages
PDFnum_pages(pathIn & myfile)

' split a pdf into one page pdfs
SplitPDF(file, pathIn, pathOut)

' one function to do all the other processes at once
Dim splitFiles, createJPGs, createTNs, createJSONs, createSWFs As Boolean
splitFiles= True 
createJPGs= True 
createTNs= True
createJSONs= True 
createSWFs= True 

PDF2BookFiles(myfile, pathIn, splitFiles, createJPGs, createTNs, createJSONs, createSWFs)
You can’t perform that action at this time.