Skip to content

Commit

Permalink
feat: hidden-graph
Browse files Browse the repository at this point in the history
move flag from Cube Metadata to Project (cc:isHiddenCube)
  • Loading branch information
mchlrch committed Mar 6, 2024
1 parent d93e2e0 commit dcf7065
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
12 changes: 11 additions & 1 deletion apis/core/bootstrap/shapes/cube-project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cc, sh1, shape, editor } from '@cube-creator/core/namespace'
import { dash, dcterms, hydra, rdf, rdfs, schema, sh } from '@tpluscode/rdf-ns-builders'
import { dash, dcterms, hydra, rdf, rdfs, schema, sh, xsd } from '@tpluscode/rdf-ns-builders'
import { turtle } from '@tpluscode/rdf-string'
import $rdf from 'rdf-ext'

Expand Down Expand Up @@ -144,6 +144,16 @@ const projectProperties = ({ xoneAlternatives = [] }: { xoneAlternatives?: unkno
${hydra.collection} <organizations> ;
${sh.order} 20 ;
] ;
${sh.property} [
${sh.name} "Hide this cube?" ;
${sh.description} "Hidden cubes are only visible in *visualize* for logged-in users" ;
${sh.path} ${cc.isHiddenCube} ;
${sh.datatype} ${xsd.boolean} ;
${sh.defaultValue} ${true} ;
${sh.minCount} 1 ;
${sh.maxCount} 1 ;
${sh.order} 21 ;
] ;
${sh.xone} ( ${xoneAlternatives} ) ;`

export const CubeProjectShape = turtle`
Expand Down
15 changes: 1 addition & 14 deletions apis/core/bootstrap/shapes/dataset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shape, editor, lindasSchema, cc } from '@cube-creator/core/namespace'
import { shape, editor, lindasSchema } from '@cube-creator/core/namespace'
import { supportedLanguages } from '@cube-creator/core/languages'
import { hydra, rdfs, sh, dcat, dcterms, xsd, rdf, vcard, schema, _void, dash, skos } from '@tpluscode/rdf-ns-builders'
import { sparql, turtle } from '@tpluscode/rdf-string'
Expand Down Expand Up @@ -209,19 +209,6 @@ ${shapeId} {
${sh.description} "Only published datasets will be listed in the external tools. A draft will be nevertheless be public." ;
${sh.group} ${mainGroup} ;
] ;
${sh.property} [
${sh.name} "Hide this cube?" ;
${sh.path} ${cc.isHiddenCube} ;
${sh.datatype} ${xsd.boolean} ;
${sh.defaultValue} ${false} ;
${sh.minCount} 1 ;
${sh.maxCount} 1 ;
${sh.order} 31 ;
${sh.description} "Hidden cubes are only visible in *visualize* for logged-in users" ;
${sh.group} ${mainGroup} ;
] ;
${sh.property} [
${sh.name} "Publish to" ;
${sh.path} ${schema.workExample} ;
Expand Down
2 changes: 1 addition & 1 deletion apis/core/lib/domain/job/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function createPublishJob({

const metadata = await store.getResource(project.dataset)

const targetGraph = metadata.isHiddenCube ? $rdf.namedNode(organization.publishGraph.value + '/hidden') : organization.publishGraph
const targetGraph = project.isHiddenCube ? $rdf.namedNode(organization.publishGraph.value + '/hidden') : organization.publishGraph

Check warning on line 80 in apis/core/lib/domain/job/create.ts

View check run for this annotation

Codecov / codecov/patch

apis/core/lib/domain/job/create.ts#L79-L80

Added lines #L79 - L80 were not covered by tests
const jobPointer = await store.createMember(jobCollection.term, id.job(jobCollection))
const job = Job.createPublish(jobPointer, {
Expand Down
4 changes: 0 additions & 4 deletions packages/model/Dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface Dataset extends RdfResource {
title: Literal[]
created: Date
published: Date
isHiddenCube: boolean
}

export const Error = {
Expand Down Expand Up @@ -44,9 +43,6 @@ export function DatasetMixin<Base extends Constructor>(Resource: Base): Mixin {

@property.literal({ path: schema.datePublished, type: Date, datatype: xsd.date })
published!: Date

@property.literal({ path: cc.isHiddenCube, datatype: xsd.boolean })
isHiddenCube!: boolean
}

return Impl
Expand Down
6 changes: 5 additions & 1 deletion packages/model/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { GraphPointer } from 'clownface'
import RdfResourceImpl, { Initializer, RdfResourceCore } from '@tpluscode/rdfine/RdfResource'
import { Mixin } from '@tpluscode/rdfine/lib/ResourceFactory'
import { cc, lindasSchema } from '@cube-creator/core/namespace'
import { dcterms, schema } from '@tpluscode/rdf-ns-builders'
import { dcterms, schema, xsd } from '@tpluscode/rdf-ns-builders'
import { Organization, Person, PersonMixin } from '@rdfine/schema'
import type { Collection } from '@rdfine/hydra'
import { initializer } from './lib/initializer'
Expand All @@ -28,6 +28,7 @@ export interface Project extends RdfResource {
export: Link
details: Link
plannedNextUpdate?: Date
isHiddenCube: boolean
}

export interface CsvProject extends Project {
Expand Down Expand Up @@ -97,6 +98,9 @@ export function ProjectMixin<Base extends Constructor>(base: Base): Mixin {

@property.literal({ path: lindasSchema.datasetNextDateModified, type: Date })
plannedNextUpdate?: Date

@property.literal({ path: cc.isHiddenCube, datatype: xsd.boolean })
isHiddenCube!: boolean
}

return Impl
Expand Down

0 comments on commit dcf7065

Please sign in to comment.