Enumeration values

Hi,

while experimenting with Java annotations for Hydra enabled classes, I
ran into the problem of enumerated values: schema.org uses
http://schema.org/Enumeration with many subtypes such as
http://schema.org/OnSitePickup and it has a general practice to allow
enumeration values from other vocabs as attribute values, notably
goodrelations, as in the businessFunction attribute below:

{
 "@context": {
       "@vocab" : "http://schema.org/"
  },
  "@type": "Movie",
  "name": "Pirates of the Carribean"
  "offer": {
    "businessFunction": "http://purl.org/goodrelations/v1#LeaseOut"
   }
}

An enumeration value is a URL. In the json-ld spec, it is not
mentioned that I can use a term to define the semantics of an
attribute *value*.

When applying enumeration values to a plain json file, the problem
arises that some mapping might be necessary. Assuming this json:

{
  name: "Pirates of the Caribbean",
  acquire: "RENT",
  delivery: "IN_SHOP"
}

Can I write a context which says that "RENT" means
http://purl.org/goodrelations/v1#LeaseOut and "IN_SHOP" means
"http://schema.org/OnSitePickup"? The json-ld spec seems not to
mention such a usage.

It seems that terms cannot appear as attribute values unless the
attribute is @type. Also, jsonld-java doesn't understand what I might
mean by:

"@context":
    {
      "schema" : "http://schema.org/",
      "gr" : "http://purl.org/goodrelations/v1#",

      "RENT" : "gr:LeaseOut",
      "IN_SHOP": "schema:OnSitePickup"
    },
    "schema:name" : "Pirates of the Caribbean",
    "acquire" : "RENT",
    "delivery" : "IN_SHOP"
}

That leads me to believe that it cannot be done, is that correct?

The solution for my Java Hydra set of annotations is to allow
something like this:

@Expose("BusinessFunction")
@Term(define = "gr", as = "http://purl.org/goodrelations/v1#")
enum Acquire {
  @Expose("gr:LeaseOut")
  RENT
}

If the client accepts json-ld, it will get the full url value, for
other json varieties it will render "RENT". But hey, what a noise,
even if I make the @Term a package annotation.

Best regards,
Dietrich

-- 
Dietrich Schulten
Escalon System-Entwicklung
Bubenhalde 10
74199 Untergruppenbach
+49 172 7369456

Received on Saturday, 6 September 2014 11:04:45 UTC