|
1 | 1 | namespace $.$$ {
|
2 | 2 |
|
| 3 | + export type $hyoo_rdf_resource_key = { subject : string , predicate : string , index : number } |
| 4 | + |
3 | 5 | export class $hyoo_rdf extends $.$hyoo_rdf {
|
4 | 6 |
|
5 | 7 | uri( next? : string ) {
|
@@ -78,24 +80,25 @@ namespace $.$$ {
|
78 | 80 | @ $mol_mem_key
|
79 | 81 | object_rows( { subject , predicate } : { subject : string , predicate : string } ) {
|
80 | 82 | const data = this.data()[ subject ][ predicate ]
|
81 |
| - return Object.keys( data ).map( object => { |
82 |
| - if( data[ object ].resource ) return this.Resource({ subject , predicate , object }) |
83 |
| - return this.Value({ subject , predicate , object }) |
84 |
| - } ) |
| 83 | + |
| 84 | + return data.map((val, index) => { |
| 85 | + if( val.resource ) return this.Resource({ subject , predicate , index }) |
| 86 | + return this.Value({ subject , predicate , index }) |
| 87 | + }) |
85 | 88 | }
|
86 | 89 |
|
87 |
| - resource_title( { subject , predicate , object } : { subject : string , predicate : string , object : string } ) { |
88 |
| - const data = this.data()[ subject ][ predicate ][ object ] |
| 90 | + resource_title( { subject , predicate , index } : $hyoo_rdf_resource_key ) { |
| 91 | + const data = this.data()[ subject ][ predicate ][ index ] |
89 | 92 | return decodeURIComponent( data.resource.replace( /.*[\/#]/ , '' ) ) || '#'
|
90 | 93 | }
|
91 | 94 |
|
92 |
| - resource_uri( { subject , predicate , object } : { subject : string , predicate : string , object : string } ) { |
93 |
| - const data = this.data()[ subject ][ predicate ][ object ] |
| 95 | + resource_uri( { subject , predicate , index } : $hyoo_rdf_resource_key ) { |
| 96 | + const data = this.data()[ subject ][ predicate ][ index ] |
94 | 97 | return this.$.$mol_state_arg.link({ uri : data.resource })
|
95 | 98 | }
|
96 | 99 |
|
97 |
| - value( { subject , predicate , object } : { subject : string , predicate : string , object : string } ) { |
98 |
| - return this.data()[ subject ][ predicate ][ object ].value |
| 100 | + value( { subject , predicate , index } : $hyoo_rdf_resource_key ) { |
| 101 | + return this.data()[ subject ][ predicate ][ index ].value |
99 | 102 | }
|
100 | 103 |
|
101 | 104 | }
|
|
0 commit comments