W3C home > Mailing lists > Public > public-schemaorg@w3.org > March 2020

Re: Designing my vocabulary

From: James Hudson <jameshudson3010@gmail.com>
Date: Wed, 11 Mar 2020 10:37:16 -0400
Message-ID: <CAEUVO9F5nO6mjHO3BVArsh4AYkvcKXuc7CAxem00nXDrLztZ+g@mail.gmail.com>
To: public-schemaorg@w3.org
Hello Adam,

Thank you for your quick reply. It does help.

You provided:

{
  "@context": {
    "@vocab": "http://my-company.org/"
  },
  "@id": "AirlineIntl",
  "@type":"MyCompanyClass",
  "name":"James's Airlines Intl.",
  "chanceOfSuccess": {
    "@type":"QuantitativeValue",
    "value": "50"
  }
}

Where or how do I define that the chanceOfSuccess must be a value between 0
and 100?

The way I would define chanceOfSuccess when used on the AirlineIntl
instance, it would not make sense it to be a negative value or greater than
100. I am thinking there is a need for this acceptable range of values to
be part of the vocabulary. To resolve this, I am thinking there is a need
for a subclass of MyCompanyClass which defines and limits the value to a
min and max value.

Perhaps you already covered this in your reply, but it is the key part that
still confuses me.

Regards,
James


On Wed, Mar 11, 2020 at 9:58 AM Adam Kimball <adam@akimball.org> wrote:

> James,
>
> I think your intuition is correct, you are mixing up your universals and
> your instances.  In A you have a class definition which would allow you to
> make instances.  Even here the comment suggests a little blurry thinking
> because a class cannot change the world, maybe the instances of the class
> can change the world?  Important difference but otherwise this class
> definition looks fine.
>
> At a glance, your property looks good.  Maybe a little stringently defined
> though - is chanceOfSuccess only applicable to your MyCompanyClass or to
> anything that might have a chance of a success like the odds that tonight I
> will win the lottery?  Or that my cat will live another year?  So, you can
> see, I think the domain is overly specified - why not loosen it up?  Give
> it a non-camelCase name if you are going to use rdfs:label, no need to be
> so terse!
>
> Okay, in C you are getting bogged down.  It isn’t the the CLASS
> MyCompanyClass has a success rate as it is only a class, a possible set of
> values.  You already have the class and the property, now you just need to
> use them.  We build instances by making nodes that connect to our classes
> by isA relationships and then we hook them up with properties.
>
> I’m also going to fix your context to provide a default namespace.
> Contexts are not hard but can be fiddly, to I recommend making sure you
> know how they work.  Ok with that in mind here is an instance
>
> {
>
>   "@context": {
>     "@vocab": "http://my-company.org/"
>   } ,
> "@id": "AirlineIntl",
> "@type":"MyCompanyClass",
> "name":"James's Airlines Intl.",
> "chanceOfSuccess": {
>     "@type":"QuantitativeValue",
>     "value": "50"
>   }
> }
>
>
> Put that into the JSON LD playground and see the visualized graph.  As a
> note, we haven’t really defined what “name” is (you use rdfs:label in
> another example, but you’ll need to map that into your @context to resolve
> it.)
>
> Note: this is fast and loose.  It parses to RDF but I think you’ll need to
> tweak things.
>
> Hope that helps,
> Adam
>
>
>
> On Mar 11, 2020, at 7:26 AM, James Hudson <jameshudson3010@gmail.com>
> wrote:
>
> Hello,
>
> I am working on designing a vocabulary and generally liked the approach
> taken by schema.org.
>
> The syntax I will be adopting is json-ld.
>
> There is a concept I would like to have in my vocabulary and I am not
> precisely sure what the proper design would be. It involves having a
> property with a well defined min & max value -- like a percentage which
> would take on values of 0 to 100. The idea is that I would like to define a
> property which specifies what the acceptable min and max values are for the
> value of the property.
>
> I see that schema.org defines QuantitativeValue which has minValue and
> maxValue properties. I believe one would start with a subclass of
> QuantitativeValue, but I am not certain where to go from there.
>
> To try to answer this question myself, let's define a class which will
> have a property which has a min and max value.
>
> (A)
>     {
>       "@id": "http://my-company.org/MyCompanyClass",
>       "@type": "rdfs:Class",
>       "rdfs:comment": "A class that will change the world",
>       "rdfs:label": "MyCompanyClass",
>     },
>
> The property of the class would be defined as:
>
> (B)
>     {
>       "@id": "http://my-company.org/chanceOfSuccess",
>       "@type": "rdf:Property",
>       "http://schema.org/domainIncludes": {
>         "@id": "http://my-company.org/MyCompanyClass"
>       },
>       "http://schema.org/rangeIncludes": {
>           "@id": "http://schema.org/QuantitativeValue"
>       },
>       "rdfs:comment": "The chance of success as expressed as a percentage
> between 0 and 100.",
>       "rdfs:label": "chanceOfSuccess"
>     }
>
> It is at this point that I get a bit confused about how to proceed.
>
> Taking a look at https://schema.org/LoanOrCredit, I might try to do the
> following:
>
> (C)
> {
> "@context":"http://my-company.org",
> "@type":"MyCompanyClass",
> "name":"An attempt I will make",
> "chanceOfSuccess": {
>     "@type":"QuantitativeValue",
>     "name": "the chances",
>     "minValue":"0",
>     "maxValue":"100"
>   }
> }
>
> And again, I am stuck and unsure of how to proceed. It seems as if the
> minValue & maxValue fields belong in the property defintion.
>
> Why do I think I am stuck?
>
> Because, at this point, I would like to use (C) as a Class or Type and
> then write something like:
>
> (D)
> {
> "@context":"http://my-company.org",
> "@type":"(C)",
> "name":"about my attempt",
> "chanceOfSuccess": {
>     "@type":"QuantitativeValue",
>     "value": "50"
>   }
> }
>
>
> Something doesn't feel right about all of this. I am clearly missing some
> key concept, but I am not sure what that is at the moment.
>
> Any thoughts, comments, or ideas would be appreciated.
>
> Regards,
> James
>
>
>
> On Mar 11, 2020, at 7:26 AM, James Hudson <jameshudson3010@gmail.com>
> wrote:
>
> Hello,
>
> I am working on designing a vocabulary and generally liked the approach
> taken by schema.org.
>
> The syntax I will be adopting is json-ld.
>
> There is a concept I would like to have in my vocabulary and I am not
> precisely sure what the proper design would be. It involves having a
> property with a well defined min & max value -- like a percentage which
> would take on values of 0 to 100. The idea is that I would like to define a
> property which specifies what the acceptable min and max values are for the
> value of the property.
>
> I see that schema.org defines QuantitativeValue
> <https://schema.org/QuantitativeValue> which has minValue and maxValue
> properties. I believe one would start with a subclass of QuantitativeValue,
> but I am not certain where to go from there.
>
> To try to answer this question myself, let's define a class which will
> have a property which has a min and max value.
>
> *(A)*
>     {
>       "@id": "http://my-company.org/MyCompanyClass",
>       "@type": "rdfs:Class",
>       "rdfs:comment": "A class that will change the world",
>       "rdfs:label": "MyCompanyClass",
>     },
>
> The property of the class would be defined as:
>
> *(B)*
>     {
>       "@id": "http://my-company.org/chanceOfSuccess",
>       "@type": "rdf:Property",
>       "http://schema.org/domainIncludes": {
>         "@id": "http://my-company.org/MyCompanyClass"
>       },
>       "http://schema.org/rangeIncludes": {
>           "@id": "http://schema.org/QuantitativeValue"
>       },
>       "rdfs:comment": "The chance of success as expressed as a percentage
> between 0 and 100.",
>       "rdfs:label": "chanceOfSuccess"
>     }
>
> It is at this point that I get a bit confused about how to proceed.
>
> Taking a look at https://schema.org/LoanOrCredit, I might try to do the
> following:
>
> *(C)*
> {
> "@context":"http://my-company.org",
> "@type":"MyCompanyClass",
> "name":"An attempt I will make",
> "chanceOfSuccess": {
>     "@type":"QuantitativeValue",
>     "name": "the chances",
>     "minValue":"0",
>     "maxValue":"100"
>   }
> }
>
> And again, I am stuck and unsure of how to proceed. It seems as if the
> minValue & maxValue fields belong in the property defintion.
>
> Why do I think I am stuck?
>
> Because, at this point, I would like to use (C) as a Class or Type and
> then write something like:
>
> *(D)*
> {
> "@context":"http://my-company.org",
> "@type":"(C)",
> "name":"about my attempt",
> "chanceOfSuccess": {
>     "@type":"QuantitativeValue",
>     "value": "50"
>   }
> }
>
>
> Something doesn't feel right about all of this. I am clearly missing some
> key concept, but I am not sure what that is at the moment.
>
> Any thoughts, comments, or ideas would be appreciated.
>
> Regards,
> James
>
>
>
Received on Wednesday, 11 March 2020 14:37:41 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 11 March 2020 14:37:42 UTC