Class: Pho::FileManagement::RDFManager

Inherits:
AbstractFileManager show all
Defined in:
lib/pho/rdf_collection.rb

Overview

Provides a simple mechanism for managing a directory of RDF documents and uploading them to platform store.

Currently supports RDF, Turtle and NTriples

Direct Known Subclasses

RDFCollection

Constant Summary collapse

RDF =
"rdf".freeze
TTL =
"ttl".freeze
NT =
"nt".freeze
ALL_RDF =
[RDF, TTL, NT]

Constants inherited from AbstractFileManager

AbstractFileManager::FAIL, AbstractFileManager::OK, AbstractFileManager::TRACKING_DIR

Instance Attribute Summary

Attributes inherited from AbstractFileManager

#dir, #store

Instance Method Summary collapse

Methods inherited from AbstractFileManager

#changed?, #changed_files, #create_tracking_dir, #failures, #get_fail_file_for, #get_ok_file_for, #new_files, #reset, #retry_failures, #store_changes, #stored?, #stored_files, #successes, #summary

Constructor Details

#initialize(store, dir, rdf_suffixes = ALL_RDF, ok_suffix = OK, fail_suffix = FAIL) ⇒ RDFManager

Returns a new instance of RDFManager.



17
18
19
20
# File 'lib/pho/rdf_collection.rb', line 17

def initialize(store, dir, rdf_suffixes=ALL_RDF, ok_suffix=OK, fail_suffix=FAIL)
  super(store, dir, ok_suffix, fail_suffix)
  @rdf_suffixes = rdf_suffixes
end

Instance Method Details

#list(recursive = false) ⇒ Object

List files being managed



23
24
25
26
27
28
29
30
# File 'lib/pho/rdf_collection.rb', line 23

def list(recursive=false)
    if recursive
      pattern = "**/*.\{#{ @rdf_suffixes.join(",") }\}"
    else
      pattern = "*.\{#{ @rdf_suffixes.join(",") }\}"
    end          
    return Dir.glob( File.join(@dir, pattern) )  
end