class LaudatioUtilService implements LaudatioUtilsInterface

Class LaudatioUtilService

Properties

protected $basePath

Methods

__construct()

LaudatioUtilService constructor.

parseXMLToJson($xml, $options)

parseXMLToJson: Parse xml to json

setCorpusAttributes($json, $params)

Populate Corpus object with attributes from the Corpus Header

updateCorpusAttributes($params, $corpusId)

updateCorpusAttributes: update corpus object fields

updateCorpusFileAttributes($corpus)

updateCorpusFileAttributes: update corpus file object fields

duplicateCorpus($oldCorpus, $new_corpus_elasticsearch_id, $new_corpus_id, $new_corpus_index, $new_guideline_index, $now, $oldDocumentIndex, $oldAnnotationIndex, $new_document_index, $new_annotation_index)

duplicateCorpus: create a copy of a corpus on publication to represent the new working period

copyCorpusFiles($oldCorpus, $new_corpus_id, $newIndex)

No description

corpusIsVersioned($corpusId)

Checks if Corpus is versioned and

setDocumentAttributes($json, $corpusId, $uid, $fileName, $isDir)

Populate Document object with attributes fom the Document header

setCommitData($commitData, $corpusId)

setCommitData: save git commit data on the object and persist to database

updateDocumentAttributes($params, $documentId)

updateDocumentAttributes: update the Document object fields

documentIsVersioned($documentId)

documentIsVersioned: determine if a document object is versioned (internal vid)

setAnnotationAttributes($json, $corpusId, $uid, $fileName, $isDir)

Populate Annotation object with attributes from the Annotation Header

setPreparationAttributes($json, $annotationId, $corpusId, $isDir)

setPreparationAttributes: not in use

updateAnnotationAttributes($params, $annotationId)

updateAnnotationAttributes: update the Annotation model fields

annotationIsVersioned($annotationId)

annotationIsVersioned: determine if an Annotation object is versioned (internal vid)

associateDocumentsToCorpus($documents, $corpusId)

Associate an array of Document objects to a Corpus

associateAnnotationsToDocument($annotations, $documentId)

Associate an array of Annotation objects to a Document

associateAnnotationsToCorpus($annotations, $corpusId)

Associate an array of Annotation objects to a Corpus

associatePreparationsToAnnotation($preparations, $annotationId)

Associate an array of Preparation objects to an Annotation: not in use

setVersionMapping($object, $type)

setVersionMapping: set the internal database versioning (vid) for an object

getDOIByCorpusDatabaseId($corpusDatabaseId)

No description

getDOIByCorpusElasticsearchId($elasticsearchId, $corpus_index)

No description

getDOIByCorpusId($corpusId, $corpus_index)

No description

setCorpusLogoSymLink($flysystem, $path)

setCorpusLogoSymLink: set a symlink in the filesystem to corpus logo images

getModelByType($id, $type)

getModelByType: Fetch eloquent model by id and type

getModelByFileName($fileName, $type, $isDir, $corpusId)

Fetch a Model by type and filename

getModelByFileAndCorpus($fileName, $type, $isDir, $corpusId)

getModelByFileAndCorpus: fetch an eloquent model by its filename, type and corpusid

getElasticSearchIdByCorpusId($corpusid, $corpus_index)

getElasticSearchIdByCorpusId: get elasticsearch document _id associated with an eloquent object

getElasticSearchIndexByCorpusId($corpusid)

getElasticSearchIndexByCorpusId: get elasticsearch document index id associated with an eloquent object

getDatabaseIdByCorpusId($corpusid, $corpus_index)

getDatabaseIdByCorpusId: get a Corpus Eloquent objects database id

getCorpusLogoByCorpusId($corpusid, $index)

getCorpusLogoByCorpusId: get the logo image file path of a corpus Eloquent object

getCorpusNameByCorpusId($corpusid, $index)

getCorpusNameByCorpusId

getCorpusNameByObjectElasticsearchId($type, $objectId)

getCorpusNameByObjectElasticsearchId: get the name of a corpus of any eloquent object by its elasticsearch id field

getCurrentCorpusIndexByElasticsearchId($elasticSearchId)

getCurrentCorpusIndexByElasticsearchId

getCurrentDocumentIndexByElasticsearchId($elasticSearchId)

getCurrentDocumentIndexByElasticsearchId

getCurrentAnnotationIndexByElasticsearchId($elasticSearchId)

getCurrentAnnotationIndexByElasticsearchId

getCurrentCorpusIndexByAnnotationElasticsearchId($elasticSearchId)

getCurrentCorpusIndexByAnnotationElasticsearchId

getCurrentCorpusIndexByAnnotationElasticsearchIdAndIndex($elasticSearchId, $index)

No description

getCurrentCorpusIndexByDocumentElasticsearchId($elasticSearchId)

getCurrentCorpusIndexByDocumentElasticsearchId

getCurrentCorpusIndexByDocumentElasticsearchIdAndIndex($elasticSearchId, $index)

No description

getDocumentGenreByCorpusId($corpusid, $index)

getDocumentGenreByCorpusId: fetch a corpus' document genre by traversing all its document objects

getCorpusVersion($corpusId)

getCorpusVersion: get the publication version of a corpus eloquent object

getWorkFlowStatus($corpusId)

getWorkFlowStatus: get the workflow status of a corpus eloquent object

getInvitedByCorpus($corpusId)

getInvitedByCorpus: get corpus collaboration invites

getInvitedByCorpusProject($projectId)

No description

string
getCorpusProjectPathByCorpusId($corpusId, $corpus_index)

getCorpusProjectPathByCorpusId: get the file path of a corpus' project

getCorpusAndProjectPathByCorpusId($corpusid, $corpus_index)

getCorpusAndProjectPathByCorpusId: get the file path of a corpus' project and the corpus

getCorpusPathByCorpusId($corpusid, $corpus_index)

getCorpusPathByCorpusId: get the file path of a corpus

getCorpusTokensByCorpusId($corpusid, $corpus_index)

No description

getCorpusGitLabIdByElasticsearchId($elasticsearchId, $corpus_index)

No description

deleteModels($path)

deleteModels: delete eloquent models by file path

deleteModel($type, $id)

deleteModel: delete eloquent model by type and database id

updateDirectoryPaths($directory_path, $corpusId)

updateDirectoryPaths: update Directory Paths for Document and Annotation eloquent objects

getDirectoryPath($paths, $fileName)

getDirectoryPath: get directorypaths by collection of paths and filename

getPublishedCorpusData($corpusresponses, $elasticService, $perPage, $sortKriterium, $currentPage)

No description

buildCiteFormat($data)

buildCiteFormat creates citations for a given piece of data

getDocumentRange($data, $documentResult)

getDocumentRange

emptyCorpusCache($corpusId, $index)

emptyCorpusCache: empty the corpus redis cache

emptySearchCache()

No description

emptyCorpusDataFileCache($path, $corpusId)

emptyCorpusDataFileCache: empty redis corpus data file cache

emptyCorpusFileCache($path, $corpusId)

emptyCorpusFileCache: empty redis corpus header file cache

emptyCorpusFileInfoCache($path, $corpusId)

emptyCorpusFileInfoCache: empty redis corpus header file info cache

emptyDocumentCacheByCorpusId($corpusId, $index)

emptyDocumentCacheByCorpusId: empty redis eloquent document object cache by corpus id

emptyDocumentCacheByDocumentIndex($documentIndex)

emptyDocumentCacheByDocumentIndex: empty redis eloquent document object cache

emptyDocumentCacheByDocumentElasticsearchId($documentId, $documentIndex)

emptyDocumentCacheByDocumentElasticsearchId

emptyAnnotationCacheByCorpusId($corpusId, $index)

emptyAnnotationCacheByCorpusId

emptyAnnotationCacheByAnnotationIndex($index)

emptyAnnotationCacheByAnnotationIndex

emptyAnnotationCacheByNameAndCorpusId($name, $corpusId, $index)

emptyAnnotationCacheByNameAndCorpusId

emptyAnnotationGroupCacheByAnnotationAndCorpusId($annotationId, $corpusId, $index)

emptyAnnotationGroupCacheByAnnotationAndCorpusId

checkForDuplicateCorpusName($corpus_name, $corpus_name_path, $corpus_project_id)

checkForDuplicateCorpusName checks the path-normalized name of a corpus if it already exists with in a project

determineAdminRole($admin_roles)

determineAdminRole

getRoleMappingByUser($user)

No description

determineUserAdminRole($user_roles)

determineUserAdminRole

removeMergedDuplicates($dataString)

removeMergedDuplicates: remove duplicates from comma separated strings generated from merged arrays

removeMergedNA($dataString)

removeMergedNA: remove NA-entries from comma separated strings generated from merged arrays

getFormatFilesByCorpusId($corpusId, $corpusIndex)

No description

stripQuotes($text)

No description

json_validate($string)

No description

json_validator($string)

No description

transformElasticSearchIndexes($corpusIndex)

No description

checkIfElasticsearchIdExists($header, $elasticSearchId, $elasticsearchIndex)

No description

hasHigherCorpusVersion($gitRepoId, $version)

No description

hasHigherCorpusVersionByGitRepoId($indicesByCorpus, $gitrepoid)

No description

getGitRepoId($id, $index, $type)

No description

getModelByTypeElasticserchIdAndIndex($id, $index, $type)

No description

pickRandomCorpora()

No description

Details

at line 48
__construct()

LaudatioUtilService constructor.

at line 61
parseXMLToJson($xml, $options)

parseXMLToJson: Parse xml to json

Parameters

$xml
$options

at line 174
setCorpusAttributes($json, $params)

Populate Corpus object with attributes from the Corpus Header

Parameters

$json
$params

Exceptions

JSONPathException

at line 224
updateCorpusAttributes($params, $corpusId)

updateCorpusAttributes: update corpus object fields

Parameters

$params
$corpusId

at line 238
updateCorpusFileAttributes($corpus)

updateCorpusFileAttributes: update corpus file object fields

Parameters

$corpus

at line 270
duplicateCorpus($oldCorpus, $new_corpus_elasticsearch_id, $new_corpus_id, $new_corpus_index, $new_guideline_index, $now, $oldDocumentIndex, $oldAnnotationIndex, $new_document_index, $new_annotation_index)

duplicateCorpus: create a copy of a corpus on publication to represent the new working period

Parameters

$oldCorpus
$new_corpus_elasticsearch_id
$new_corpus_id
$new_corpus_index
$new_guideline_index
$now
$oldDocumentIndex
$oldAnnotationIndex
$new_document_index
$new_annotation_index

at line 398
copyCorpusFiles($oldCorpus, $new_corpus_id, $newIndex)

Parameters

$oldCorpus
$new_corpus_id
$newIndex

at line 425
corpusIsVersioned($corpusId)

Checks if Corpus is versioned and

Parameters

$corpusId

at line 447
setDocumentAttributes($json, $corpusId, $uid, $fileName, $isDir)

Populate Document object with attributes fom the Document header

Parameters

$json
$corpusId
$uid
$fileName
$isDir

Exceptions

JSONPathException

at line 552
setCommitData($commitData, $corpusId)

setCommitData: save git commit data on the object and persist to database

Parameters

$commitData
$corpusId

at line 636
updateDocumentAttributes($params, $documentId)

updateDocumentAttributes: update the Document object fields

Parameters

$params
$documentId

at line 650
documentIsVersioned($documentId)

documentIsVersioned: determine if a document object is versioned (internal vid)

Parameters

$documentId

at line 672
setAnnotationAttributes($json, $corpusId, $uid, $fileName, $isDir)

Populate Annotation object with attributes from the Annotation Header

Parameters

$json
$corpusId
$uid
$fileName
$isDir

Exceptions

JSONPathException

at line 728
setPreparationAttributes($json, $annotationId, $corpusId, $isDir)

setPreparationAttributes: not in use

Parameters

$json
$annotationId
$corpusId
$isDir

Exceptions

JSONPathException

at line 793
updateAnnotationAttributes($params, $annotationId)

updateAnnotationAttributes: update the Annotation model fields

Parameters

$params
$annotationId

at line 807
annotationIsVersioned($annotationId)

annotationIsVersioned: determine if an Annotation object is versioned (internal vid)

Parameters

$annotationId

at line 826
associateDocumentsToCorpus($documents, $corpusId)

Associate an array of Document objects to a Corpus

Parameters

$documents
$corpusId

at line 843
associateAnnotationsToDocument($annotations, $documentId)

Associate an array of Annotation objects to a Document

Parameters

$annotations
$documentId

at line 861
associateAnnotationsToCorpus($annotations, $corpusId)

Associate an array of Annotation objects to a Corpus

Parameters

$annotations
$corpusId

at line 878
associatePreparationsToAnnotation($preparations, $annotationId)

Associate an array of Preparation objects to an Annotation: not in use

Parameters

$preparations
$annotationId

at line 896
setVersionMapping($object, $type)

setVersionMapping: set the internal database versioning (vid) for an object

Parameters

$object
$type

at line 935
getDOIByCorpusDatabaseId($corpusDatabaseId)

Parameters

$corpusDatabaseId

at line 952
getDOIByCorpusElasticsearchId($elasticsearchId, $corpus_index)

Parameters

$elasticsearchId
$corpus_index

at line 975
getDOIByCorpusId($corpusId, $corpus_index)

Parameters

$corpusId
$corpus_index

setCorpusLogoSymLink: set a symlink in the filesystem to corpus logo images

Parameters

$flysystem
$path

at line 1038
getModelByType($id, $type)

getModelByType: Fetch eloquent model by id and type

Parameters

$id
$type

at line 1065
getModelByFileName($fileName, $type, $isDir, $corpusId)

Fetch a Model by type and filename

Parameters

$fileName
$type
$isDir
$corpusId

at line 1133
getModelByFileAndCorpus($fileName, $type, $isDir, $corpusId)

getModelByFileAndCorpus: fetch an eloquent model by its filename, type and corpusid

Parameters

$fileName
$type
$isDir
$corpusId

at line 1193
getElasticSearchIdByCorpusId($corpusid, $corpus_index)

getElasticSearchIdByCorpusId: get elasticsearch document _id associated with an eloquent object

Parameters

$corpusid
$corpus_index

at line 1210
getElasticSearchIndexByCorpusId($corpusid)

getElasticSearchIndexByCorpusId: get elasticsearch document index id associated with an eloquent object

Parameters

$corpusid

at line 1229
getDatabaseIdByCorpusId($corpusid, $corpus_index)

getDatabaseIdByCorpusId: get a Corpus Eloquent objects database id

Parameters

$corpusid
$corpus_index

at line 1249
getCorpusLogoByCorpusId($corpusid, $index)

getCorpusLogoByCorpusId: get the logo image file path of a corpus Eloquent object

Parameters

$corpusid
$index

at line 1269
getCorpusNameByCorpusId($corpusid, $index)

getCorpusNameByCorpusId

Parameters

$corpusid
$index

at line 1289
getCorpusNameByObjectElasticsearchId($type, $objectId)

getCorpusNameByObjectElasticsearchId: get the name of a corpus of any eloquent object by its elasticsearch id field

Parameters

$type
$objectId

at line 1329
getCurrentCorpusIndexByElasticsearchId($elasticSearchId)

getCurrentCorpusIndexByElasticsearchId

Parameters

$elasticSearchId

at line 1349
getCurrentDocumentIndexByElasticsearchId($elasticSearchId)

getCurrentDocumentIndexByElasticsearchId

Parameters

$elasticSearchId

at line 1370
getCurrentAnnotationIndexByElasticsearchId($elasticSearchId)

getCurrentAnnotationIndexByElasticsearchId

Parameters

$elasticSearchId

at line 1390
getCurrentCorpusIndexByAnnotationElasticsearchId($elasticSearchId)

getCurrentCorpusIndexByAnnotationElasticsearchId

Parameters

$elasticSearchId

at line 1410
getCurrentCorpusIndexByAnnotationElasticsearchIdAndIndex($elasticSearchId, $index)

Parameters

$elasticSearchId
$index

at line 1440
getCurrentCorpusIndexByDocumentElasticsearchId($elasticSearchId)

getCurrentCorpusIndexByDocumentElasticsearchId

Parameters

$elasticSearchId

at line 1459
getCurrentCorpusIndexByDocumentElasticsearchIdAndIndex($elasticSearchId, $index)

Parameters

$elasticSearchId
$index

at line 1488
getDocumentGenreByCorpusId($corpusid, $index)

getDocumentGenreByCorpusId: fetch a corpus' document genre by traversing all its document objects

Parameters

$corpusid
$index

at line 1508
getCorpusVersion($corpusId)

getCorpusVersion: get the publication version of a corpus eloquent object

Parameters

$corpusId

at line 1525
getWorkFlowStatus($corpusId)

getWorkFlowStatus: get the workflow status of a corpus eloquent object

Parameters

$corpusId

at line 1542
getInvitedByCorpus($corpusId)

getInvitedByCorpus: get corpus collaboration invites

Parameters

$corpusId

at line 1548
getInvitedByCorpusProject($projectId)

Parameters

$projectId

at line 1563
string getCorpusProjectPathByCorpusId($corpusId, $corpus_index)

getCorpusProjectPathByCorpusId: get the file path of a corpus' project

Parameters

$corpusId
$corpus_index

Return Value

string

at line 1584
getCorpusAndProjectPathByCorpusId($corpusid, $corpus_index)

getCorpusAndProjectPathByCorpusId: get the file path of a corpus' project and the corpus

Parameters

$corpusid
$corpus_index

at line 1604
getCorpusPathByCorpusId($corpusid, $corpus_index)

getCorpusPathByCorpusId: get the file path of a corpus

Parameters

$corpusid
$corpus_index

at line 1615
getCorpusTokensByCorpusId($corpusid, $corpus_index)

Parameters

$corpusid
$corpus_index

at line 1625
getCorpusGitLabIdByElasticsearchId($elasticsearchId, $corpus_index)

Parameters

$elasticsearchId
$corpus_index

at line 1641
deleteModels($path)

deleteModels: delete eloquent models by file path

Parameters

$path

at line 1669
deleteModel($type, $id)

deleteModel: delete eloquent model by type and database id

Parameters

$type
$id

at line 1702
updateDirectoryPaths($directory_path, $corpusId)

updateDirectoryPaths: update Directory Paths for Document and Annotation eloquent objects

Parameters

$directory_path
$corpusId

at line 1716
getDirectoryPath($paths, $fileName)

getDirectoryPath: get directorypaths by collection of paths and filename

Parameters

$paths
$fileName

at line 1736
getPublishedCorpusData($corpusresponses, $elasticService, $perPage, $sortKriterium, $currentPage)

Parameters

$corpusresponses
$elasticService
$perPage
$sortKriterium
$currentPage

at line 1976
buildCiteFormat($data)

buildCiteFormat creates citations for a given piece of data

Parameters

$data

at line 2059
getDocumentRange($data, $documentResult)

getDocumentRange

Parameters

$data
$documentResult

at line 2094
emptyCorpusCache($corpusId, $index)

emptyCorpusCache: empty the corpus redis cache

Parameters

$corpusId
$index

at line 2104
emptySearchCache()

at line 2132
emptyCorpusDataFileCache($path, $corpusId)

emptyCorpusDataFileCache: empty redis corpus data file cache

Parameters

$path
$corpusId

at line 2144
emptyCorpusFileCache($path, $corpusId)

emptyCorpusFileCache: empty redis corpus header file cache

Parameters

$path
$corpusId

at line 2156
emptyCorpusFileInfoCache($path, $corpusId)

emptyCorpusFileInfoCache: empty redis corpus header file info cache

Parameters

$path
$corpusId

at line 2168
emptyDocumentCacheByCorpusId($corpusId, $index)

emptyDocumentCacheByCorpusId: empty redis eloquent document object cache by corpus id

Parameters

$corpusId
$index

at line 2183
emptyDocumentCacheByDocumentIndex($documentIndex)

emptyDocumentCacheByDocumentIndex: empty redis eloquent document object cache

Parameters

$documentIndex

at line 2194
emptyDocumentCacheByDocumentElasticsearchId($documentId, $documentIndex)

emptyDocumentCacheByDocumentElasticsearchId

Parameters

$documentId
$documentIndex

at line 2205
emptyAnnotationCacheByCorpusId($corpusId, $index)

emptyAnnotationCacheByCorpusId

Parameters

$corpusId
$index

at line 2216
emptyAnnotationCacheByAnnotationIndex($index)

emptyAnnotationCacheByAnnotationIndex

Parameters

$index

at line 2228
emptyAnnotationCacheByNameAndCorpusId($name, $corpusId, $index)

emptyAnnotationCacheByNameAndCorpusId

Parameters

$name
$corpusId
$index

at line 2241
emptyAnnotationGroupCacheByAnnotationAndCorpusId($annotationId, $corpusId, $index)

emptyAnnotationGroupCacheByAnnotationAndCorpusId

Parameters

$annotationId
$corpusId
$index

at line 2253
checkForDuplicateCorpusName($corpus_name, $corpus_name_path, $corpus_project_id)

checkForDuplicateCorpusName checks the path-normalized name of a corpus if it already exists with in a project

Parameters

$corpus_name
$corpus_name_path
$corpus_project_id

at line 2272
determineAdminRole($admin_roles)

determineAdminRole

Parameters

$admin_roles

at line 2289
getRoleMappingByUser($user)

Parameters

$user

at line 2322
determineUserAdminRole($user_roles)

determineUserAdminRole

Parameters

$user_roles

at line 2351
removeMergedDuplicates($dataString)

removeMergedDuplicates: remove duplicates from comma separated strings generated from merged arrays

Parameters

$dataString

at line 2363
removeMergedNA($dataString)

removeMergedNA: remove NA-entries from comma separated strings generated from merged arrays

Parameters

$dataString

at line 2368
getFormatFilesByCorpusId($corpusId, $corpusIndex)

Parameters

$corpusId
$corpusIndex

at line 2393
stripQuotes($text)

Parameters

$text

at line 2397
json_validate($string)

Parameters

$string

at line 2405
json_validator($string)

Parameters

$string

at line 2456
transformElasticSearchIndexes($corpusIndex)

Parameters

$corpusIndex

at line 2468
checkIfElasticsearchIdExists($header, $elasticSearchId, $elasticsearchIndex)

Parameters

$header
$elasticSearchId
$elasticsearchIndex

at line 2500
hasHigherCorpusVersion($gitRepoId, $version)

Parameters

$gitRepoId
$version

at line 2517
hasHigherCorpusVersionByGitRepoId($indicesByCorpus, $gitrepoid)

Parameters

$indicesByCorpus
$gitrepoid

at line 2534
getGitRepoId($id, $index, $type)

Parameters

$id
$index
$type

at line 2572
getModelByTypeElasticserchIdAndIndex($id, $index, $type)

Parameters

$id
$index
$type

at line 2600
pickRandomCorpora()