W3C home > Mailing lists > Public > semantic-web@w3.org > September 2019

Re: Using boolean value vs class

From: Antoine Zimmermann <antoine.zimmermann@emse.fr>
Date: Wed, 25 Sep 2019 10:59:19 +0200
To: Hugh Glaser <hugh@glasers.org>
Cc: semantic-web@w3.org
Message-ID: <ed25b435-6174-7cc3-7eb5-8dced35b7f87@emse.fr>


Le 24/09/2019 à 15:57, Hugh Glaser a écrit :
> Very interesting question, thanks - it helps me explore my understanding.
> Sorry - as I have said, I'm not really very good on this stuff, but I do like to try to understand.
> 
> Antoine, some of what you say puzzles me.
> Looking at class :Deprecated
>> The second model with a class :Deprecated ensures that an entity is either of type :Deprecated, or not.
> Is it not more properly the case that an Entity is either of type :Deprecated or we don't know? (Open world)

RDF(S), OWL etc are not 3-valued logics, where something may be true, 
false, or something else. Something is either deprecated or it is not. 
It may not be known in which case an entity is, but it definitely fall 
into one of the two cases.


> So the boolean version seems to perhaps give me a richer way of recording knowledge.

In a sense, yes, because you can say for instance:

ex:thing  :isDeprecated  "true"^^xsd:boolean, "false"^^xsd:boolean .

And this is still consistent. But in my experience, every boolean 
properties that I've seen were intended to be used for segregating the 
trues and the falses. But this segregation does not come for free in the 
RDF(S)/OWL semantics.

> 
> To model the boolean equivalent, you could also have a :notDeprecated class.
> And then you would have the same four categories for the class version as you have for the boolean version.
> (Not saying this is good!)

Yes, but again, the "notDeprecated" comes "for free" by simply being the 
set of things that are not in the Deprecated class.

> 
> [Hang on - I have just realised that Mikael makes no suggestion that he will ever assert "false" - so your introducing the "false" categories (3 & 4) is like me introducing the :notDeprecated class.]

If the property is only intended to be used in Mikael's application or 
system, then yes, but the question of what's the best model for a closed 
system is not so relevent. Just use what is most efficient for your tool 
chain. However, if the intent is to have a shared vocabulary that will 
traverse application boundaries, then you must think about how *others* 
may use it. If you define a property :isDeprecated with range 
xsd:boolean, then the value "false" may show up. Of course, you can 
document your vocabulary with instructions saying that it must only be 
used with value "true", or you can add an axiom forcing the value to be 
"true" or not present, but in the former case, you rely on out of band 
information, and in the latter, you rely on more expressive constructs. 
You do not need this at all with a class :Deprecated.


> Although I worry about your argument here, I think that the general principle may well be very good.
> If you see booleans, especially where they always seem to be "true", it is a flag that maybe a class should be used.
> (This is very similar to seeing "= true" in an expression in a programming language, someone isn't thinking right :-) )
> 
> I usually view an rdf:type triple as nothing special compared with any other.
> You assert them and match them just the same.
> It just so happens that "we" have chosen that we can do sub-classing, and so if we do that, we get some special magic that can happen, which doesn't happen with everything else.
> And that is sometimes very useful, although it can make things quite hard to get the hang of.
> 
> Then, as you say, there are a whole bunch of practical questions about efficiency of stores and reasoners when you do things in different ways.
> But, as with programming, most efficiency things should be left to the system implementation, and the source should be modelled in the most understandable and maintainable way.

We definitely agree on those last paragraphs.


Best,
--AZ


> 
> Best
> Hugh
> 
>> On 24 Sep 2019, at 13:48, Antoine Zimmermann <antoine.zimmermann@emse.fr> wrote:
>>
>> Mikael,
>>
>>
>> These two options definitely affects reasoning.
>>
>> If you have a property :isDeprecated, then any entity can fall into 4 disjoint categories:
>>
>> 1. The entities that have no value for :isDeprecated.
>> 2. The entities that have value "true" only.
>> 3. The entities that have value "false" only.
>> 4. The entities that have both values "true" and "false".
>>
>> Moreover, if the range of the property is unrestricted, it can have all sorts of literal values, in any combination.
>>
>> If you want to make sure that all entities have exactly one of "true" or "false" as value for :isDeprecated, you need to introduce a cardinality axiom, which increases the complexity of reasoning (and you need to find a reasoner that supports cardinality restrictions on datatype properties).
>>
>> The second model with a class :Deprecated ensures that an entity is either of type :Deprecated, or not. This comes for free with any reasoner that supports a logic as simple as RDFS, without extra axioms. Many more reasoners support axioms made on classes than axioms made on literals and datatype properties. It's easier to define subclasses of deprecated documents, for instance.
>>
>> In general, when I review an ontology document, I mark all use of boolean properties as a mistake. Usually, boolean properties comes from adopting a programming approach to ontology engineering rather than a knowledge representation approach (that is, it uses the ontology as a data structure for computation rather than as an information model about the world, for knowledge interchange).
>>
>> However, when you have to go back and forth between an existing data model such as tabular data etc. and RDF, it can be convenient to translate booleans to booleans, so there can be exceptions to my rule of thumb of excluding all boolean properties.
>>
>>
>> Best,
>> --AZ
>>
>> Le 24/09/2019 à 13:57, Mikael Pesonen a écrit :
>>> Hi,
>>> lets say we have documents and we want to say wheather they are valid or deprecated. There are two ways to do this:
>>> :doc1 a foaf:Document ;
>>>      :isDeprecated "true"^^xsd:boolean .
>>> or
>>> :doc1 a foaf:Document ;
>>>      a :Deprecated .
>>> Are there some different implications on the use? Does is affect OWL reasoning, for example?
>>> Mikael
>>
>> -- 
>> Antoine Zimmermann
>> Institut Henri Fayol
>> École des Mines de Saint-Étienne
>> 158 cours Fauriel
>> CS 62362
>> 42023 Saint-Étienne Cedex 2
>> France
>> Tél:+33(0)4 77 42 66 03
>> Fax:+33(0)4 77 42 66 66
>> http://www.emse.fr/~zimmermann/
>> Member of team Connected Intelligence, Laboratoire Hubert Curien
>>
> 

-- 
Antoine Zimmermann
Institut Henri Fayol
École des Mines de Saint-Étienne
158 cours Fauriel
CS 62362
42023 Saint-Étienne Cedex 2
France
Tél:+33(0)4 77 42 66 03
Fax:+33(0)4 77 42 66 66
http://www.emse.fr/~zimmermann/
Member of team Connected Intelligence, Laboratoire Hubert Curien
Received on Wednesday, 25 September 2019 08:59:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:51:38 UTC