public class ToolsResource extends AbstractResource
Modifier and Type | Field and Description |
---|---|
static String |
ENDPOINT |
ACCESSOR_PARAM, ALL_PARAM, AUTH_HEADER_NAME, COMMIT_PARAM, CSV_MEDIA_TYPE, DEFAULT_LIST_LIMIT, FILTER_PARAM, graph, GROUP_PARAM, ID_PARAM, INCLUDE_PROPS_PARAM, ITEM_CACHE_TIME, jsonFactory, jsonMapper, LIMIT_PARAM, LOG_MESSAGE_HEADER_NAME, LOG_PARAM, logger, manager, N3_MIMETYPE, OFFSET_PARAM, PATCH_HEADER_NAME, RANGE_HEADER_NAME, RDF_MIMETYPE_FORMATS, RDF_XML_MIMETYPE, request, requestHeaders, RESOURCE_ENDPOINT_PREFIX, SCOPE_PARAM, SORT_PARAM, STREAM_HEADER_NAME, TOLERANT_PARAM, TURTLE_MIMETYPE, uriInfo, VERSION_PARAM
Constructor and Description |
---|
ToolsResource(org.neo4j.graphdb.GraphDatabaseService database) |
Modifier and Type | Method and Description |
---|---|
long |
autoLinkRepositoryDocs(String repositoryId,
String vocabularyId,
Set<AccessPointType> accessPointTypes,
String languageCode,
boolean excludeSingle,
boolean tolerant)
Create concepts and links derived from the access points
on a repository's documentary units.
|
javax.ws.rs.core.Response |
exportSchema(String format,
String baseUri)
Export an RDFS+OWL representation of the model schema.
|
Table |
findReplace(String from,
String to,
String type,
String subType,
String property,
int maxItems,
boolean commit)
Find and replace text in descriptions for a given item type
and description property name.
|
void |
fullUpgradeDb1to2() |
void |
initialize(boolean confirm,
InputStream fixtures)
Extremely lossy helper method for cleaning a test instance
|
String |
regenerateDescriptionIds(int bufferSize,
boolean commit)
Regenerate description IDs.
|
Table |
regenerateIds(List<String> ids,
boolean collisions,
boolean tolerant,
boolean commit,
Table data)
Regenerate the hierarchical graph ID for a set of items, optionally
renaming them.
|
Table |
regenerateIdsForScope(String scopeId,
boolean collisions,
boolean tolerant,
boolean commit)
Regenerate the hierarchical graph ID for all items within the
permission scope and lower levels.
|
Table |
regenerateIdsForType(String type,
boolean collisions,
boolean tolerant,
boolean commit)
Regenerate the hierarchical graph ID all items of a given
type.
|
Table |
relink(Table mapping)
Takes a CSV file containing a mapping from one item to
another and moves changes the link target of anything linked
to
from to to . |
Table |
rename(Table mapping)
Takes a CSV file containing two columns: the global id, and a new local
identifier to rename an item to.
|
Table |
reparent(boolean commit,
Table mapping)
Takes a CSV file containing two columns: an item global id, and a new parent
ID.
|
void |
setConstraints() |
String |
setLabels() |
String |
upgradeDb1to2() |
String |
version() |
anonymousApi, api, beginTx, creationResponse, getCacheControl, getCurrentActioner, getCurrentUser, getGraph, getIntQueryParam, getItemUri, getLogMessage, getQuery, getRdfFormat, getRequesterUserProfile, getSerializer, getStringListQueryParam, isPatch, isStreaming, single, streamingList, streamingList, streamingListOfLists, streamingPage, streamingPage, streamingVertexList, streamingVertexList
public static final String ENDPOINT
public ToolsResource(@Context org.neo4j.graphdb.GraphDatabaseService database)
public String version()
public Table findReplace(String from, String to, String type, String subType, String property, int maxItems, boolean commit) throws ValidationError
Changes will be logged to the audit log.
type
- the parent entity typesubType
- the specific node typeproperty
- the property namefrom
- the original textto
- the replacement textmaxItems
- the max number of items to change
(defaults to 100)commit
- actually commit the changesValidationError
public javax.ws.rs.core.Response exportSchema(String format, String baseUri) throws IOException
format
- the RDF formatbaseUri
- the RDF base URIIOException
public long autoLinkRepositoryDocs(String repositoryId, String vocabularyId, Set<AccessPointType> accessPointTypes, String languageCode, boolean excludeSingle, boolean tolerant) throws ItemNotFound, ValidationError, PermissionDenied, DeserializationError
repositoryId
- the repository idvocabularyId
- the target vocabularylanguageCode
- the language code of created conceptsaccessPointTypes
- the access point types to processtolerant
- proceed even if there are integrity errors due
to slug collisions in the created conceptsexcludeSingle
- don't create concepts/links for access points that
are unique to a single itemItemNotFound
ValidationError
PermissionDenied
DeserializationError
public Table regenerateIds(List<String> ids, boolean collisions, boolean tolerant, boolean commit, Table data) throws ItemNotFound, IOException, IdRegenerator.IdCollisionError
The default mode is to output items whose IDs would change, without
actually changing them. The collisions
parameter will only
output items that would cause collisions if renamed, whereas tolerant
mode will skip them altogether.
The commit
flag will cause renaming to take place.
ids
- the existing item IDscollisions
- only output items that if renamed to the
regenerated ID would cause collisionstolerant
- skip items that could cause collisions rather
then throwing an errorcommit
- whether or not to rename the itemItemNotFound
IOException
IdRegenerator.IdCollisionError
public Table regenerateIdsForType(String type, boolean collisions, boolean tolerant, boolean commit) throws IOException, IdRegenerator.IdCollisionError
The default mode is to output items whose IDs would change, without
actually changing them. The collisions
parameter will only
output items that would cause collisions if renamed, whereas tolerant
mode will skip them altogether.
The commit
flag will cause renaming to take place.
type
- the item typecollisions
- only output items that if renamed to the
regenerated ID would cause collisionstolerant
- skip items that could cause collisions rather
then throwing an errorcommit
- whether or not to rename the itemsIOException
IdRegenerator.IdCollisionError
public Table regenerateIdsForScope(String scopeId, boolean collisions, boolean tolerant, boolean commit) throws IOException, ItemNotFound, IdRegenerator.IdCollisionError
The default mode is to output items whose IDs would change, without
actually changing them. The collisions
parameter will only
output items that would cause collisions if renamed, whereas tolerant
mode will skip them altogether.
The commit
flag will cause renaming to take place.
scopeId
- the scope item's IDcollisions
- only output items that if renamed to the
regenerated ID would cause collisionstolerant
- skip items that could cause collisions rather
then throwing an errorcommit
- whether or not to rename the itemsIOException
ItemNotFound
IdRegenerator.IdCollisionError
public String regenerateDescriptionIds(int bufferSize, boolean commit) throws IOException, ItemNotFound, IdRegenerator.IdCollisionError
public String setLabels() throws IOException, ItemNotFound, IdRegenerator.IdCollisionError
public void setConstraints()
public String upgradeDb1to2() throws IOException
IOException
public void fullUpgradeDb1to2() throws IOException, IdRegenerator.IdCollisionError, ItemNotFound
public Table relink(Table mapping) throws DeserializationError
from
to to
.mapping
- a comma-separated TSV file, excluding headersDeserializationError
public Table reparent(boolean commit, Table mapping) throws DeserializationError
commit
- actually commit changesmapping
- a comma-separated CSV file, exluding headers.DeserializationError
public Table rename(Table mapping) throws IdRegenerator.IdCollisionError, DeserializationError
Input rows will be re-sorted lexically to ensure correct generation of dependent parent/child hierarchical IDs and output order will reflect this.
mapping
- a comma-separated CSV file, exluding headers.IdRegenerator.IdCollisionError
DeserializationError
public void initialize(boolean confirm, InputStream fixtures) throws Exception
fixtures
- YAML fixture data to be loaded into the fresh graphException
Copyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.