Skip to content

Commit

Permalink
Merge pull request #577 from visualize-admin/fix/opendataswiss
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne authored May 31, 2022
2 parents 7daf364 + d8a4fb7 commit 17f8e71
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/graphql/queries/data-cubes.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ query DataCubes(
dataCube {
iri
title
workExamples
creator {
iri
label
Expand Down Expand Up @@ -91,6 +92,7 @@ query DataCubeMetadata($iri: String!, $locale: String!, $latest: Boolean) {
description
publisher
version
workExamples
contactName
contactEmail
landingPage
Expand Down Expand Up @@ -119,6 +121,7 @@ query DataCubeMetadataWithComponentValues(
title
publisher
identifier
workExamples
creator {
iri
}
Expand Down
10 changes: 7 additions & 3 deletions app/graphql/query-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type DataCube = {
contactEmail?: Maybe<Scalars['String']>;
creator?: Maybe<DataCubeOrganization>;
landingPage?: Maybe<Scalars['String']>;
workExamples?: Maybe<Array<Maybe<Scalars['String']>>>;
publisher?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
datePublished?: Maybe<Scalars['String']>;
Expand Down Expand Up @@ -334,7 +335,7 @@ export type DataCubesQueryVariables = Exact<{
}>;


export type DataCubesQuery = { __typename: 'Query', dataCubes: Array<{ __typename: 'DataCubeResult', highlightedTitle?: Maybe<string>, highlightedDescription?: Maybe<string>, dataCube: { __typename: 'DataCube', iri: string, title: string, description?: Maybe<string>, publicationStatus: DataCubePublicationStatus, datePublished?: Maybe<string>, creator?: Maybe<{ __typename: 'DataCubeOrganization', iri: string, label?: Maybe<string> }>, themes: Array<{ __typename: 'DataCubeTheme', iri: string, label?: Maybe<string> }> } }> };
export type DataCubesQuery = { __typename: 'Query', dataCubes: Array<{ __typename: 'DataCubeResult', highlightedTitle?: Maybe<string>, highlightedDescription?: Maybe<string>, dataCube: { __typename: 'DataCube', iri: string, title: string, workExamples?: Maybe<Array<Maybe<string>>>, description?: Maybe<string>, publicationStatus: DataCubePublicationStatus, datePublished?: Maybe<string>, creator?: Maybe<{ __typename: 'DataCubeOrganization', iri: string, label?: Maybe<string> }>, themes: Array<{ __typename: 'DataCubeTheme', iri: string, label?: Maybe<string> }> } }> };

type DimensionMetaData_GeoCoordinatesDimension_Fragment = { __typename: 'GeoCoordinatesDimension', iri: string, label: string, isNumerical: boolean, isKeyDimension: boolean, values: Array<any>, unit?: Maybe<string>, related?: Maybe<Array<{ __typename: 'RelatedDimension', iri: string, type: string }>> };

Expand Down Expand Up @@ -398,7 +399,7 @@ export type DataCubeMetadataQueryVariables = Exact<{
}>;


export type DataCubeMetadataQuery = { __typename: 'Query', dataCubeByIri?: Maybe<{ __typename: 'DataCube', iri: string, identifier?: Maybe<string>, title: string, description?: Maybe<string>, publisher?: Maybe<string>, version?: Maybe<string>, contactName?: Maybe<string>, contactEmail?: Maybe<string>, landingPage?: Maybe<string>, expires?: Maybe<string>, datePublished?: Maybe<string>, publicationStatus: DataCubePublicationStatus, themes: Array<{ __typename: 'DataCubeTheme', iri: string, label?: Maybe<string> }>, creator?: Maybe<{ __typename: 'DataCubeOrganization', iri: string, label?: Maybe<string> }> }> };
export type DataCubeMetadataQuery = { __typename: 'Query', dataCubeByIri?: Maybe<{ __typename: 'DataCube', iri: string, identifier?: Maybe<string>, title: string, description?: Maybe<string>, publisher?: Maybe<string>, version?: Maybe<string>, workExamples?: Maybe<Array<Maybe<string>>>, contactName?: Maybe<string>, contactEmail?: Maybe<string>, landingPage?: Maybe<string>, expires?: Maybe<string>, datePublished?: Maybe<string>, publicationStatus: DataCubePublicationStatus, themes: Array<{ __typename: 'DataCubeTheme', iri: string, label?: Maybe<string> }>, creator?: Maybe<{ __typename: 'DataCubeOrganization', iri: string, label?: Maybe<string> }> }> };

export type DataCubeMetadataWithComponentValuesQueryVariables = Exact<{
iri: Scalars['String'];
Expand All @@ -408,7 +409,7 @@ export type DataCubeMetadataWithComponentValuesQueryVariables = Exact<{
}>;


export type DataCubeMetadataWithComponentValuesQuery = { __typename: 'Query', dataCubeByIri?: Maybe<{ __typename: 'DataCube', iri: string, title: string, publisher?: Maybe<string>, identifier?: Maybe<string>, creator?: Maybe<{ __typename: 'DataCubeOrganization', iri: string }>, dimensions: Array<(
export type DataCubeMetadataWithComponentValuesQuery = { __typename: 'Query', dataCubeByIri?: Maybe<{ __typename: 'DataCube', iri: string, title: string, publisher?: Maybe<string>, identifier?: Maybe<string>, workExamples?: Maybe<Array<Maybe<string>>>, creator?: Maybe<{ __typename: 'DataCubeOrganization', iri: string }>, dimensions: Array<(
{ __typename: 'GeoCoordinatesDimension' }
& DimensionMetaData_GeoCoordinatesDimension_Fragment
) | (
Expand Down Expand Up @@ -599,6 +600,7 @@ export const DataCubesDocument = gql`
dataCube {
iri
title
workExamples
creator {
iri
label
Expand Down Expand Up @@ -661,6 +663,7 @@ export const DataCubeMetadataDocument = gql`
description
publisher
version
workExamples
contactName
contactEmail
landingPage
Expand Down Expand Up @@ -689,6 +692,7 @@ export const DataCubeMetadataWithComponentValuesDocument = gql`
title
publisher
identifier
workExamples
creator {
iri
}
Expand Down
2 changes: 2 additions & 0 deletions app/graphql/resolver-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type DataCube = {
contactEmail?: Maybe<Scalars['String']>;
creator?: Maybe<DataCubeOrganization>;
landingPage?: Maybe<Scalars['String']>;
workExamples?: Maybe<Array<Maybe<Scalars['String']>>>;
publisher?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
datePublished?: Maybe<Scalars['String']>;
Expand Down Expand Up @@ -470,6 +471,7 @@ export type DataCubeResolvers<ContextType = any, ParentType extends ResolversPar
contactEmail?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
creator?: Resolver<Maybe<ResolversTypes['DataCubeOrganization']>, ParentType, ContextType>;
landingPage?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
workExamples?: Resolver<Maybe<Array<Maybe<ResolversTypes['String']>>>, ParentType, ContextType>;
publisher?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
description?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
datePublished?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
Expand Down
1 change: 1 addition & 0 deletions app/graphql/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const DataCube: DataCubeResolvers = {
title: ({ data: { title } }) => title,
version: ({ data: { version } }) => version ?? null,
identifier: ({ data: { identifier } }) => identifier ?? null,
workExamples: ({ data: { workExamples } }) => workExamples ?? null,
publisher: ({ data: { publisher } }) => publisher ?? null,
contactName: ({ data: { contactPoint } }) => contactPoint?.name ?? null,
contactEmail: ({ data: { contactPoint } }) => contactPoint?.email ?? null,
Expand Down
1 change: 1 addition & 0 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type DataCube {
contactEmail: String
creator: DataCubeOrganization
landingPage: String
workExamples: [String]
publisher: String
description: String
datePublished: String
Expand Down
1 change: 1 addition & 0 deletions app/graphql/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type ResolvedDataCube = {
landingPage?: string;
expires?: string;
keywords?: string[];
workExamples?: string[];
};
};

Expand Down
1 change: 1 addition & 0 deletions app/rdf/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const parseCube = ({
landingPage: cube.out(ns.dcat.landingPage)?.value,
expires: cube.out(ns.schema.expires)?.value,
keywords: cube.out(ns.dcat.keyword)?.values,
workExamples: cube.out(ns.schema.workExample)?.values,
},
};
};
Expand Down
5 changes: 4 additions & 1 deletion app/utils/opendata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const makeOpenDataLink = (
) => {
const identifier = cube?.identifier;
const creatorIri = cube?.creator?.iri;
if (!identifier || !creatorIri) {
const isPublished = cube?.workExamples?.includes(
"https://ld.admin.ch/application/opendataswiss"
);
if (!identifier || !creatorIri || !isPublished) {
return;
}
return `https://opendata.swiss/${lang}/perma/${encodeURIComponent(
Expand Down

1 comment on commit 17f8e71

@vercel
Copy link

@vercel vercel bot commented on 17f8e71 May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.