Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport schema.org in RDF.js #1634
Conversation
dgerber
and others
added some commits
Feb 25, 2017
adam3smith
requested changes
May 8, 2018
I haven't dones any testing, just a read through and have some nits, nothing major except for the IDs which I think we can't throw out.
I'd want to test this properly, but generally quite happy with this. Anything you think requires discussion?
RDF.js
return result[0]; | ||
function getFirstResults(nodes, properties, onlyOneString) { | ||
if (!nodes.length) nodes = [nodes]; | ||
for (let j=0; j<nodes.length; j++) { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
RDF.js
} else { | ||
let c = { creatorType: creatorType }; | ||
c.lastName = getFirstResults(obj, | ||
[ n.foaf+"familyName", n.foaf+"lastName", |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
case 'videogameclip': | ||
t.soGuess = 'videoRecording'; break; | ||
case 'tvclip': | ||
case 'tvepisode': |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zuphilip
May 8, 2018
Collaborator
This case uses t.so
and the next one t.soGuess
. Thus, they have different order in the final calculation:
var itemType = t.zotero || t.bib || t.prism || t.eprints || t.og || t.dc ||
t.so ||
exports.defaultUnknownType || t.zoteroGuess || t.bibGuess ||
t.prismGuess || t.ogGuess || t.dcGuess || t.soGuess;
I put "tvseries" (a whole series is maybe something else) and "episode" (this sounds generic) as a guess in the second case. Do you suggest to use t.so
for all of them?
zuphilip
May 8, 2018
Collaborator
This case uses t.so
and the next one t.soGuess
. Thus, they have different order in the final calculation:
var itemType = t.zotero || t.bib || t.prism || t.eprints || t.og || t.dc ||
t.so ||
exports.defaultUnknownType || t.zoteroGuess || t.bibGuess ||
t.prismGuess || t.ogGuess || t.dcGuess || t.soGuess;
I put "tvseries" (a whole series is maybe something else) and "episode" (this sounds generic) as a guess in the second case. Do you suggest to use t.so
for all of them?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
case 'episode': | ||
t.soGuess = 'tvBroadcast'; break; | ||
case 'radioclip': | ||
case 'radioepisode': |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
RDF.js
@@ -754,19 +862,22 @@ function importItem(newItem, node) { | ||
if(creatorType == "author") { | ||
creators = getFirstResults(node, [n.bib+"authors", n.dc+"creator", n.dc1_0+"creator", | ||
n.dcterms+"creator", n.eprints+"creators_name", | ||
n.dc+"contributor", n.dc1_0+"contributor", n.dcterms+"contributor"]); | ||
n.dc+"contributor", n.dc1_0+"contributor", n.dcterms+"contributor", | ||
n.so+"author", n.so+"creator"]); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adam3smith
May 8, 2018
Collaborator
we should think about where we but so in the hierarchy of preference. I'd have said we prefer it to dc, say?
adam3smith
May 8, 2018
Collaborator
we should think about where we but so in the hierarchy of preference. I'd have said we prefer it to dc, say?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adam3smith
May 8, 2018
Collaborator
I'm not sure, but my inclination would be to say the so
comes right after bib
and z
in expected quality, but that could be totally off base, what do you think?
adam3smith
May 8, 2018
Collaborator
I'm not sure, but my inclination would be to say the so
comes right after bib
and z
in expected quality, but that could be totally off base, what do you think?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
RDF.js
@@ -1236,9 +1357,10 @@ function importNext(nodes, index, collections, resolve, reject) { | ||
} | ||
var newItem = new Zotero.Item(); | ||
newItem.itemID = Zotero.RDF.getResourceURI(node); | ||
//newItem.itemID = Zotero.RDF.getResourceURI(node); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zuphilip
May 8, 2018
Collaborator
You are possibly right! - The itemID
lead to some problems but now I can't remember. I have to look into this again...
zuphilip
May 8, 2018
Collaborator
You are possibly right! - The itemID
lead to some problems but now I can't remember. I have to look into this again...
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zuphilip
May 8, 2018
Collaborator
Ah, now I see again. The generated ID will be different for different runs of the test cases, i.e. the test cases will constantly fail, also only the itemID is different. However, the itemID is probably important for the collections. Thus, I will revert these two changes.
zuphilip
May 8, 2018
Collaborator
Ah, now I see again. The generated ID will be different for different runs of the test cases, i.e. the test cases will constantly fail, also only the itemID is different. However, the itemID is probably important for the collections. Thus, I will revert these two changes.
RDF.js
if (importItem(newItem, node)) { | ||
delete newItem.itemID; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
RDF.js
case 'visualartwork': | ||
case 'sculpture': | ||
t.so = 'artwork'; break; | ||
//case 'datacatalog': |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adam3smith
May 8, 2018
Collaborator
we may want to include this in the dataset handling (line 1097)?
adam3smith
May 8, 2018
Collaborator
we may want to include this in the dataset handling (line 1097)?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zuphilip
May 9, 2018
Collaborator
I updated the code according to your review. Please have a look at the new version.
Testing is currently limited, because schema.org will normally not be encoded within RDF. On the positive side, this means also that I expect that everything worked the same as before with RDF and EM translators. The PR here enables us to concentrate on the next steps: transformations of different formats and integration into EM. Thereby or afterwards, I expect we will see much more examples and can improve the handling of schema.org further.
There shouldn't be anything critical here or anything I see we have to discuss further. The itemID
was certainly a good point, but it is now included again.
I updated the code according to your review. Please have a look at the new version. Testing is currently limited, because schema.org will normally not be encoded within RDF. On the positive side, this means also that I expect that everything worked the same as before with RDF and EM translators. The PR here enables us to concentrate on the next steps: transformations of different formats and integration into EM. Thereby or afterwards, I expect we will see much more examples and can improve the handling of schema.org further. There shouldn't be anything critical here or anything I see we have to discuss further. The |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Yes, this is great; thanks for working on it. |
zuphilip commentedApr 23, 2018
•
edited
Edited 1 time
-
zuphilip
edited Apr 23, 2018 (most recent)
I cherry-picked some commits by @dgerber and continued there the support of schema.org in RDF. Everything works quite well and I checked the dependent translators which seem to be unaffected by the changes here.
This is also the first step for the JSON-LD support #917 (still much to do afterwards). Also the Codemeta format #1587 is supported in RDF.