Closed agemmell closed 4 years ago
Hmm right now not without forking this... Is there an RDFa file available though? That's what's used to generate the classes here, not sure if there are files like that available for extensions. If there is, I'd be willing to look into making the generator a bit more open for extension if it isn't too much overhead.
There's this: https://github.com/schemaorg/schemaorg/blob/master/data/releases/3.3/ext-health-lifesci.rdf
Related, we would be really interested in looking into a way to include the bib.schema.org extensions:
https://github.com/schemaorg/schemaorg/blob/master/data/releases/3.3/ext-bib.rdf
If extension support is a broader feature you'd consider, I'd be delighted to help with testing if needed.
I'll look into making this extensible for other rdf files, but it won't be before the end of this month.
@sebastiandedeyne I've been looking into this and I'd like to submit a PR to allow generating classes for Schema extensions. However I want to make sure my approach works for you before I do so.
schema:<class>
in the subClassOf
property instead of just <class>
(e.g. schema:CreativeWork
instead of CreativeWork
โ see here).generate
command can take a different source URL as input, running the command multiple times with multiple inputs overwrites the src
folder contents and populates src/Schema.php
with only the most recent set of classes.schema:
from the beginning of the $type->parent
property instead of ignoring types that begin with schema:
.generate
command should be modified to accept multiple, comma-separated sources and should parse them into a single $types
object which can then be used to populate the filesystem and src/Schema.php
factory.So, to generate core types + bibliographic extension, one would run:
php generate.php generate https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/schema.rdfa,https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/ext/bib/bsdo-1.0.rdfa
Let me know what you think.
Edit: The generate
command could also be updated to generate core types plus all extensions by default. See here.
Something like:
- const SOURCE = 'https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/schema.rdfa';
+ const SOURCES = [
+ 'https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/schema.rdfa',
+ 'https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/ext/auto/auto.rdfa',
+ 'https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/ext/bib/bsdo-1.0.rdfa',
+ 'https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/ext/health-lifesci/med-health-core.rdfa',
+ 'https://raw.githubusercontent.com/schemaorg/schemaorg/sdo-callisto/data/ext/health-lifesci/physical-activity-and-exercise.rdfa'
+ ];
I'd rather only have the core types generated in this package. I don't mind maintaining a generate
command that has the option of generating more types though, I'd accept a PR that adds this.
I'm currently rewriting part of the generator to give it a huge speed boost though, so if the changes are significant you might want to wait, or do it before I've made substantial progress ๐
Changes arenโt that significant; Iโll try to submit a PR today.
Sorry, won't get a chance to do this today. I'll wait on your upstream changes and then submit, unless you can accept the PR later this week.
No hurry, not sure when I'll be getting to my changes yet either :)
Pretty far in the refactor. If you hate debugging with the long build times, you might want to wait on this, generating the code has gone down to 8 seconds from 150+ ๐
@greatislander will you find time? Or is this now, like labeled, help wanted
and the community can/should solve this.
I still plan on doing this at some point.
@greatislander I'm interested why support for RDF vs JSON-ld. Google has been very pro-active in promoting JSON-LD-schema.org these past couple or three years. I see very little support for inline or any other vocabulary approach. Is it some further vocabulary extension like b2b or commerce of something else that is required by RDFa?
@nolros they contain the same data just different file-formats. And the generated code is json-ld
.
Finally getting back to looking at this.
relates to #133
@agemmell I think this issue is essentially resolved by the recent changes in #140. The Physician class is now being generated which seemed to be the specific concern mentioned. So give things a look and potentially this issue could be marked as resolved.
If there are any Schema types you think are missing still it's possible they were still Pending in the 8.0 release for schema. In that case then you may need to check back once the repo is updated to use the Schema 9.0 release. Which shouldn't be too hard to create. From what I saw in testing on that, it added a LOT more medical related Schema types.
I'm working right now on v9 release - it will contain everything including all pending and extension types. I think that it will be released late today or tomorrow and as soon as it's released I will close this issue. ๐
Nice! In my testing it was a lot more similar to v8 but had a handful of changes it needed. Mainly it seems that they're adding some internationalization of some sort. For instance I found some strings are now wrapped in an object identifying their locale.
@mallardduck I'm afraid I cannot test this as I am no longer involved in this space. However, I appreciate the hard work OSS contributors like yourself put in to make improvements like this! So thank you.
Not so much an issue, just a question.
I'd love to use this package but without the health-lifesci.schema.org extension I might need to roll my own. Is there a way for me to add schema extensions so I can benefit from using the MedicalOrganization type "Physician"?
Is it possible to somehow run your generator against that health-lifesci schema extension and generate a library of files in my project to augment your core files?