w3c / csvw

Documents produced by the CSV on the Web Working Group
Other
161 stars 57 forks source link

aboutBNode, valueBNode relations? #885

Open bblfish opened 2 years ago

bblfish commented 2 years ago

Feature request: One may want to generate bnode subjects and objects using information in the table, which could then be forgotten about once the graph is finished.

the :aboutBNode and :valueBNode relations would allow one to specify bnode patterns to do this.

bblfish commented 2 years ago

Along similar lines I was hoping I could find a way to build up a description of a csv table without needing to resort to building URLs, so that I could specify a csv schema in two parts:

So for example for the table

Id,Name,DoB,Sex,mother
1,Linus,02-07-2016,male,4
2,Oliver,02-07-2016,male,4
3,Anaïs,10-09-2014,female,4
4,Gordana,30-05-1982,female,

I would like to be able to get either

[]  <#Name> "Anaïs" ;
    <#DoB> "2014-09-10"^^xsd:date ;
    <#Id> 3 ;
    <#Sex> "female" ;
    <#mother> [ <#Id>  4 ] .

with <#Id> as an owl:InverseFunctionalProperty. I could not find a way to do that with virtual columns.

The other way would be to get something like

_:b3  <#Name> "Anaïs" ;
    <#DoB> "2014-09-10"^^xsd:date ;
    <#Id> 3 ;
    <#Sex> "female" ;
    <#mother> _:b4 .

but in a way that would make it transparent how they were related. Here I was hoping that primary key and foreign keys could help, but I think they need the fields to be URLs. At least this did not give me what I was hoping for.

{
  "@context": [ "http://www.w3.org/ns/csvw", { "@language": "en"} ],
  "dc:title": "example people data",
  "tables": [{
      "url": "pplex.csv",
      "tableSchema": {
      "@id" : "http://example.com/",
      "columns": [
        {
           "name": "Id"
         }, {
           "name": "Name",
           "datatype": "string"
        },  {
           "name": "DoB",
           "datatype": {
             "base": "date",
             "format": "dd-MM-yyyy"
           }
         }, {
           "name": "Sex",
           "datatype": "string"
        }, {
           "name": "mother"
         } ],
       "primaryKey":"Id",
       "foreignKeys": [{
           "columnReference": "mother",
           "reference": {
               "resource": "pplex.csv",
               "columnReference": "Id"
           }
         }]
      }
  }]
}