@@ -55,6 +55,12 @@ export class Property {
5555 }
5656}
5757
58+ export interface ShortInfo {
59+ id : string ;
60+ label : string ;
61+ comment : string ;
62+ }
63+
5864@Component ( {
5965 selector : 'app-property-info' ,
6066 templateUrl : './property-info.component.html' ,
@@ -103,8 +109,8 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
103109 @Output ( ) deleteResourceProperty : EventEmitter < DefaultClass > = new EventEmitter < DefaultClass > ( ) ;
104110 @Output ( ) removePropertyFromClass : EventEmitter < DefaultClass > = new EventEmitter < DefaultClass > ( ) ;
105111
106- // submit res class iri ot open res class
107- @Output ( ) clickedOnClass : EventEmitter < ResourceClassDefinitionWithAllLanguages > = new EventEmitter < ResourceClassDefinitionWithAllLanguages > ( ) ;
112+ // submit res class iri to open res class (not yet implemented)
113+ @Output ( ) clickedOnClass : EventEmitter < ShortInfo > = new EventEmitter < ShortInfo > ( ) ;
108114
109115 propInfo : Property = new Property ( ) ;
110116
@@ -123,7 +129,7 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
123129 defaultProperties : PropertyCategory [ ] = DefaultProperties . data ;
124130
125131 // list of resource classes where the property is used
126- resClasses : ResourceClassDefinitionWithAllLanguages [ ] = [ ] ;
132+ resClasses : ShortInfo [ ] = [ ] ;
127133
128134 // disable edit property button in case the property type is not supported in DSP-APP
129135 disableEditProperty = false ;
@@ -140,7 +146,6 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
140146 this . _cache . get ( 'currentOntology' ) . subscribe (
141147 ( response : ReadOntology ) => {
142148 this . ontology = response ;
143-
144149 }
145150 ) ;
146151 }
@@ -180,13 +185,11 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
180185 }
181186
182187 // get the default property type for this property
183- // if (this.propDef.guiElement) {
184188 this . _ontoService . getDefaultPropType ( this . propDef ) . subscribe (
185189 ( prop : DefaultProperty ) => {
186190 this . propType = prop ;
187191 }
188192 ) ;
189- // }
190193
191194 }
192195
@@ -234,19 +237,25 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
234237
235238 // get all classes where the property is used
236239 if ( ! this . propCard ) {
237-
238- const classes = this . ontology . getAllClassDefinitions ( ) ;
239- for ( const c of classes ) {
240- if ( c . propertiesList . find ( i => i . propertyIndex === this . propDef . id ) ) {
241- this . resClasses . push ( c as ResourceClassDefinitionWithAllLanguages ) ;
240+ this . resClasses = [ ] ;
241+ this . _cache . get ( 'currentProjectOntologies' ) . subscribe (
242+ ( ontologies : ReadOntology [ ] ) => {
243+ ontologies . forEach ( onto => {
244+ const classes = onto . getAllClassDefinitions ( ) ;
245+ classes . forEach ( resClass => {
246+ if ( resClass . propertiesList . find ( prop => prop . propertyIndex === this . propDef . id ) ) {
247+ // build own resClass object with id, label and comment
248+ const propOfClass : ShortInfo = {
249+ id : resClass . id ,
250+ label : resClass . label ,
251+ comment : onto . label + ( resClass . comment ? ': ' + resClass . comment : '' )
252+ } ;
253+ this . resClasses . push ( propOfClass ) ;
254+ }
255+ } ) ;
256+ } ) ;
242257 }
243- // const splittedSubClass = ontology.classes[c].subClassOf[0].split('#');
244-
245- // if (splittedSubClass[0] !== Constants.StandoffOntology && splittedSubClass[1] !== 'StandoffTag' && splittedSubClass[1] !== 'StandoffLinkTag') {
246- // this.ontoClasses.push(this.ontology.classes[c]);
247- // }
248- }
249-
258+ ) ;
250259 }
251260 }
252261
@@ -290,10 +299,10 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
290299 this . _dspApiConnection . v2 . onto . canDeleteCardinalityFromResourceClass ( onto ) . subscribe (
291300 ( canDoRes : CanDoResponse ) => {
292301 this . propCanBeDeleted = canDoRes . canDo ;
293- } ,
294- ( error : ApiResponseError ) => {
295- this . _errorHandler . showMessage ( error ) ;
296302 }
303+ // since this request runs on mouseover, it can always
304+ // ends in a EditConflictException because of a wrong lastModificationDate.
305+ // so, it doesn't make sense to handle the error here and to open the snackbar
297306 ) ;
298307 }
299308
0 commit comments