use of nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.berkeleydb.dto.LazyTypeSubjectReference in project timbuctoo by HuygensING.
the class SummaryPropsMutation method get.
@Override
public Object get(DataFetchingEnvironment env) {
DataSet dataSet = MutationHelpers.getDataSet(env, dataSetRepository::getDataSet);
MutationHelpers.checkAdminPermissions(env, dataSet.getMetadata());
try {
String collectionUri = env.getArgument("collectionUri");
Map data = env.getArgument("summaryProperties");
final PredicateMutation mutation = new PredicateMutation();
mutation.entity(collectionUri, getValue(data, "title").map(v -> replace(TIM_SUMMARYTITLEPREDICATE, value(v))).orElse(null), getValue(data, "image").map(v -> replace(TIM_SUMMARYIMAGEPREDICATE, value(v))).orElse(null), getValue(data, "description").map(v -> replace(TIM_SUMMARYDESCRIPTIONPREDICATE, value(v))).orElse(null));
MutationHelpers.addMutation(dataSet, mutation);
return new LazyTypeSubjectReference(collectionUri, dataSet);
} catch (LogStorageFailedException | InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
use of nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.berkeleydb.dto.LazyTypeSubjectReference in project timbuctoo by HuygensING.
the class CollectionMetadataMutation method get.
@Override
public Object get(DataFetchingEnvironment env) {
DataSet dataSet = MutationHelpers.getDataSet(env, dataSetRepository::getDataSet);
MutationHelpers.checkAdminPermissions(env, dataSet.getMetadata());
try {
String collectionUri = env.getArgument("collectionUri");
Map data = env.getArgument("metadata");
final PredicateMutation mutation = new PredicateMutation();
mutation.entity(collectionUri, getValue(data, "title").map(v -> replace(RDFS_LABEL, value(v))).orElse(null), getValue(data, "archeType").map(v -> replace("http://www.w3.org/2000/01/rdf-schema#subClassOf", subject(v))).orElse(null));
MutationHelpers.addMutation(dataSet, mutation);
return new LazyTypeSubjectReference(collectionUri, dataSet);
} catch (LogStorageFailedException | InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
Aggregations