Closed csarven closed 6 months ago
Property Copying is implemented as part of Vocabulary Expansion, see note in the README.
See the test for this https://github.com/ruby-rdf/rdf-rdfa/blob/fb11c7e2d4674b4a7e2dcdb4ad3c9596b69f3113/spec/expansion_spec.rb#L249-L277
Ah pardon me. That's interesting. Great.
I think I was misled by the Ruby Distiller service. I'm noticing something slightly different output depending on output format. Perhaps you can have a look at what I may have missed. Take the RDFa from Example 7 at https://www.w3.org/TR/rdfa-in-html/#property-copying and compare the following:
Option 1 gives result:
_:g463380 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/MusicEvent> .
_:g463380 <http://schema.org/name> "Muse" .
_:g463380 <http://schema.org/startDate> "2013-03-03"^^<http://www.w3.org/2001/XMLSchema#date> .
_:g463400 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/MusicEvent> .
_:g463400 <http://schema.org/name> "Muse" .
_:g463400 <http://schema.org/startDate> "2013-03-07"^^<http://www.w3.org/2001/XMLSchema#date> .
Option 2 gives result:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<> rdfa:usesVocabulary schema: .
[
a schema:MusicEvent;
schema:image <Muse1.jpg>,
<Muse2.jpg>,
<Muse3.jpg>;
schema:location <#united>;
schema:name "Muse";
schema:startDate "2013-03-03"^^xsd:date
] .
[
a schema:MusicEvent;
schema:image <Muse1.jpg>,
<Muse2.jpg>,
<Muse3.jpg>;
schema:location <#target>;
schema:name "Muse";
schema:startDate "2013-03-07"^^xsd:date
] .
Note in particular the image statements included in Option 2 but not Option 1.
The CLI has a --vocab-expansion
option when the input format is set to rdfa
. The CLI is used to implement the distiller, and an option such as "vocab expansion" (as well as "host language" and "rdfagraph") should show up in the distiller UI, but don't seem to be there, which I'll need to look into.
Running Example 6 using the command rdf serialize --input-format rdfa --vocab-expansion --output-format ttl example-files/property-copying.html
gives the following output:
@prefix dcmitype: <http://purl.org/dc/dcmitype/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<example-files/property-copying.html> rdfa:usesVocabulary schema: .
[
a schema:MusicEvent,
schema:Event,
schema:Thing,
dcmitype:Event;
rdfs:label "Muse";
dcterms:title "Muse";
schema:image <example-files/Muse1.jpg>,
<example-files/Muse2.jpg>,
<example-files/Muse3.jpg>;
schema:location <example-files/property-copying.html#united>;
schema:name "Muse";
schema:startDate "2013-03-03"^^xsd:date
] .
[
a schema:MusicEvent,
schema:Event,
schema:Thing,
dcmitype:Event;
rdfs:label "Muse";
dcterms:title "Muse";
schema:image <example-files/Muse1.jpg>,
<example-files/Muse2.jpg>,
<example-files/Muse3.jpg>;
schema:location <example-files/property-copying.html#target>;
schema:name "Muse";
schema:startDate "2013-03-07"^^xsd:date
] .
@csarven let me know if the distillers working for you now.
When output format is unselected, those image properties are missing. Ditto when N-Triples or JSON-LD for example are selected for output, the properties are missing. For the Turtle output, the properties are present.
Aside: just noticing the host language option now. Is that very recent? Cool!
When the output format is unselected, it will typically use N-Triples. N-Triples cannot emit relative IRIs; to get the output, you need to add a base IRI to the Document URL field.
The "host language" option, as well as the "rdfagraph" options have always been available through the CLI, but didn't show because the option didn't provide a control to use for display.
https://www.w3.org/TR/rdfa-in-html/#property-copying
See also: https://www.w3.org/ns/rdfa