Constants

SKIP

SKIP

CREATE

CREATE

Properties

$debug

$debug : boolean

Turns debug messages on

Type

boolean

$fedoraLoc

$fedoraLoc : string

Fedora path in the repo where imported resources are created.

Type

string

$autoCommit

$autoCommit : integer

Number of resource automatically triggering a commit (0 - no auto commit)

Type

integer

$autoCommitCounter

$autoCommitCounter : integer

Used to determine when the autocommit should tak place

Type

integer

Methods

makeAgent()

makeAgent(\EasyRdf\Resource  $res) : \EasyRdf\Resource

Makes given resource a proper agent

Parameters

\EasyRdf\Resource $res

Returns

\EasyRdf\Resource

__construct()

__construct(\acdhOeaw\fedora\Fedora  $fedora, string  $file, string  $format = null) 

Creates a new metadata parser.

Parameters

\acdhOeaw\fedora\Fedora $fedora
string $file
string $format

setFedoraLocation()

setFedoraLocation(string  $fedoraLoc) : \acdhOeaw\util\MetadataCollection

Sets a location where the resource will be placed.

Can be absolute (but will be sanitized anyway) or relative to the repository root.

Given location must already exist.

Note that this parameter is used ONLY if the resource DOES NOT EXISTS. If it exists already, its location is not changed.

Parameters

string $fedoraLoc

fedora location

Returns

\acdhOeaw\util\MetadataCollection

setAutoCommit()

setAutoCommit(integer  $count) : \acdhOeaw\util\MetadataCollection

Controls the automatic commit behaviour.

Even when you use autocommit, you should commit your transaction after Indexer::index() (the only exception is when you set auto commit to 1 forcing commiting each and every resource separately but you probably don't want to do that for performance reasons).

Parameters

integer $count

number of resource automatically triggering a commit (0 - no auto commit)

Returns

\acdhOeaw\util\MetadataCollection

import()

import(string  $namespace, integer  $singleOutNmsp) : array

Imports the whole graph by looping over all resources.

A repository resource is created for every node containing at least one cfg:fedoraIdProp property and:

  • containg at least one other property
  • or being within $namespace
  • or when $singleOutNmsp equals to MetadataCollection::CREATE

Resources without cfg:fedoraIdProp property are skipped as we are unable to identify them on the next import (which would lead to duplication).

Resource with a fully qualified URI is considered as having cfg:fedoraIdProp (its URI is taken as cfg:fedoraIdProp property value).

Resources in the graph can denote relationships in any way but all object URIs already existing in the repository and all object URIs in the $namespace will be turned into ACDH ids.

Parameters

string $namespace

repository resources will be created for all resources in this namespace

integer $singleOutNmsp

should repository resources be created representing URIs outside $namespace (MetadataCollection::SKIP or MetadataCollection::CREATE)

Throws

\InvalidArgumentException

Returns

array

filterResources()

filterResources(string  $namespace, integer  $singleOutNmsp) : array

Returns set of resources to be imported skipping all other.

Parameters

string $namespace

repository resources will be created for all resources in this namespace

integer $singleOutNmsp

should repository resources be created representing URIs outside $namespace (MetadataCollection::SKIP or MetadataCollection::CREATE)

Returns

array

assureUuids()

assureUuids(array  $resources) : array

Assures all resource to be imported have proper UUIDs so references to them can be set correctly.

Parameters

array $resources

resource to be checked

Returns

array

isIdElsewhere()

isIdElsewhere(Resource  $res) : boolean

Checks if a given resource is a cfg:fedoraIdProp of some other node in the graph.

Parameters

Resource $res

Returns

boolean

containsWrongRefs()

containsWrongRefs(Resource  $res, string  $namespace) : boolean

Checks if a node contains wrong edges (blank ones or non-id edges pointing to ids in $namespace but not being ACDH UUIDs).

Parameters

Resource $res
string $namespace

Returns

boolean

promoteUrisToIds()

promoteUrisToIds() 

Promotes subjects being fully qualified URLs to ids.

sanitizeResource()

sanitizeResource(Resource  $res, string  $namespace) : Resource

Cleans up resource metadata.

Parameters

Resource $res
string $namespace

Throws

\InvalidArgumentException

Returns

Resource

removeLiteralIds()

removeLiteralIds() 

Removes literal ids from the graph.

handleAutoCommit()

handleAutoCommit()