Search in sources :

Example 1 with Type

use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type in project timbuctoo by HuygensING.

the class GraphQl method executeGraphql.

public Response executeGraphql(String query, String acceptHeader, String acceptParam, String queryFromBody, Map variables, String operationName, String authHeader) {
    final SerializerWriter serializerWriter;
    if (acceptParam != null && !acceptParam.isEmpty()) {
        // Accept param overrules header because it's more under the user's control
        acceptHeader = acceptParam;
    }
    if (unSpecifiedAcceptHeader(acceptHeader)) {
        acceptHeader = MediaType.APPLICATION_JSON;
    }
    if (MediaType.APPLICATION_JSON.equals(acceptHeader)) {
        serializerWriter = null;
    } else {
        Optional<SerializerWriter> bestMatch = serializerWriterRegistry.getBestMatch(acceptHeader);
        if (bestMatch.isPresent()) {
            serializerWriter = bestMatch.get();
        } else {
            return Response.status(415).type(MediaType.APPLICATION_JSON_TYPE).entity("{\"errors\": [\"The available mediatypes are: " + String.join(", ", serializerWriterRegistry.getSupportedMimeTypes()) + "\"]}").build();
        }
    }
    if (query != null && queryFromBody != null) {
        return Response.status(400).type(MediaType.APPLICATION_JSON_TYPE).entity("{\"errors\": [\"There's both a query as url paramatere and a query in the body. Please pick one.\"]}").build();
    }
    if (query == null && queryFromBody == null) {
        return Response.status(400).type(MediaType.APPLICATION_JSON_TYPE).entity("{\"errors\": [\"Please provide the graphql query as the query property of a JSON encoded object. " + "E.g. {query: \\\"{\\n  persons {\\n ... \\\"}\"]}").build();
    }
    Optional<User> user;
    try {
        user = userValidator.getUserFromAccessToken(authHeader);
    } catch (UserValidationException e) {
        user = Optional.empty();
    }
    UserPermissionCheck userPermissionCheck = new UserPermissionCheck(user, permissionFetcher, newHashSet(Permission.READ));
    final GraphQLSchema transform = graphqlGetter.get().transform(b -> b.fieldVisibility(new PermissionBasedFieldVisibility(userPermissionCheck, dataSetRepository)));
    final GraphQL.Builder builder = GraphQL.newGraphQL(transform);
    if (serializerWriter != null) {
        builder.queryExecutionStrategy(new SerializerExecutionStrategy());
    }
    GraphQL graphQl = builder.build();
    final ExecutionResult result = graphQl.execute(newExecutionInput().root(new RootData(user)).context(contextData(userPermissionCheck, user)).query(queryFromBody).operationName(operationName).variables(variables == null ? Collections.emptyMap() : variables).build());
    if (serializerWriter == null) {
        return Response.ok().type(MediaType.APPLICATION_JSON_TYPE).entity(result.toSpecification()).build();
    } else {
        if (result.getErrors() != null && !result.getErrors().isEmpty()) {
            return Response.status(415).type(MediaType.APPLICATION_JSON_TYPE).entity(result.toSpecification()).build();
        }
        return Response.ok().type(serializerWriter.getMimeType()).entity((StreamingOutput) os -> {
            serializerWriter.getSerializationFactory().create(os).serialize(new SerializableResult(result.getData()));
        }).build();
    }
}
Also used : UserValidationException(nl.knaw.huygens.timbuctoo.v5.security.exceptions.UserValidationException) User(nl.knaw.huygens.timbuctoo.v5.security.dto.User) GraphQL(graphql.GraphQL) SerializableResult(nl.knaw.huygens.timbuctoo.v5.serializable.SerializableResult) SerializerWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.SerializerWriter) ExecutionResult(graphql.ExecutionResult) StreamingOutput(javax.ws.rs.core.StreamingOutput) GraphQLSchema(graphql.schema.GraphQLSchema) RootData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.RootData) PermissionBasedFieldVisibility(nl.knaw.huygens.timbuctoo.v5.graphql.security.PermissionBasedFieldVisibility) SerializerExecutionStrategy(nl.knaw.huygens.timbuctoo.v5.graphql.serializable.SerializerExecutionStrategy) UserPermissionCheck(nl.knaw.huygens.timbuctoo.v5.graphql.security.UserPermissionCheck)

Example 2 with Type

use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type in project timbuctoo by HuygensING.

the class TabularUpload method upload.

@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@POST
public Response upload(@FormDataParam("file") final InputStream rdfInputStream, @FormDataParam("file") final FormDataBodyPart body, @FormDataParam("file") final FormDataContentDisposition fileInfo, @FormDataParam("fileMimeTypeOverride") final MediaType mimeTypeOverride, FormDataMultiPart formData, @HeaderParam("authorization") final String authHeader, @PathParam("userId") final String ownerId, @PathParam("dataSetId") final String dataSetId, @QueryParam("forceCreation") boolean forceCreation) throws DataStoreCreationException, FileStorageFailedException, ExecutionException, InterruptedException, LogStorageFailedException {
    final Either<Response, Response> result = authCheck.getOrCreate(authHeader, ownerId, dataSetId, forceCreation).flatMap(userAndDs -> authCheck.hasAdminAccess(userAndDs.getLeft(), userAndDs.getRight())).map(userAndDs -> {
        final MediaType mediaType = mimeTypeOverride == null ? body.getMediaType() : mimeTypeOverride;
        Optional<Loader> loader = LoaderFactory.createFor(mediaType.toString(), formData.getFields().entrySet().stream().filter(entry -> entry.getValue().size() > 0).filter(entry -> entry.getValue().get(0) != null).filter(entry -> MediaTypes.typeEqual(MediaType.TEXT_PLAIN_TYPE, entry.getValue().get(0).getMediaType())).collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get(0).getValue())));
        if (!loader.isPresent()) {
            return errorResponseHelper.error(400, "We do not support the mediatype '" + mediaType + "'. Make sure to add the correct mediatype to the file " + "parameter. In curl you'd use `-F \"file=@<filename>;type=<mediatype>\"`. In a webbrowser you probably " + "have no way of setting the correct mimetype. So you can use a special parameter to override it: " + "`formData.append(\"fileMimeTypeOverride\", \"<mimetype>\");`");
        }
        final DataSet dataSet = userAndDs.getRight();
        ImportManager importManager = dataSet.getImportManager();
        if (StringUtils.isBlank(fileInfo.getName())) {
            return Response.status(400).entity("filename cannot be empty.").build();
        }
        try {
            String fileToken = importManager.addFile(rdfInputStream, fileInfo.getFileName(), mediaType);
            Future<ImportStatus> promise = importManager.generateLog(dataSet.getMetadata().getBaseUri(), dataSet.getMetadata().getBaseUri(), new TabularRdfCreator(loader.get(), fileToken, fileInfo.getFileName()));
            return handleImportManagerResult(promise);
        } catch (FileStorageFailedException | LogStorageFailedException e) {
            LOG.error("Tabular upload failed", e);
            return Response.serverError().build();
        }
    });
    if (result.isLeft()) {
        return result.getLeft();
    } else {
        return result.get();
    }
}
Also used : PathParam(javax.ws.rs.PathParam) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) FormDataContentDisposition(org.glassfish.jersey.media.multipart.FormDataContentDisposition) Produces(javax.ws.rs.Produces) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) LoggerFactory(org.slf4j.LoggerFactory) Path(javax.ws.rs.Path) FormDataMultiPart(org.glassfish.jersey.media.multipart.FormDataMultiPart) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) Future(java.util.concurrent.Future) QueryParam(javax.ws.rs.QueryParam) Consumes(javax.ws.rs.Consumes) Map(java.util.Map) FormDataBodyPart(org.glassfish.jersey.media.multipart.FormDataBodyPart) HeaderParam(javax.ws.rs.HeaderParam) Loader(nl.knaw.huygens.timbuctoo.bulkupload.loaders.Loader) LogStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException) AuthCheck(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.auth.AuthCheck) Either(javaslang.control.Either) Logger(org.slf4j.Logger) POST(javax.ws.rs.POST) ImportManager(nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager) DataStoreCreationException(nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.DataStoreCreationException) LoaderFactory(nl.knaw.huygens.timbuctoo.bulkupload.loaders.LoaderFactory) Collectors(java.util.stream.Collectors) ErrorResponseHelper.handleImportManagerResult(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.ErrorResponseHelper.handleImportManagerResult) ExecutionException(java.util.concurrent.ExecutionException) MediaTypes(org.glassfish.jersey.message.internal.MediaTypes) FormDataParam(org.glassfish.jersey.media.multipart.FormDataParam) Response(javax.ws.rs.core.Response) FileStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.FileStorageFailedException) TabularRdfCreator(nl.knaw.huygens.timbuctoo.v5.bulkupload.TabularRdfCreator) Optional(java.util.Optional) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) InputStream(java.io.InputStream) ImportManager(nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) LogStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException) Loader(nl.knaw.huygens.timbuctoo.bulkupload.loaders.Loader) FileStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.FileStorageFailedException) Response(javax.ws.rs.core.Response) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) MediaType(javax.ws.rs.core.MediaType) TabularRdfCreator(nl.knaw.huygens.timbuctoo.v5.bulkupload.TabularRdfCreator) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) POST(javax.ws.rs.POST)

Example 3 with Type

use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type in project timbuctoo by HuygensING.

the class BdbSchemaStore method setPredicateOccurrence.

public void setPredicateOccurrence(Type type, String predicateUri, Direction direction, int listMutation, int subjectMutation) {
    final Predicate predicate = type.getOrCreatePredicate(predicateUri, direction);
    predicate.registerListOccurrence(listMutation);
    predicate.registerSubject(subjectMutation);
}
Also used : Predicate(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate)

Example 4 with Type

use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type in project timbuctoo by HuygensING.

the class BdbSchemaStore method updatePredicateOccurrence.

public void updatePredicateOccurrence(List<Type> addedTypes, List<Type> removedTypes, List<Type> unchangedTypes, int retractedCount, int unchangedCount, int assertedCount, String predicate, Direction direction) {
    if (!predicate.isEmpty()) {
        boolean wasList = (retractedCount + unchangedCount) > 1;
        boolean isList = (unchangedCount + assertedCount) > 1;
        boolean wasPresent = (retractedCount + unchangedCount) > 0;
        boolean isPresent = (unchangedCount + assertedCount) > 0;
        for (Type type : removedTypes) {
            setPredicateOccurrence(type, predicate, direction, wasList ? -1 : 0, wasPresent ? -1 : 0);
        }
        for (Type type : unchangedTypes) {
            setPredicateOccurrence(type, predicate, direction, wasList == isList ? 0 : isList ? 1 : -1, wasPresent == isPresent ? 0 : isPresent ? 1 : -1);
        }
        for (Type type : addedTypes) {
            setPredicateOccurrence(type, predicate, direction, isList ? 1 : 0, isPresent ? 1 : 0);
        }
    }
}
Also used : Type(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type) ChangeType(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.ChangeType)

Example 5 with Type

use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type in project timbuctoo by HuygensING.

the class RootQuery method rebuildSchema.

public synchronized GraphQLSchema rebuildSchema() {
    final TypeDefinitionRegistry staticQuery = schemaParser.parse(this.staticQuery);
    if (archetypes != null && !archetypes.isEmpty()) {
        staticQuery.merge(schemaParser.parse(archetypes + "extend type DataSetMetadata {\n" + "  archetypes: Archetypes! @passThrough\n" + "}\n" + "\n"));
    }
    TypeDefinitionRegistry registry = new TypeDefinitionRegistry();
    registry.merge(staticQuery);
    final RuntimeWiring.Builder wiring = RuntimeWiring.newRuntimeWiring();
    wiring.type("Query", builder -> builder.dataFetcher("promotedDataSets", env -> dataSetRepository.getPromotedDataSets().stream().map(DataSetWithDatabase::new).collect(Collectors.toList())).dataFetcher("allDataSets", env -> dataSetRepository.getDataSets().stream().map(DataSetWithDatabase::new).filter(x -> {
        if (x.isPublished()) {
            return true;
        } else {
            ContextData contextData = env.getContext();
            UserPermissionCheck userPermissionCheck = contextData.getUserPermissionCheck();
            return userPermissionCheck.getPermissions(x.getDataSet().getMetadata()).contains(Permission.READ);
        }
    }).collect(Collectors.toList())).dataFetcher("dataSetMetadata", env -> {
        final String dataSetId = env.getArgument("dataSetId");
        ContextData context = env.getContext();
        final User user = context.getUser().orElse(null);
        Tuple<String, String> splitCombinedId = DataSetMetaData.splitCombinedId(dataSetId);
        return dataSetRepository.getDataSet(user, splitCombinedId.getLeft(), splitCombinedId.getRight()).map(DataSetWithDatabase::new);
    }).dataFetcher("dataSetMetadataList", env -> {
        Stream<DataSetWithDatabase> dataSets = dataSetRepository.getDataSets().stream().map(DataSetWithDatabase::new);
        if (env.getArgument("promotedOnly")) {
            dataSets = dataSets.filter(DataSetWithDatabase::isPromoted);
        }
        if (env.getArgument("publishedOnly")) {
            dataSets = dataSets.filter(DataSetWithDatabase::isPublished);
        }
        return dataSets.filter(x -> {
            ContextData contextData = env.getContext();
            UserPermissionCheck userPermissionCheck = contextData.getUserPermissionCheck();
            return userPermissionCheck.getPermissions(x.getDataSet().getMetadata()).contains(Permission.READ);
        }).collect(Collectors.toList());
    }).dataFetcher("aboutMe", env -> ((RootData) env.getRoot()).getCurrentUser().orElse(null)).dataFetcher("availableExportMimetypes", env -> supportedFormats.getSupportedMimeTypes().stream().map(MimeTypeDescription::create).collect(Collectors.toList())));
    wiring.type("DataSetMetadata", builder -> builder.dataFetcher("currentImportStatus", env -> {
        DataSetMetaData input = env.getSource();
        Optional<User> currentUser = ((RootData) env.getRoot()).getCurrentUser();
        if (!currentUser.isPresent()) {
            throw new RuntimeException("User is not provided");
        }
        return dataSetRepository.getDataSet(currentUser.get(), input.getOwnerId(), input.getDataSetId()).map(dataSet -> dataSet.getImportManager().getImportStatus());
    }).dataFetcher("dataSetImportStatus", env -> {
        Optional<User> currentUser = ((RootData) env.getRoot()).getCurrentUser();
        if (!currentUser.isPresent()) {
            throw new RuntimeException("User is not provided");
        }
        DataSetMetaData input = env.getSource();
        return dataSetRepository.getDataSet(currentUser.get(), input.getOwnerId(), input.getDataSetId()).map(dataSet -> dataSet.getImportManager().getDataSetImportStatus());
    }).dataFetcher("collectionList", env -> getCollections(env.getSource(), ((ContextData) env.getContext()).getUser())).dataFetcher("collection", env -> {
        String collectionId = (String) env.getArguments().get("collectionId");
        if (collectionId != null && collectionId.endsWith("List")) {
            collectionId = collectionId.substring(0, collectionId.length() - "List".length());
        }
        DataSetMetaData input = env.getSource();
        ContextData context = env.getContext();
        final User user = context.getUser().orElse(null);
        final DataSet dataSet = dataSetRepository.getDataSet(user, input.getOwnerId(), input.getDataSetId()).get();
        final TypeNameStore typeNameStore = dataSet.getTypeNameStore();
        String collectionUri = typeNameStore.makeUri(collectionId);
        if (dataSet.getSchemaStore().getStableTypes() == null || dataSet.getSchemaStore().getStableTypes().get(collectionUri) == null) {
            return null;
        } else {
            return getCollection(dataSet, typeNameStore, dataSet.getSchemaStore().getStableTypes().get(collectionUri));
        }
    }).dataFetcher("dataSetId", env -> ((DataSetMetaData) env.getSource()).getCombinedId()).dataFetcher("dataSetName", env -> ((DataSetMetaData) env.getSource()).getDataSetId()).dataFetcher("ownerId", env -> ((DataSetMetaData) env.getSource()).getOwnerId()));
    wiring.type("CurrentImportStatus", builder -> builder.dataFetcher("elapsedTime", env -> {
        final String timeUnit = env.getArgument("unit");
        return ((ImportStatus) env.getSource()).getElapsedTime(timeUnit);
    }));
    wiring.type("DataSetImportStatus", builder -> builder.dataFetcher("lastImportDuration", env -> {
        final String timeUnit = env.getArgument("unit");
        return ((DataSetImportStatus) env.getSource()).getLastImportDuration(timeUnit);
    }));
    wiring.type("EntryImportStatus", builder -> builder.dataFetcher("elapsedTime", env -> {
        final String timeUnit = env.getArgument("unit");
        return ((EntryImportStatus) env.getSource()).getElapsedTime(timeUnit);
    }));
    wiring.type("CollectionMetadata", builder -> builder.dataFetcher("indexConfig", env -> {
        SubjectReference source = env.getSource();
        final QuadStore qs = source.getDataSet().getQuadStore();
        try (Stream<CursorQuad> quads = qs.getQuads(source.getSubjectUri(), TIM_HASINDEXERCONFIG, Direction.OUT, "")) {
            final Map result = quads.findFirst().map(q -> {
                try {
                    return objectMapper.readValue(q.getObject(), Map.class);
                } catch (IOException e) {
                    LOG.error("Value not a Map", e);
                    return new HashMap<>();
                }
            }).orElse(new HashMap());
            if (!result.containsKey("facet") || !(result.get("facet") instanceof List)) {
                result.put("facet", new ArrayList<>());
            }
            if (!result.containsKey("fullText") || !(result.get("fullText") instanceof List)) {
                result.put("fullText", new ArrayList<>());
            }
            return result;
        }
    }).dataFetcher("viewConfig", new ViewConfigFetcher(objectMapper)));
    wiring.type("AboutMe", builder -> builder.dataFetcher("dataSets", env -> (Iterable) () -> dataSetRepository.getDataSetsWithWriteAccess(env.getSource()).stream().map(DataSetWithDatabase::new).iterator()).dataFetcher("dataSetMetadataList", env -> (Iterable) () -> {
        Stream<DataSetWithDatabase> dataSets = dataSetRepository.getDataSets().stream().map(DataSetWithDatabase::new);
        if (env.getArgument("ownOnly")) {
            String userId = ((ContextData) env.getContext()).getUser().map(u -> "u" + u.getPersistentId()).orElse(null);
            dataSets = dataSets.filter(d -> d.getOwnerId().equals(userId));
        }
        Permission permission = Permission.valueOf(env.getArgument("permission"));
        if (permission != Permission.READ) {
            // Read is implied
            UserPermissionCheck check = ((ContextData) env.getContext()).getUserPermissionCheck();
            dataSets = dataSets.filter(d -> check.getPermissions(d).contains(permission));
        }
        return dataSets.iterator();
    }).dataFetcher("id", env -> ((User) env.getSource()).getPersistentId()).dataFetcher("name", env -> ((User) env.getSource()).getDisplayName()).dataFetcher("personalInfo", env -> "http://example.com").dataFetcher("canCreateDataSet", env -> true));
    wiring.type("Mutation", builder -> builder.dataFetcher("setViewConfig", new ViewConfigMutation(dataSetRepository)).dataFetcher("setSummaryProperties", new SummaryPropsMutation(dataSetRepository)).dataFetcher("setIndexConfig", new IndexConfigMutation(dataSetRepository)).dataFetcher("createDataSet", new CreateDataSetMutation(dataSetRepository)).dataFetcher("deleteDataSet", new DeleteDataSetMutation(dataSetRepository)).dataFetcher("publish", new MakePublicMutation(dataSetRepository)).dataFetcher("extendSchema", new ExtendSchemaMutation(dataSetRepository)).dataFetcher("setDataSetMetadata", new DataSetMetadataMutation(dataSetRepository)).dataFetcher("setCollectionMetadata", new CollectionMetadataMutation(dataSetRepository)));
    wiring.wiringFactory(wiringFactory);
    StringBuilder root = new StringBuilder("type DataSets {\n sillyWorkaroundWhenNoDataSetsAreVisible: Boolean\n");
    boolean[] dataSetAvailable = new boolean[] { false };
    dataSetRepository.getDataSets().forEach(dataSet -> {
        final DataSetMetaData dataSetMetaData = dataSet.getMetadata();
        final String name = dataSetMetaData.getCombinedId();
        Map<String, Type> types = dataSet.getSchemaStore().getStableTypes();
        Map<String, List<ExplicitField>> customSchema = dataSet.getCustomSchema();
        final Map<String, Type> customTypes = new HashMap<>();
        for (Map.Entry<String, List<ExplicitField>> entry : customSchema.entrySet()) {
            ExplicitType explicitType = new ExplicitType(entry.getKey(), entry.getValue());
            customTypes.put(entry.getKey(), explicitType.convertToType());
        }
        Map<String, Type> mergedTypes;
        MergeSchemas mergeSchemas = new MergeSchemas();
        mergedTypes = mergeSchemas.mergeSchema(types, customTypes);
        types = mergedTypes;
        if (types != null) {
            dataSetAvailable[0] = true;
            root.append("  ").append(name).append(":").append(name).append(" @dataSet(userId:\"").append(dataSetMetaData.getOwnerId()).append("\", dataSetId:\"").append(dataSetMetaData.getDataSetId()).append("\")\n");
            wiring.type(name, c -> c.dataFetcher("metadata", env -> new DataSetWithDatabase(dataSet)));
            final String schema = typeGenerator.makeGraphQlTypes(name, types, dataSet.getTypeNameStore());
            staticQuery.merge(schemaParser.parse(schema));
        }
    });
    root.append("}\n\nextend type Query {\n  #The actual dataSets\n  dataSets: DataSets @passThrough\n}\n\n");
    if (dataSetAvailable[0]) {
        staticQuery.merge(schemaParser.parse(root.toString()));
    }
    SchemaGenerator schemaGenerator = new SchemaGenerator();
    return schemaGenerator.makeExecutableSchema(staticQuery, wiring.build());
}
Also used : CursorQuad(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) ImmutableProperty(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableProperty) ExplicitType(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitType) Type(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type) MakePublicMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.MakePublicMutation) LoggerFactory(org.slf4j.LoggerFactory) ExtendSchemaMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ExtendSchemaMutation) DerivedSchemaTypeGenerator(nl.knaw.huygens.timbuctoo.v5.graphql.derivedschema.DerivedSchemaTypeGenerator) DeleteDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DeleteDataSetMutation) SubjectReference(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.SubjectReference) Map(java.util.Map) SummaryPropsMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.SummaryPropsMutation) ImmutableCollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableCollectionMetadataList) TypeNameStore(nl.knaw.huygens.timbuctoo.v5.datastores.prefixstore.TypeNameStore) ImmutablePropertyList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutablePropertyList) ViewConfigFetcher(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ViewConfigFetcher) CreateDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CreateDataSetMutation) RootData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.RootData) TypeDefinitionRegistry(graphql.schema.idl.TypeDefinitionRegistry) Collectors(java.util.stream.Collectors) Resources.getResource(com.google.common.io.Resources.getResource) List(java.util.List) Stream(java.util.stream.Stream) DataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData) ExplicitField(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitField) Optional(java.util.Optional) Direction(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction) RdfWiringFactory(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.RdfWiringFactory) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) CollectionMetadata(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.CollectionMetadata) SupportedExportFormats(nl.knaw.huygens.timbuctoo.v5.dropwizard.SupportedExportFormats) CollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.CollectionMetadataList) DataSetImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetImportStatus) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) HashMap(java.util.HashMap) QuadStore(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.QuadStore) Supplier(java.util.function.Supplier) ContextData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.ContextData) ArrayList(java.util.ArrayList) User(nl.knaw.huygens.timbuctoo.v5.security.dto.User) SchemaParser(graphql.schema.idl.SchemaParser) ImmutableStringList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableStringList) GraphQLSchema(graphql.schema.GraphQLSchema) ImmutableCollectionMetadata(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableCollectionMetadata) Charsets(com.google.common.base.Charsets) ViewConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ViewConfigMutation) Logger(org.slf4j.Logger) UserPermissionCheck(nl.knaw.huygens.timbuctoo.v5.graphql.security.UserPermissionCheck) Resources(com.google.common.io.Resources) MimeTypeDescription(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.MimeTypeDescription) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) MergeSchemas(nl.knaw.huygens.timbuctoo.v5.graphql.customschema.MergeSchemas) Property(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.Property) IOException(java.io.IOException) DataSetWithDatabase(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.DataSetWithDatabase) EntryImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.dto.EntryImportStatus) TIM_HASINDEXERCONFIG(nl.knaw.huygens.timbuctoo.v5.util.RdfConstants.TIM_HASINDEXERCONFIG) Permission(nl.knaw.huygens.timbuctoo.v5.security.dto.Permission) IndexConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.IndexConfigMutation) RuntimeWiring(graphql.schema.idl.RuntimeWiring) DataSetMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DataSetMetadataMutation) CollectionMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CollectionMetadataMutation) SchemaGenerator(graphql.schema.idl.SchemaGenerator) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) Collections(java.util.Collections) MergeSchemas(nl.knaw.huygens.timbuctoo.v5.graphql.customschema.MergeSchemas) QuadStore(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.QuadStore) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) HashMap(java.util.HashMap) TypeNameStore(nl.knaw.huygens.timbuctoo.v5.datastores.prefixstore.TypeNameStore) ViewConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ViewConfigMutation) Permission(nl.knaw.huygens.timbuctoo.v5.security.dto.Permission) ContextData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.ContextData) Stream(java.util.stream.Stream) ImmutableCollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableCollectionMetadataList) ImmutablePropertyList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutablePropertyList) List(java.util.List) CollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.CollectionMetadataList) ArrayList(java.util.ArrayList) ImmutableStringList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableStringList) MakePublicMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.MakePublicMutation) ExplicitType(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitType) Optional(java.util.Optional) RootData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.RootData) IndexConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.IndexConfigMutation) RuntimeWiring(graphql.schema.idl.RuntimeWiring) DataSetWithDatabase(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.DataSetWithDatabase) DataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData) Map(java.util.Map) HashMap(java.util.HashMap) User(nl.knaw.huygens.timbuctoo.v5.security.dto.User) CollectionMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CollectionMetadataMutation) TypeDefinitionRegistry(graphql.schema.idl.TypeDefinitionRegistry) SubjectReference(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.SubjectReference) DeleteDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DeleteDataSetMutation) CursorQuad(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad) CreateDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CreateDataSetMutation) DataSetMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DataSetMetadataMutation) ExtendSchemaMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ExtendSchemaMutation) SchemaGenerator(graphql.schema.idl.SchemaGenerator) IOException(java.io.IOException) ViewConfigFetcher(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ViewConfigFetcher) ExplicitType(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitType) Type(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type) SummaryPropsMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.SummaryPropsMutation) UserPermissionCheck(nl.knaw.huygens.timbuctoo.v5.graphql.security.UserPermissionCheck)

Aggregations

Type (nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type)17 Test (org.junit.Test)13 HashMap (java.util.HashMap)9 Map (java.util.Map)8 Predicate (nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate)8 MergeSchemas (nl.knaw.huygens.timbuctoo.v5.graphql.customschema.MergeSchemas)8 IOException (java.io.IOException)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 List (java.util.List)5 Optional (java.util.Optional)5 DataSet (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet)5 QuadStore (nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.QuadStore)5 Logger (org.slf4j.Logger)5 ArrayList (java.util.ArrayList)4 ImportStatus (nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus)4 CursorQuad (nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad)4 Direction (nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction)4 DocumentLoader (com.github.jsonldjava.core.DocumentLoader)3 Collectors (java.util.stream.Collectors)3 LoggerFactory (org.slf4j.LoggerFactory)3