How to state that a class is related to ALL instances of another class via a property - owl

Have two questions
Given classes A, B and object property p (A->B). How to say that for any a from A and any b from B a is mapped via property p to b (a p b)?
In other words A has property p and every instance of A is mapped to all instances of B via propery p.
Now we have 3 classes A, B, C and 2 properties p1 (A->B or domain A, range B) and p2 (B->C or domain B, range C).
How to say in Protege that for any a from A and any c from C there exists a b from B for which a p1 b and b p2 c?

Related

Is it advisable to separate prime attribute partial dependencies when normalising?

Suppose we have a relation R(A, B, C, D).
If R has the following functional dependencies:
A, C -> D
B, C -> D
A -> B
B -> A
We should have the following candidate keys:
{A, C}, {B, C}
Thus, A, B and C are prime attributes.
I chose {A, C} as the primary key.
At this point I have arrived at an impasse.
While, from my experience, when normalising to the 2nd Normal Form it would be advisable to split the relation into:
R1(A, C, D)
R2(A, B)
But technically, following the requisites of the 2nd Normal Form, this isn't necessary as R is already in 2nd Normal Form.
Should I follow my gut and separate the relation or should I leave it as it is?

How to express that instances with equal values of different classes are instances from an other class?

I have four classes: A, B, C and S. Class A has inferred instances i1 and i2 which are based on a numerial value condition (in Equivalent To). Class B has inferred instances i3 and i4 which are based on a numerial value condition (in Equivalent To). A and B are subclasses of S.
Each instance has an xsd:dateTime value.
I would like to model that each instance from A and B which have an equal xsd:dateTime value are also instances (inferred) from class C. How do I model such an expression with Protege?
Thanks in advance.
You will have to use SWRL for that. In the SWRL tab of Protege add the following rule:
A(?a) ^ B(?b) ^ hasDateTime(?a, ?aDateTime) ^ hasDateTime(?b, ?bDateTime) ^
swrlb:equal(?aDateTime, ?bDateTime) -> C(?a) ^ C(?b)
assuming you have a hasDateTime data property.

Why is join equivalent to intersect on tables with 0 attributes?

From Date's Introduction to Database Systems (8th ed., p. 186, edited slightly):
Consider {X1, X2, ..., Xm}, {Y1, Y2, ..., Yn}, {Z1, Z2, ...Zp} as
three composite attributes, X, Y, Z respectively. Then the natural
join of a and b, a JOIN B is a relation with the heading {X, Y, Z{
and body consisting of all the tuples {X x, Y y, Z z} such that a
tuple appears in a with X value x and Y value y and a tuple appears in
b with Y value y and Z value z.
If m = p = 0 (meaning a and b are of the same type), then a JOIN b degenerates to a INTERSECT b.
How does this degeneration work?
Image:
INTERSECT is just JOIN when the argument attribute sets are the same. TIMES is just JOIN when the argument attribute sets are disjoint. Both argument attribute sets empty is just a special case. (That is both INTERSECT & TIMES.)
But the empty sets for m = p = 0 in the quote aren't the attribute sets of the arguments, they are the sets of attributes that are unique to the left argument a and the right argument b. When these sets are empty the only attributes are common ones, ie the argument attribute sets are the same. The empty set for n = 0 is the common attributes, ie a & b are disjoint.
It is clearer to avoid this obscure business of "considering as composite attributes". For a with attribute set A and b with attribute set B, a JOIN b (has attribute set A U B and) holds the set of tuples t where there exist tuples ta & tb where ta IN a and tb IN b and t = ta ∪ tb. When A = B we have INTERSECT and when A ∩ B = {} we have TIMES.

Two-Phase-Locking (2PL) Transactions

I'm currently dealing with the 2-Phase-Lock Protocol considering the following schedule S:
S = R_3 D R_1 A W_2 A W_2 C R_3 B W_3 B R_1 B
Where R = Read, W = Write, {A, B, C} = objects and {1,2,3} = transactions.
Now I shall show that the 2PL can't be used for S. But I actually don't see why, I would set the Locks(L)/Unlocks(U) like:
L_3 D R_3 D U_3 D L_1 A R_1 A U_1 A L_2 C W_2 C U_2 C L_3 B R_3 B W_3 B U_3 B R_1 B
So, I used at maximum 1 L/U per Object of a Transaction. What I am doing wrong here?
I finally found out why I was wrong. It is correct that a transaction can perform at maximum 1 Lock/Unlock per object. But I was forgetting that after a transactions performed its first Unlock (doesn't matter on which object) it is not allowed to perform a Lock again at all, even on another object that has not been locked before.

How to find multiple minimal/canonical covers or rearrange them to find new ones

I have a relation and function dependencies as follows:
R = (A, B, C, D, E)
F = (A -> B C,
B C -> D,
A C -> D E)
Now I am going to compute the minimal/canonical cover using this video.
So firstly I check if I have singleton right-hand sides in my FDs. No I don't, so I have to split them up. I.e. A -> B C is split into A -> B and A -> C. Similarly for A C -> D E.
So now I have...
F = (A -> B,
A -> C,
B C -> D,
A C -> D,
A C -> E)
Secondly, I check if any FDs have more than 1 LHS attributes. If they do, I see if any one of them can be eliminated by checking if their closure contains the other element. If it does, then we don't need that other element.
So for B C -> D, B closure is B and C closure is C. None of the closures contain the other attribute so we cannot eliminate B C -> D.
So now we move to A C -> D. A closure is ABCDE, we can instantly see that A's closure contains C. So C is and extraneous attribute and can be removed so our new set of FDs is...
F = (A -> B,
A -> C,
B C -> D,
A -> D,
A C -> E)
So now we move to the last one: A C -> E, again, A's closure is ABCDE, which contains C so we can eliminate the C from the FD. So our set of FDs is now:
F = (A -> B,
A -> C,
B C -> D,
A -> D,
A -> E)
Lastly, we check if there are any redundant FDs. We do this by going through each FD, covering it up, and seeing if the closure of its LHS contains its RHS.
So for A -> B, we cover it up and compute A closure, which is ACDE which doesnt contain B so we cannot eliminate A -> B. We do this for all FDs and we end up seeing that we can only eliminate A -> D because when we cover A -> D up and compute A closure it contains D, so we don't need A -> D
So now our new set of FDs are:
F = (A -> B,
A -> C,
B C -> D,
A -> E)
Now my question is:
Is my final set of FDs the correct minimal/canonical cover? Can it be written in another way? Also, In the video, it says that multiple canonical covers can exist for a given set of functional dependencies. How can I discover these?
Thank you for your time.
For eg.
X→YZ
Y→XZ
Z→XY
check out this answer with more than one possibility of minimal set
1:
X→Y,
Y→Z,
Z→X
2:
Z→Y,
Y→X,
X→Z
I checked all your steps and your final set is correct.
That said, I'm not sure about the multiple covers thing. The only difference between minimal cover and canonical cover is that a canonical cover is "allowed" to have more than one attribute on the right hand side, whereas minimal cover is not [source]. In this (trivial) sense you could obviously write the same set FDs in a different way.
On the other hand, I don't know if there could be two different sets of minimal covers with the same closure. I would say it is impossible, but that's just my intuition and I don't have elements to back it up.

Resources