@@ -29,6 +29,12 @@ import { AutocompleteItem } from 'src/app/workspace/search/advanced-search/resou
2929import { DefaultProperties , DefaultProperty , PropertyCategory , PropertyInfoObject } from '../default-data/default-properties' ;
3030import { OntologyService } from '../ontology.service' ;
3131
32+ export interface ClassToSelect {
33+ ontologyId : string ;
34+ ontologyLabel : string ;
35+ classes : ClassDefinition [ ] ;
36+ }
37+
3238@Component ( {
3339 selector : 'app-property-form' ,
3440 templateUrl : './property-form.component.html' ,
@@ -106,7 +112,7 @@ export class PropertyFormComponent implements OnInit {
106112 lists : ListNodeInfo [ ] ;
107113
108114 // resource classes in this ontology
109- resourceClasses : ClassDefinition [ ] = [ ] ;
115+ ontologyClasses : ClassToSelect [ ] = [ ] ;
110116
111117 loading = false ;
112118
@@ -136,15 +142,12 @@ export class PropertyFormComponent implements OnInit {
136142
137143 this . loading = true ;
138144
145+ // set various lists to select from
139146 this . _cache . get ( 'currentOntology' ) . subscribe (
140147 ( response : ReadOntology ) => {
141148 this . ontology = response ;
142149 this . lastModificationDate = response . lastModificationDate ;
143150
144- // set various lists to select from
145- // a) in case of link value:
146- // set list of resource classes from response; needed for linkValue
147- this . resourceClasses = response . getAllClassDefinitions ( ) ;
148151 const resourceProperties = response . getAllPropertyDefinitions ( ) ;
149152
150153 // set list of all existing resource property names to avoid same name twice
@@ -156,7 +159,7 @@ export class PropertyFormComponent implements OnInit {
156159 } ) ;
157160
158161 // add all resource classes to the same list
159- this . resourceClasses . forEach ( ( resClass : ClassDefinition ) => {
162+ response . getAllClassDefinitions ( ) . forEach ( ( resClass : ClassDefinition ) => {
160163 const name = this . _os . getNameFromIri ( resClass . id ) ;
161164 this . existingNames . push (
162165 new RegExp ( '(?:^|W)' + name . toLowerCase ( ) + '(?:$|W)' )
@@ -169,8 +172,25 @@ export class PropertyFormComponent implements OnInit {
169172 }
170173 ) ;
171174
172- // b) in case of list value:s
175+ // a) in case of link value:
176+ // set list of resource classes from response; needed for linkValue
177+ this . _cache . get ( 'currentProjectOntologies' ) . subscribe (
178+ ( response : ReadOntology [ ] ) => {
179+ // reset list of ontology classes
180+ this . ontologyClasses = [ ] ;
181+ response . forEach ( onto => {
182+ const ontoClasses : ClassToSelect = {
183+ ontologyId : onto . id ,
184+ ontologyLabel : onto . label ,
185+ classes : onto . getAllClassDefinitions ( )
186+ } ;
187+ this . ontologyClasses . push ( ontoClasses ) ;
188+ } ) ;
189+
190+ }
191+ ) ;
173192
193+ // b) in case of list value:
174194 // set list of lists; needed for listValue
175195 this . _cache . get ( 'currentOntologyLists' ) . subscribe (
176196 ( response : ListNodeInfo [ ] ) => {
0 commit comments