I'm trying to use the HermiT reasoner to compute inferences for an ontology which contains a set of OWL axioms and a SWRL rule:
Ontology(
ClassAssertion( :Student :Bob )
ClassAssertion( :Professor :DrBoffin )
ClassAssertion( :University :UF )
ObjectPropertyAssertion( :supervises :DrBoffin :Bob )
ObjectPropertyAssertion( :worksAt :DrBoffin :UF )
EquivalentClasses( :Student ObjectHasSelf( :r1 ))
EquivalentClasses(
ObjectHasSelf( :r2 )
ObjectSomeValuesFrom( :worksAt :University ))
SubObjectPropertyOf(
ObjectPropertyChain( :r2 :supervises :r1 ) :professorOf )
DLSafeRule(Body(ObjectPropertyAtom( :professorOf Variable( ?x ) Variable( ?y )))
Head(ObjectPropertyAtom( :instructorOf Variable( ?x ) Variable( ?y ))))
)
Basically, the OWL part is trying to express such a rule:
worksAt(x, y), University(y), supervises(x, z), Student(z) -> professorOf(x, z)
using property chain and rolification techniques:
The SWRL part is:
professorOf(x, y) -> instructorOf(x, y)
The expected output should contain both ObjectPropertyAssertion( :professorOf :DrBoffin :Bob ) and ObjectPropertyAssertion( :instructorOf :DrBoffin :Bob ). However, the actual output is (showing only object properties)
ObjectPropertyAssertion( :r1 :Bob :Bob )
ObjectPropertyAssertion( :professorOf :DrBoffin :Bob )
ObjectPropertyAssertion( :r2 :DrBoffin :DrBoffin )
ObjectPropertyAssertion( :supervises :DrBoffin :Bob )
ObjectPropertyAssertion( :worksAt :DrBoffin :UF)
Why isn't the expected SWRL result showing up? Any suggestions?
After re-reading your question, I realized that the rule you are trying to represent is
worksAt(x, y), University(y), supervises(x, z), Student(z) → professorOf(x, z)
but that you are trying to represent it, essentially by
(worksAt some University)(x), supervises(x, z), Student(z) → professorOf(x, z)
which is actually a valid SWRL rule, even though it has a complex class expression. (See Can OWL Class Expressions be used in SWRL Rules? for more information. Even though they're valid, the Protégé editor didn't accept that input, though it would display rules correctly if they are already in the ontology.)
Although it can be expressed in SWRL, that will only cover cases where the individuals are named, so the rolification based solution will cover more cases. So, the idea is to create a role rWorksAtSomeUniversity (the rolification of worksAt some University) and a role rStudent (the rolification of Student, and then to assert that
rWorksAtSomeUniversity o supervises o rStudent SubPropertyOf professorOf
Then, to relate professorOf and instructorOf, you can either use a SWRL rule
professorOf(x,y) → instructorOf(x,y)
or a subproperty axiom
professorOf SubPropertyOf instructorOf
As with rolification-based rule, the non-SWRL rule will cover more cases, and does not require that the reasoner have SWRL support.
Here's an ontology that contains these classes and axioms, in the OWL functional syntax. It's not wonderfully human readable, but it's complete; you should be able to download it and test it out with your reasoner.
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(ex:=<http://www.example.com/university#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Ontology(<http://www.example.com/university>
Declaration(Class(ex:Professor))
Declaration(Class(ex:Student))
EquivalentClasses(ex:Student ObjectHasSelf(ex:rStudent))
Declaration(Class(ex:University))
Declaration(ObjectProperty(ex:instructorOf))
Declaration(ObjectProperty(ex:professorOf))
SubObjectPropertyOf(ex:professorOf ex:instructorOf)
Declaration(ObjectProperty(ex:rStudent))
Declaration(ObjectProperty(ex:rWorksAtSomeUniversity))
Declaration(ObjectProperty(ex:supervises))
Declaration(ObjectProperty(ex:worksAt))
Declaration(NamedIndividual(ex:Bob))
ClassAssertion(ex:Student ex:Bob)
Declaration(NamedIndividual(ex:DrBoffin))
ClassAssertion(ex:Professor ex:DrBoffin)
ObjectPropertyAssertion(ex:supervises ex:DrBoffin ex:Bob)
ObjectPropertyAssertion(ex:worksAt ex:DrBoffin ex:UF)
Declaration(NamedIndividual(ex:UF))
ClassAssertion(ex:University ex:UF)
EquivalentClasses(ObjectHasSelf(ex:rWorksAtSomeUniversity) ObjectSomeValuesFrom(ex:worksAt ex:University))
SubObjectPropertyOf(ObjectPropertyChain(ex:rWorksAtSomeUniversity ex:supervises ex:rStudent) ex:professorOf)
)
Both Pellet and HermiT 1.3.7 can produce the inferences:
DrBoffin professorOf Bob
DrBoffin instructorOf Bob
Related
I want to exclude the genesis mint function from the conserves-mass property
(module account GOVERNANCE
#doc "Account doc"
#model
[ (defproperty conserves-mass
(= (column-delta ledger 'balance ) 0.0))]
...
(defun transfer-create:string
( sender:string
receiver:string
receiver-guard:guard
amount:decimal )
#doc "create account when transfer doc"
#model [ (property conserves-mass)] <- I want to exclude mint function here
...
I found this example
https://github.com/kadena-io/pact/blob/4971ab6078b75eb612d83d56f1e7cd139a5a2ba8/examples/verified-accounts/accounts.pact#L27
where they do an except logic but it makes no sense to me how this 'except work and I can't make it work. I don't know what I'm missing.
I found nothing about this on the documentation
https://pact-language.readthedocs.io/en/stable/pact-properties.html
#model
[
...
; every function should conserve mass except for the admin fund-account,
; and debit / credit which should be private
(property conserves-mass
{'except: [fund-account, debit, credit]})
...
]
I'm working on a project that tries to map DBpedia concepts to table data columns. Specifically I wanted to map literal(numerical values; float, int..). Therefore I need adequate number of data to build a background knowledge base. I extract some data from T2D-golden-dataset as the given format at the end of this description. Actually I should use them as a bench mark for testing and it only contains less than 20 columns from overall tables. Could anyone help me to find such a literal valued and dbpedia annotated dataset ?
Literal valued dbpedia ranges;
"http://www.w3.org/2001/XMLSchema#float"
"http://www.w3.org/2001/XMLSchema#integer"
"http://www.w3.org/2001/XMLSchema#positiveInteger"
"http://www.w3.org/2001/XMLSchema#integer"
Some properties having these ranges;
"http://dbpedia.org/ontology/speaker",
"http://dbpedia.org/ontology/ranking",
"http://dbpedia.org/ontology/humanDevelopmentIndex",
"http://dbpedia.org/ontology/numberOfPlatformLevels",
"http://dbpedia.org/ontology/enginePower",
"http://dbpedia.org/ontology/graySubject",
"http://dbpedia.org/ontology/shareOfAudience",
"http://dbpedia.org/ontology/percentageLiteracyWomen",.........
Sample examples I need to found or somehow generate is an array corresponding to concepts given above. For an example;
"http://dbpedia.org/ontology/enginePower" : ["220", "125", "1300",....],
"http://dbpedia.org/ontology/humanDevelopmentIndex" : ["0.34", "0.78", "0.98", ...]
I don't need that exact format. It would be great If I can find enough number of data tables given as T2D golden dataset for dbpedia.
This query starts you down the road, as it gets you 100 typed literal values for <http://dbpedia.org/ontology/populationTotal>, which are all typed as <http://www.w3.org/2001/XMLSchema#nonNegativeInteger> --
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?value
WHERE
{ ?subject dbo:populationTotal ?value }
LIMIT 100
This rather more complex (and expensive) query gets you something like the end result I think you want -- but you will need to run it a number of times, for a few predicates at a time, to get everything you're asking for from the public endpoint. If needed, you could spin up your own DBpedia mirror instance in the AWS cloud, and adjust Virtuoso's timeouts and other limits, in order to build and run one query that would deliver one giant result set.
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT # DISTINCT ?predicate ?value ?value_type ?value_str
?predicate ?value_type ( GROUP_CONCAT ( DISTINCT ?value_str ; separator=", " ) AS ?values )
WHERE
{ ?subject ?predicate ?value
VALUES ( ?predicate ) { ( dbo:numberOfPlatformLevels )
( dbo:shareOfAudience )
( dbo:populationTotal )
}
BIND ( DATATYPE ( ?value ) AS ?value_type )
BIND ( STR ( ?value ) AS ?value_str )
}
GROUP BY ?predicate ?value_type
ORDER BY ?predicate ?value_type
LIMIT 1000
I cannot find in the Oracle docs any reference to the new version of the below command:
SET DESCRIBE DEPTH 3
line 89: "SET DESCRIBE DEPTH 3" is Obsolete.
How can it be achieved in newer versions of Oracle databases?
The behaviour it should mimic for Object types e.g.
CREATE OR REPLACE TYPE ADDRESSES AS OBJECT (
street VARCHAR2 (25),
house_no NUMBER(2)
);
CREATE OR REPLACE TYPE PEOPLE AS OBJECT (
name VARCHAR2 (15),
address ADDRESSES,
MAP MEMBER FUNCTION Equals RETURN VARCHAR2,
MEMBER FUNCTION PeopleToString RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES (PeopleToString, RNDS, WNDS, RNPS, WNPS)
)
NOT FINAL;
CREATE TABLE Locations (
pseudo VARCHAR2(15) CONSTRAINT pk_xyz_table PRIMARY KEY
CONSTRAINT fk_loc_xyz REFERENCES XYZ(pseudo),
person PEOPLE
);
SET DESC DEPTH 3
DESC Locations
PSEUDO NOT NULL VARCHAR2(15)
PEOPLE
PEOPLE IS NOT FINAL
NAME VARCHAR2(15)
ADDRESS ADRESSES
STREET VARCHAR2(25)
HOUSE_NO NUMBER`
SET DESC DEPTH n is not obsolete in SQL*Plus, according to the 12c manual and my tests.
The problem appears to be with Oracle SQL Developer's poor imitation of SQL*Plus. These bugs are why it's dangerous for integrated development environments to try to clone SQL*Plus.
SQL*Plus is not a great tool. It's main advantage is it's compatibility across many platforms. There are so many ways to "run a script", it's nice to have a method that you know will work the same for everyone.
Accept no imitation - if you need SQL*Plus, use the real thing.
I'm trying to do a query with a cardinality restriction. The query looks like
ClassA and (roleA min 2 ClassB)
but this returns an empty set. On the other hand when I do the query
ClassA and (roleA some ClassB)
it returns some individuals of ClassA. Why does the cardinality query not work when I know there are definitely a least two roleAs on some ClassA individuals?
To be more specific, I have the classes Team, Player and Position, and object properties employs (which relates Teams and Players), and hasPosition (which relates Players and Positions). I'm trying to do the query
Team and employs min 2 (Player and hasPosition some { Striker**}**)
which should return the teams with two or more Strikers but obviously because OWL doesn't make the unique name assumption it returns an empty set. I have tried to declare that some of my individuals are distinct, but when I execute the query with the distinct individuals in place it causes Protégé to crash. Protégé does not crash when running the query without the distinct individuals.
Edit:
Error Message from Pellet in Protege
Striker shown in Ontology XML
There's not enough information in this question yet to determine why you're not getting the results that you're looking for, but we can reproduce the scenario well enough to show that this achievable. Consider an ontology with three classes and some individuals:
Player {p1, p2}
Team {team1}
Position {Striker}
and the axioms
p1 ≠ p2
team1 employs p1
team1 employs p2
p1 hasPosition Striker
p2 hasPosition Striker
Then the query
Team and employs min 2 (Player and hasPosition value Striker)
returns the individual team1. (This works with “hasPosition some {Striker}”, too, but for just one value, I think that the value keyword is a better fit.)
Here's the ontology:
#prefix : <http://stackoverflow.com/q/22688901/1281433/competitions#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://stackoverflow.com/q/22688901/1281433/competitions>
a owl:Ontology .
:Player a owl:Class .
:Position a owl:Class .
:Team a owl:Class .
:hasPosition a owl:ObjectProperty .
:Striker a owl:NamedIndividual , :Position .
:p1 a owl:NamedIndividual , :Player ;
:hasPosition :Striker .
:p2 a owl:NamedIndividual , :Player ;
:hasPosition :Striker .
[ a owl:AllDifferent ;
owl:distinctMembers ( :p1 :p2 )
] .
:team1 a owl:NamedIndividual , :Team ;
:employs :p1 , :p2 .
I created a script template to generate the extendend properties to basically to include the data dictionary in the database, however, i couldn't find any macro to read-out the table comment from the model. Is there any hack for this?
The is DBMS specific in ERwin.
Depending on the dbms - SQL server or oracle will have a FET template.
for sql server.
if you edit the sql server template for creating schema. which in sql server is what generate comments or udp extended properties. here is what is shown.
/* Generate comments and UDP's as Extended Properties. */
[
/* Set the variables required by the "Clause: Specify Extended Properties". */
Set( "var_RemoveVariables", "true" )
Set( "var_Operation", "sp_addextendedproperty" )
Set( "var_Comment", "Definition" )
Set( "var_Level0Type", "SCHEMA" )
Set( "var_Level0Name", Property( "Name" ) )
/* Generate Schema comments and UDPs */
Execute( "Clause: Specify Extended Properties" )
]
[
FE::Bucket( "150" )
ForEachOwnee( "Permission" )
{
Execute( "Create Permission" )
}
]
]