-
Notifications
You must be signed in to change notification settings - Fork 36
conversion:bundled_by
"bundled by" changes the subject of the triple to create. The object of "bundled by" is the thing with which to make the subject URI, which could be a value from another column (explicit) or an entirely new instance that can have its own properties (implicit).
Values can be bundled by an implicit resource (as in Dataset 10025) or an inline resource (as in Dataset 1147). In the case of an implicit resource a URI is created to bundle the values, while in the inline case no URI is created and the values are associated with a resource that was promoted from an existing value.
(TODO: because of the poor quality of 1147, a new example needs to be used. -Tim)
e.g., Dataset 1147
@prefix : <http://logd.tw.rpi.edu/source/data-gov/dataset/1147/params/enhancement/1/> .
:dataset a void:Dataset;
conversion:base_uri "http://logd.tw.rpi.edu"^^xsd:anyURI;
conversion:source_identifier "data-gov";
conversion:dataset_identifier "1147";
conversion:dataset_version "2009-Oct-08";
conversion:conversion_process [
conversion:enhance [
ov:csvCol 3;
ov:csvHeader "State_Code_Dest";
conversion:range rdfs:Resource; # Inline bundles must be promoted to resources.
a conversion:TypedResourcePromotionEnhancement; # This rdf:type is not required for inline bundling.
conversion:range_name "state";
];
conv:enhance [
ov:csvCol 5;
ov:csvHeader "State_Abbrv";
conversion:range rdfs:Literal;
a conversion:ExistingBundleEnhancement;
conversion:bundled_by [ ov:csvCol 3 ];
];
];
.
@prefix ds1147: <http://logd.tw.rpi.edu/source/data-gov/dataset/1147/version/2009-Oct-08/> .
@prefix raw: <http://logd.tw.rpi.edu/source/data-gov/dataset/1147/vocab/raw/> .
@prefix e1: <http://logd.tw.rpi.edu/source/
ds1147:thing_6
raw:state_code_origin "01";
raw:state_abbrv "AL";
.
becomes
ds1147:thing_6
e1:state_code_origin <http://logd.tw.rpi.edu/source/data-gov/dataset/1147/version/2009-Oct-08/state/01>;
# e1:state_abbrv does NOT describe ds1146:thing_6
.
<http://logd.tw.rpi.edu/source/data-gov/dataset/1147/version/2009-Oct-08/state/01>
e1:state_abbrv "AL";
rdfs:label "01";
.
(TODO: one-level vs hierarchical)
Other datasets that benefit from this enhancement include Dataset 1492.
See
conversion:enhance [
ov:csvCol 10;
ov:csvHeader "MSTREE09";
conversion:bundled_by :mailing_address_bundle;
conversion:label "MSTREE09";
conversion:range rdfs:Literal;
];
and
:mailing_address_bundle
a conversion:ImplicitBundle;
conversion:property_name "mailing_address";
conversion:type_name "Address";
.
at
BEST PRACTICE:
:address_bundle
a conversion:ImplicitBundle;
conversion:property_name con:address;
conversion:type_name con:Address;
.
The default URIs for implicit bundles can be quite unweildly (e.g.), especially when the property is a full URI and not a local value.
To clean this up, the URI created for a bundle can be changed by specifying a [template](Using template variables to construct new values) with conversion:name_template.
:nutr_measurement_bundle
a conversion:ImplicitBundle;
conversion:property_name nutr:hasNutritionalContent;
conversion:type_name nutr:NutrientMeasurement;
conversion:name_template "[/sdv][r]";
.
109 explicit bundles in 9 dataset versions:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ov: <http://open.vocab.org/terms/>
PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
SELECT distinct ?dataset
WHERE {
GRAPH <http://purl.org/twc/vocab/conversion/ConversionProcess> {
?dataset a void:Dataset;
conversion:conversion_process [
conversion:enhance ?enhancement
]
.
?enhancement conversion:bundled_by [ ov:csvCol ?explicit_bundle_position ] .
}
}
17 implicit bundles in 7 dataset versions.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ov: <http://open.vocab.org/terms/>
PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
SELECT count(distinct ?bundle)
WHERE {
GRAPH <http://purl.org/twc/vocab/conversion/ConversionProcess> {
?dataset a void:Dataset;
conversion:conversion_process [
conversion:enhance ?enhancement
]
.
?enhancement conversion:bundled_by ?bundle .
?bundle a conversion:ImplicitBundle .
}
}
The properties going to Implicit Bundles, their bundle types, and datasets enhanced (results):
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ov: <http://open.vocab.org/terms/>
PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
SELECT distinct ?in_property ?type ?dataset
WHERE {
GRAPH <http://purl.org/twc/vocab/conversion/ConversionProcess> {
?dataset a void:Dataset;
conversion:conversion_process [
conversion:enhance ?enhancement
]
.
?enhancement conversion:bundled_by ?bundle .
?bundle a conversion:ImplicitBundle .
OPTIONAL { ?bundle conversion:type_name ?type }
OPTIONAL { ?bundle conversion:property_name ?in_property }
}
} order by ?type ?in_property ?dataset
conversion:bundled_by
rdfs:domain conversion:Enhancement;
rdfs:range [ owl:unionOf ( [[conversion:ImplicitBundle]] [[conversion:ExplicitBundle]] ) ] .
conversion:ImplicitBundle is explicitly typed and has conversion:property_name and conversion:type_name. implicit bundle does NOT have a ov:csvCol.
conversion:ImplicitBundle
rdfs:subClassOf [ owl:onProperty ov:csvCol; owl:maxCardinality 0; a owl:Restriction ] ,
[ owl:onProperty conversion:property_name; owl:cardinality 1; a owl:Restriction ] ,
[ owl:onProperty conversion:type_name; owl:maxCardinality 1; a owl:Restriction ] .
conversion:ExplicitBundle must have an ov:csvCol .
conversion:ExplicitBundle
rdfs:subClassOf [ owl:onProperty ov:csvCol; owl:minCardinality 1; a owl:Restriction ] ,
[ owl:onProperty conversion:property_name; owl:maxCardinality 0; a owl:Restriction ] ,
[ owl:onProperty conversion:type_name; owl:maxCardinality 0; a owl:Restriction ] .
see also conversion:property_name, conversion:type_name .
Currently still being described at Enhancement Parameters Reference; will transition to here.