| 130 | |
| 131 | // Converts a triple to the JSON-LD library representation |
| 132 | function toJsonLdTriple(subject, predicate, object) { |
| 133 | return { |
| 134 | subject: { value: subject, type: subject[0] !== '_' ? 'IRI' : 'blank node' }, |
| 135 | predicate: { value: predicate, type: predicate[0] !== '_' ? 'IRI' : 'blank node' }, |
| 136 | object: !N3.Util.isLiteral(object) ? |
| 137 | { value: object, type: object[0] !== '_' ? 'IRI' : 'blank node' } : |
| 138 | { |
| 139 | value: N3.Util.getLiteralValue(object), |
| 140 | datatype: N3.Util.getLiteralType(object), |
| 141 | language: N3.Util.getLiteralLanguage(object), |
| 142 | }, |
| 143 | }; |
| 144 | } |
| 145 | |
| 146 | module.exports = RdfView; |