What is data range expression protege? - ontology

May question is a bit basic. But I do not know what happens when we define "data range expressions" in protege? Does it limit the range only to the literals written there?
In what cases can we use "data range expressions?"
Below is an example that I saw in an ontology:

The semantics of data property domains and ranges are given by
which you can find defined in the direct semantics of OWL 2.
This means that for every 2 individuals x and y that are related by a data property DPE, that x is of type CE and y is of type DR.
In your example it means that if x and y are related via test type then the reasoner will infer x is of type Concrete placement OR Test and y is of type {"Self-inspection", "Third-Party Monitoring"}.
Update based on comment
This means that if individual y does not have the value of either "Self-inspection" OR "Third-Party Monitoring", it will result in the ontology being inconsistent.
So, yes, the user has to choose between these 2 values.

Related

Why is HermiT or Pellet Reasoner for Protegev5.5 is not detecting inconsistency in Ontology

I have used an object property O to relate Class A with Class B. I also have instance a and b of classes A and B respectively. I have used the same object property O to relate the instances a and b.
Again, I have used the same object property O to link a with c, where c is an instance of Class C which is not linked with class A or B using any object property.
Reasoners are still showing that the Ontology is Consistent.
My question is "Should this not be marked as inconsistent by the reasoners? Please enlighten me regarding your answer, whether the answer is 'Yes' or 'No' and the reason behind your answer"?
Thanks in advance.
You understand the semantics of domain and range axioms incorrectly. In the case of your object property O it merely states that whenever 2 individuals x, y are linked via O it means that the reasoner will infer that x is of type A and y is of type B.
In the case linking individuals a and c where c is of type C you will notice that c is also now inferred to be of type B.
If you want to see an inconsistency, what you can do is make classes B and C disjoint. Then linking a and c via O will result in an inconsistency.
BTW, if you are interested, on my blog I write about OWL2 ontologies and the use of reasoners and some of the counter intuitive ways in which reasoners can seem to "fail".

Countable subsets in Agda

I need to express the countable property over a specific subset defined by a certain predicate P. My first idea was to explicitly state that there exists a function f which is bijective between my subset and, let's say, the natural numbers. Is there another more general way to express that property in the standard library ?
Thank you in advance
If you are using a set that is isomorphic to the natural numbers why don't you just use the natural numbers?
There is no way to distinguish isomorphic sets and in HoTT (or cubical agda) isomorphic sets are equal. Hence asking for a set that is isomorphic to Nat is the same as asking for a number that is equal to 3.

Restriction on object property ontology in Protege

I have created an ontology in Protege 5.2 and now I am trying to create correctly the object properties of my corresponding classes. Here is a snippet of my UML diagram according to which I have built my ontology:
Snippet of my ontology
Regarding the isLocated object property, they are characterized in the following way: If a Node X has a SITE value Z, and the same value Z appears in SITEIST of a Location Y, then Node X is Located in Location Y.
Should I look into SWRL rules or is there some way to encode this without having to go there?
Thank you guys in advance!
In SWRL you can achieve that straightforward:
locationHasSiteIst(?l, ?s) ^ nodeHasSite(?n, ?s) -> nodeLocatedInLocation(?n, ?l)
If you want yo make it in OWL, you need to make locationHasSiteIst and nodeHasSite as object properties, and Site as a class instead of a datatype, then you can use object property chaining and inclusion in Protege as follows:
nodeHasSite o inverse(locationHasSiteIst) SubPropertyOf nodeLocatedInLocation
The last line means that if a node n1 is located in site1, and a location l1 is located in s1 as well, then n1 is located in l1.

Meaning of Discriminated Union in F#

I do understand the meaning of "discriminated" and "union" in their standalone contexts, but i am at loss when it comes to the F#'s "Discriminated Union".
Fyi, English is not my first language and I am not good at Math either. So i hope someone out there can shed some light on this feature of F#. Please.
What i need to know is:
the use case for this discriminated union. What it is normally used for?
it's equivalent to other OOP feature/terms. if there's any.
is it like set operation where we use venn diagrams to represent the data?
Or you can help me pointing to links.
A discriminated union is a union of two sets where you can tell which set an item originally belonged to; even if they are the same thing, you can discriminate between them, i.e. tell them apart.
For instance, if you have a discriminated union of two sets of integers, both containing the number 2, you can discriminate between the 2s because you know which original set it came from.
As an example, consider points in the 2-dimensional plane.
These can be expressed as a pair of reals in two ways, either using rectangular (or Cartesian) coordinates (x coordinate, y coordinate) or using polar coordinates (angle of rotation, distance).
But if someone just gives you a pair of numbers, you wouldn't know what they meant.
We can form a discriminated union, though:
type Point2D =
| Rectangular of real * real
| Polar of real * real
Now any Point2D value makes the intended interpretation clear, and the compiler can make sure that we don't try to mix the representations or fail to handle a case.
In an OO setting, you would build a class hierarchy with an abstract base class, or have a "kind" member that you could inspect.
It's more common to form unions of different types, though - if you wrote an interpreter for a programming language you might have something that looks like
type Expression =
| Integer of int
| String of string
| Identifier of string
| Operator of string
| Conditional of Expression * Expression * Expression
| Definition of string * Expression
and so on.
Discriminated unions are also called "sum types", and tuples are called "product types".
These terms come from the discipline of type algebra, and the resultant types are called "Algebraic Data Types".
(When functional programmers mention "ADT", the "A" is usually for "Algebraic", not "Abstract".)
The question is very broad but I will try to give a succint answer.
You can think of DUs as Enums on steroids - you can define a new datatype with distinct cases - just like enums - but on top of this each case may (or may not) contain additional data.
A simple example could be:
type Contact =
| Email of String
| Phone of String
| None
And where DUs are Enum on steroids so is patternmatching instead of switch where you can deconstruct the data
let contactToString = function
| Email e -> e
| Phone p -> p
| None -> "no conctact given"
Basically you use DUs in F# and other FP-languagues all the time to structure data in the obvious ways - you gain much from this - for example the compiler will warn you if you miss a case, ...)
The equivalent in OOP (indeed it's compiled into something very similar) is a Base-class Contact with subclasses for each case (EmailContact : Contact, etc. ) that contains the data-part.
But there is a important difference: you can extent such OOP inheritance structures but you cannot externaly extendt DUs. (see Expression-Problem).
And finally: no it has nothing to do with venn-diagramms or set-theory or anything.
The relation to math is, that this structures are called algebraic-datatypes or sum-types because if you count the different values these types can have you have to sum-up the values for each case. (See Tuples too - these are product-types for similar reasons)

F#'s underscore: why not just create a variable name?

Reading about F# today and I'm not clear on one thing:
From: http://msdn.microsoft.com/en-us/library/dd233200.aspx
you need only one element of the tuple, the wildcard character (the underscore) can be used to avoid creating a new name for a variable that you do not need
let (a, _) = (1, 2)
I can't think of a time that I've been in this situation. Why would you avoid creating a variable name?
Because you don't need the value. I use this often. It documents the fact that a value is unused and saves naming variables unused, dummy, etc. Great feature if you ask me.
Interesting question. There are many trade-offs involved here.
Your comparisons have been with the Ruby programming language so perhaps the first trade-off you should consider is static typing. If you use the pattern x, _, _ then F# knows you are referring to the first element of a triple of exactly three elements and will enforce this constraint at compile time. Ruby cannot. F# also checks patterns for exhaustiveness and redundancy. Again, Ruby cannot.
Your comparisons have also used only flat patterns. Consider the patterns _, (x, _) or x, None | _, Some x or [] | [_] and so on. These are not so easily translated.
Finally, I'd mention that Standard ML is a programming language related to F# and it does provide operators called #1 etc. to extract the first element of a tuple with an arbitrary number of elements (see here) so this idea was implemented and discarded decades ago. I believe this is because SML's #n notation culminates in incomprehensible error messages within the constraints of the type system. For example, a function that uses #n is not making it clear what the arity of the tuple is but functions cannot be generic over tuple arity so this must result in an error message saying that you must give more type information but many users found that confusing. With the CAML/OCaml/F# approach there is no such confusion.
The let-binding you've given is an example of a language facility called pattern matching, which can be used to destructure many types, not just tuples. In pattern matches, underscores are the idiomatic way to express that you won't refer to a value.
Directly accessing the elements of a tuple can be more concise, but it's less general. Pattern matching allows you to look at the structure of some data and dispatch to an approprate handling case.
match x with
| (x, _, 20) -> x
| (_, y, _) -> y
This pattern match will return the first item in x only if the third element is 20. Otherwise it returns the second element. Once you get beyond trivial cases, the underscores are an important readability aid. Compare the above with:
match x with
| (x, y, 20) -> x
| (x, y, z) -> y
In the first code sample, it's much easier to tell which bindings you care about in the pattern.
Sometimes a method will return multiple values but the code you're writing is only interested in a select few (or one) of them. You can use multiple underscores to essentially ignore the values you don't need, rather than having a bunch of variables hanging around in local scope.

Resources