Empty result when using properties Pizza.owl - owl

I'm trying to run the following SPARQL query in Protege 4.3 (on Pizza.owl), but I get an empty result:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
SELECT ?pizzaInstance ?pizzaClass ?toppingInstance
WHERE {
?pizzaClass rdfs:subClassOf :NamedPizza .
?pizzaInstance rdf:type ?pizzaClass .
?pizzaInstance :hasTopping ?toppingInstance .
}
This only happens when I run queries involving properties.
With the same prefixes the following query works - and returns NamedPizza:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
SELECT ?pizzaInstance
WHERE {
?pizzaInstance rdfs:subClassOf :Pizza .
}
What is wrong with the first query?

I finally understood what I was doing wrong. This query returns individuals for pizzaInstance, and none of the individuals in my ontology had a topping. When I queried for hasCalorificContentValue instead of hasTopping I got the desired results:
PREFIX pz: <http://www.semanticweb.org/ontologies/2017/11/Ontology1512823737278.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?pizzaClass ?pizzaInstance ?calorificInstance
WHERE {
?pizzaClass rdfs:subClassOf pz:NamedPizza .
?pizzaInstance rdf:type ?pizzaClass.
?pizzaInstance pz:hasCalorificContentValue ?calorificInstance.
}
The query becomes meaningful when you check the raw owl file (Example-MargheritaPizza is of type MargheritaPizza and is involved in the datatype property hasCalorificValue):
<owl:NamedIndividual rdf:about="&Ontology1512823737278;Example-MargheritaPizza">
<rdf:type rdf:resource="&Ontology1512823737278;MargheritaPizza"/>
<hasCalorificContentValue rdf:datatype="&xsd;int">263</hasCalorificContentValue>
</owl:NamedIndividual>
Here is a good tutorial, hope this helps someone.

Related

Where to find a dataset with literal data already annotated with dbpedia property concepts (having their range in float or int)?

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

IMP-00009 and IMP-00018: abnormal end of export file partial import of previous table completed: 10865925 rows imported

I'm getting tired to backup and restore Oracle database but it's shown same error every time please anyone tell me what's the solution of this
what's the reason for getting this type of error
IMP-00009: abnormal end of export file
Warning: the objects were exported by PSSL, not by you
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing PSSL's objects into SYS
. . importing table "APPS_OPBAL" 6209 rows imported
. . importing table "APPS_OPSTK" 4128 rows imported
. . importing table "BCL_AVGPL" 37410 rows imported
. . importing table "CL_BONUS" 4811 rows imported
. . importing table "CL_BSREVERSE" 2509 rows imported
. . importing table "CL_BUYSALE" 160742 rows imported
. . importing table "CL_CDBLFEE" 16178 rows imported
. . importing table "CL_CDBLSTK" 26623 rows imported
. . importing table "CL_CERTIFICATE" 6921 rows imported
. . importing table "CL_MRATE_CSE" 368606 rows imported
. . importing table "CL_MRATE_DSE" 0 rows imported
. . importing table "CL_RECEIVE" 13868 rows imported
. . importing table "CL_RECV_MST" 4057 rows imported
. . importing table "CL_REFERENCE" 0 rows imported
. . importing table "CL_REFMST" 0 rows imported
. . importing table "CL_REQPAY" 9666 rows imported
. . importing table "CL_REQPAY_MST" 5353 rows imported
. . importing table "CL_RIGHT" 0 rows imported
. . importing table "CL_SEC" 2 rows imported
. . importing table "CL_SETTLEMENT" 1905 rows imported
. . importing table "CL_TRANS_CHQRP" 23208 rows imported
. . importing table "GL_ACCHART" 7868 rows imported
. . importing table "GL_ACCHART_CTRL" 198 rows imported
. . importing table "GL_BALANCESHEET" 0 rows imported
. . importing table "GL_BSHEET" 21 rows imported
. . importing table "GL_CHQBOOK" 0 rows imported
. . importing table "GL_CHQNO" 0 rows imported
. . importing table "GL_CHQNO1" 0 rows imported
. . importing table "GL_MASTER" 231583 rows imported
. . importing table "GL_RECON" 28685 rows imported
. . importing table "GL_TRANS" 7593 rows imported
. . importing table "GL_TRANS_JV" 30067 rows imported
. . importing table "NGTS_CLIENT" 53159 rows imported
. . importing table "NGTS_SCRIPT" 0 rows imported
. . importing table "PCL_AVGPL" 37489 rows imported
. . importing table "PCL_BAL25" 0 rows imported
. . importing table "PCL_BALANCE" 5193623 rows imported
. . importing table "PCL_BAL_CL" 4750948 rows imported
. . importing table "PCL_BAL_MATURED" 21862 rows imported
. . importing table "PCL_BAL_OP" 4736213 rows imported
. . importing table "PCL_BAL_TRANS" 205464 rows imported
. . importing table "PCL_BUYSALE" 74671 rows imported
. . importing table "PCL_BUYSALE0206" 392 rows imported
. . importing table "PCL_NETPL" 0 rows imported
. . importing table "PCL_RECVISSUE" 14724 rows imported
. . importing table "PCL_STK_CL" 4957536 rows imported
. . importing table "PCL_STK_MATURED" 37934 rows imported
. . importing table "PCL_STK_OP" 13439383 rows imported
. . importing table "PCL_STK_RATE" 13457171 rows imported
. . importing table "PCL_STOCK"
IMP-00009: abnormal end of export file
IMP-00018: partial import of previous table completed: 10865925 rows imported
Import terminated successfully with warnings.

Exporting data from ontology - Protege

How to export data from ontology to an excel sheet using Protege.
For example, I want to get a table with 2 columns:
Class rdf:ID, Super Class rdf:ID.
solved!..
From the tap SPARQL Query
type the query:
SELECT ?subject ?object
WHERE { ?subject rdfs:subClassOf ?object }
then execute and copy the result directly into an excel sheet :)

Cardinality DL queries in OWL in Protégé

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 .

OWL 2 reasoning with SWRL rules

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

Resources