@@ -14,6 +14,7 @@ import { AbstractControl, FormBuilder, FormControl, FormGroup } from '@angular/f
1414import { MatAutocompleteTrigger } from '@angular/material/autocomplete' ;
1515import { MatDialog , MatDialogConfig } from '@angular/material/dialog' ;
1616import {
17+ Constants ,
1718 CreateLinkValue ,
1819 KnoraApiConnection ,
1920 ReadLinkValue ,
@@ -142,8 +143,19 @@ export class LinkValueComponent extends BaseValueDirective implements OnInit, On
142143 ) ;
143144
144145 this . _dspApiConnection . v2 . ontologyCache . getOntology ( this . currentOntoIri ) . subscribe (
145- ( onto : Map < string , ReadOntology > ) => {
146- const resClasses = onto . get ( this . currentOntoIri ) . getClassDefinitionsByType ( ResourceClassDefinition ) ;
146+ ( ontoMap : Map < string , ReadOntology > ) => {
147+
148+ // filter out knorabase ontology
149+ const filteredOntoMap = new Map (
150+ Array . from ( ontoMap ) . filter ( ( [ key , _ ] ) => key !== Constants . KnoraApiV2 )
151+ ) ;
152+
153+ let resClasses = [ ] ;
154+
155+ // loop through each ontology in the project and create an array of ResourceClassDefinitions
156+ filteredOntoMap . forEach ( onto => {
157+ resClasses = resClasses . concat ( filteredOntoMap . get ( onto . id ) . getClassDefinitionsByType ( ResourceClassDefinition ) ) ;
158+ } ) ;
147159
148160 // add the superclass to the list of resource classes
149161 this . resourceClasses = resClasses . filter (
@@ -154,7 +166,7 @@ export class LinkValueComponent extends BaseValueDirective implements OnInit, On
154166 // and add them to the list of resource classes
155167 this . resourceClasses = this . resourceClasses . concat ( this . _getSubclasses ( resClasses , this . restrictToResourceClass ) ) ;
156168
157- this . properties = onto . get ( this . currentOntoIri ) . getPropertyDefinitionsByType ( ResourcePropertyDefinition ) ;
169+ this . properties = filteredOntoMap . get ( this . currentOntoIri ) . getPropertyDefinitionsByType ( ResourcePropertyDefinition ) ;
158170 } ,
159171 error => {
160172 console . error ( error ) ;
@@ -263,7 +275,7 @@ export class LinkValueComponent extends BaseValueDirective implements OnInit, On
263275 position : {
264276 top : '112px'
265277 } ,
266- data : { mode : mode , title : resClass . label , id : iri , parentResource : this . parentResource , resourceClassDefinition : resClass . id , ontoIri : this . currentOntoIri } ,
278+ data : { mode : mode , title : resClass . label , id : iri , parentResource : this . parentResource , resourceClassDefinition : resClass . id } ,
267279 disableClose : true
268280 } ;
269281
0 commit comments