solis 0.103.0 → 0.104.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a78201a61e91f4b29557e2877c935762b8ec97601fd4c9d9b34824d8ddb7030
4
- data.tar.gz: ac10f1eb1d188eeca069ba3eb3cece17a7580832ffbbb18872531ccb4b74c5ba
3
+ metadata.gz: 77c7e9c049e1f92751d4b71ad2e8d1771c36c4921af365d3ff47f70b0b99f22f
4
+ data.tar.gz: ff9c184e4954b39b510a4893df7bee4079e8223baca6c5f5e27f2c758b025dfd
5
5
  SHA512:
6
- metadata.gz: 6b03ac2067ca7f8afe515d61f6cfd26404cf99345d120b2a9ba15b7bc9ef92bce4b0853a3c89d216227c39db270b40002daab380061454ee031e980bfc279de7
7
- data.tar.gz: 63b24bc564eeac3cf095e96c54f47b886c841511104d88650de88463842e7d8e7fe6c8c71b0de42ee1b459bdcca719fca6b334a15cd9024512b574599337716a
6
+ metadata.gz: 11e9f319e99271f7a7b737f721cba84ba64637e5a2aec72b9579a0b47bb9e02235c1901fc1f586270ad9d5fa2605a1fa141bf6a32e7dd58a9d65041f9c5be750
7
+ data.tar.gz: ef3424d4530d0e96aa307f2b6a707dce7e3febdfd578878ac34af315067f1cc6470d482408c09f5d0d8909a14543126543e8dd5e61a2db962a8a7164d7a34fbf
data/README.md CHANGED
@@ -223,6 +223,199 @@ When query returns not found
223
223
  #### Solis::Shape::Reader::File
224
224
  #### Solis::Shape::Reader::Sheet
225
225
 
226
+ ## Supported Data Types
227
+
228
+ ### Extended Date/Time Format (EDTF)
229
+
230
+ Solis supports the [Extended Date/Time Format (EDTF)](https://www.loc.gov/standards/datetime/) specification from the Library of Congress. EDTF extends ISO 8601 to represent uncertain, approximate, and imprecise dates commonly found in cultural heritage and archival materials.
231
+
232
+ #### Using EDTF in SHACL
233
+
234
+ Define EDTF fields in your SHACL shapes using the Library of Congress namespace:
235
+
236
+ ```turtle
237
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
238
+ @prefix edtf: <http://id.loc.gov/datatypes/edtf> .
239
+ @prefix ex: <http://example.org/> .
240
+
241
+ ex:ArtworkShape
242
+ a sh:NodeShape ;
243
+ sh:targetClass ex:Artwork ;
244
+ sh:property [
245
+ sh:path ex:creationDate ;
246
+ sh:name "creationDate" ;
247
+ sh:description "Date or date range when artwork was created" ;
248
+ sh:datatype edtf: ;
249
+ sh:minCount 0 ;
250
+ sh:maxCount 1 ;
251
+ ] .
252
+ ```
253
+
254
+ #### EDTF Features Supported
255
+
256
+ **Basic Dates (Level 0):**
257
+ ```ruby
258
+ # Year precision
259
+ artwork.creation_date = "1984"
260
+
261
+ # Month precision
262
+ artwork.creation_date = "1984-05"
263
+
264
+ # Day precision
265
+ artwork.creation_date = "1984-05-26"
266
+ ```
267
+
268
+ **Uncertainty and Approximation (Level 1):**
269
+ ```ruby
270
+ # Uncertain date (?)
271
+ artwork.creation_date = "1984?" # Possibly 1984
272
+
273
+ # Approximate date (~)
274
+ artwork.creation_date = "1984~" # Approximately 1984
275
+
276
+ # Both uncertain and approximate
277
+ artwork.creation_date = "1984?~" # Possibly around 1984
278
+
279
+ # Uncertain at different precisions
280
+ artwork.creation_date = "1984-05?" # Possibly May 1984
281
+ artwork.creation_date = "1984-05-26?" # Possibly May 26, 1984
282
+ ```
283
+
284
+ **Date Intervals (Level 1):**
285
+ ```ruby
286
+ # Date range
287
+ artwork.creation_date = "1984/2004" # Between 1984 and 2004
288
+
289
+ # Uncertain intervals
290
+ artwork.creation_date = "1984-06?/2004-08?" # Between possibly June 1984 and possibly August 2004
291
+ ```
292
+
293
+ **Seasons (Level 1):**
294
+ ```ruby
295
+ artwork.creation_date = "2001-21" # Spring 2001
296
+ artwork.creation_date = "2001-22" # Summer 2001
297
+ artwork.creation_date = "2001-23" # Autumn 2001
298
+ artwork.creation_date = "2001-24" # Winter 2001
299
+ ```
300
+
301
+ **Extended Features (Level 2):**
302
+ ```ruby
303
+ # Masked precision (decades/centuries)
304
+ artwork.creation_date = "198X" # Some year in the 1980s
305
+ artwork.creation_date = "19XX" # Some year in the 1900s
306
+
307
+ # Sets of dates
308
+ artwork.creation_date = "[1667,1668,1670..1672]" # Multiple possible dates
309
+ ```
310
+
311
+ #### Working with EDTF Values
312
+
313
+ **Creating records with EDTF:**
314
+ ```ruby
315
+ # Using EDTF strings
316
+ artwork = Artwork.new({
317
+ id: '1',
318
+ title: 'Unknown Masterpiece',
319
+ creation_date: '1984?' # Uncertain year
320
+ })
321
+ artwork.save
322
+ ```
323
+
324
+ **Querying EDTF fields:**
325
+ ```ruby
326
+ # Retrieve records
327
+ result = ArtworkResource.all({filter: {id: '1'}})
328
+ artwork = result.data.first
329
+
330
+ # EDTF values are returned as strings
331
+ puts artwork.creation_date # => "1984?"
332
+ ```
333
+
334
+ **Working with EDTF objects directly:**
335
+ ```ruby
336
+ # Parse EDTF string
337
+ date = Date.edtf('1984?')
338
+
339
+ # Check properties
340
+ date.uncertain? # => true
341
+ date.approximate? # => false
342
+ date.edtf # => "1984?"
343
+
344
+ # Intervals
345
+ interval = Date.edtf('1984/2004')
346
+ interval.length # => Duration in days
347
+ interval.from # => Start date
348
+ interval.to # => End date
349
+
350
+ # Seasons
351
+ season = Date.edtf('2001-21')
352
+ season.spring? # => true
353
+ season.year # => 2001
354
+ ```
355
+
356
+ **RDF Storage:**
357
+
358
+ EDTF values are stored in RDF as typed literals with the correct datatype URI:
359
+
360
+ ```turtle
361
+ <http://example.org/artworks/1>
362
+ <http://example.org/creationDate>
363
+ "1984?"^^<http://id.loc.gov/datatypes/edtf> .
364
+ ```
365
+
366
+ #### Common Use Cases
367
+
368
+ **Archival Records:**
369
+ ```ruby
370
+ # Uncertain historical date
371
+ document.date = "1776-07-04?"
372
+
373
+ # Approximate date range
374
+ manuscript.date = "1450~/1475~"
375
+ ```
376
+
377
+ **Museum Collections:**
378
+ ```ruby
379
+ # Decade precision for artwork
380
+ painting.creation_date = "186X"
381
+
382
+ # Season when photograph was taken
383
+ photo.date = "1965-22" # Summer 1965
384
+ ```
385
+
386
+ **Publication Dates:**
387
+ ```ruby
388
+ # Uncertain publication year
389
+ book.publication_date = "1923?"
390
+
391
+ # Date range for serial publications
392
+ journal.coverage = "1990/1995"
393
+ ```
394
+
395
+ #### Additional Resources
396
+
397
+ - [EDTF Specification](https://www.loc.gov/standards/datetime/)
398
+ - [Library of Congress EDTF Datatypes](https://id.loc.gov/datatypes/edtf.html)
399
+ - [EDTF Ruby Gem Documentation](https://github.com/inukshuk/edtf-ruby)
400
+
401
+ ### Other Supported Datatypes
402
+
403
+ Solis also supports standard XSD and RDF datatypes:
404
+
405
+ - **xsd:string** - Text strings
406
+ - **xsd:integer** - Whole numbers
407
+ - **xsd:boolean** - True/false values
408
+ - **xsd:date** - Standard dates (YYYY-MM-DD)
409
+ - **xsd:dateTime** - Date with time
410
+ - **xsd:float**, **xsd:double** - Decimal numbers
411
+ - **xsd:gYear** - Year only
412
+ - **xsd:duration** - ISO 8601 durations
413
+ - **xsd:anyURI** - URI/URL values
414
+ - **rdf:langString** - Language-tagged strings
415
+ - **rdf:JSON** - JSON objects
416
+ - **time:DateTimeInterval** - Time intervals
417
+ - **schema:temporalCoverage** - Temporal coverage periods
418
+
226
419
  ### Setup Solis
227
420
  ``` ruby
228
421
  Solis::ConfigFile.path = './'
data/lib/solis/model.rb CHANGED
@@ -663,6 +663,13 @@ values ?s {<#{self.graph_id}>}
663
663
  end
664
664
  elsif metadata[:datatype_rdf].eql?('http://www.w3.org/2001/XMLSchema#anyURI') || metadata[:node].is_a?(RDF::URI)
665
665
  RDF::URI(d)
666
+ elsif metadata[:datatype_rdf] =~ /datatypes\/edtf/ || metadata[:datatype_rdf] =~ /edtf$/i
667
+ # Handle EDTF dates
668
+ begin
669
+ RDF::Literal::EDTF.new(d)
670
+ rescue StandardError => e
671
+ raise Solis::Error::InvalidDatatypeError, "#{hierarchy.join('.')}.#{attribute}: #{e.message}"
672
+ end
666
673
  elsif metadata[:datatype_rdf].eql?('http://www.w3.org/2006/time#DateTimeInterval')
667
674
  begin
668
675
  datatype = metadata[:datatype_rdf]