[Developers] Question about the backend software and data

Alec Flett alecf at metaweb.com
Mon Oct 8 16:17:26 UTC 2007


Shawn Simister wrote:
> To me, that doesn't sound restrictive enough. It doesn't restrict a 
> property like place_of_birth from having a JobTitle value applied to it, 
> nor does it prevent someone from assigning multiple, conflicting 
> Location values to it. Neither of those errors would be possible in the 
> Freebase type system.  I would prefer that we use universal restrictions 
> (owl:allValuesFrom) instead of existential restrictions as well as 
> cardinality restrictions where necessary.
>   
I don't know much about OWL but I wanted to clarify one thing. While 
you're right about uniqueness and MQL, MQL does in fact allow you to 
assign a job title to a property whose expected_type is Location. There 
is no type enforcement in except for primitive (/type/int, etc) vs. 
topic (/common/topic, etc) values.

The expected type is really more of a hint than a rule - MQL is never 
going to barf and say "You can't assign that" - but it uses the 
expected_type to infer properties on the object during a query..

For instance, if my place of birth is the topic "Software Engineer", and 
I say:

{"id": "/user/alecf"
  "type": "/people/person",
  "place_of_birth": {"name": null }}

then this is going to just return:
{"id": "/user/alecf"
  "type": "/people/person",
  "place_of_birth": {"name": null }}

And if I say:
{"id": "/user/alecf"
  "type": "/people/person",
  "place_of_birth": {"contained_by": null }}

This will just return a complete result, with an empty contained_by:

{"id": "/user/alecf"
  "type": "/people/person",
  "place_of_birth": {"contained_by": null }}

This is because the type inferencing will just take the expected_type 
(/location/location) at face value, and see if whatever object there has 
a /location/location/contained_by value. If not, then the result is 
null, whether or not "Software Engineer" is actually typed as a 
/location/location.

This on the other hand:
{"id": "/user/alecf"
  "type": "/people/person",
  "place_of_birth": {
     "type":"/location/location",
     "contained_by": null }}

Will fail, and return (I think?)

{}

or just

null

Because you're actually adding a constraint ("/type": 
"/location/location") to the query, and that constraint cannot be met.

Hope that helps with the OWL modeling....

Alec



More information about the Developers mailing list