Quantcast

SPARQL query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SPARQL query

Juliana.S
Hi!

I would like to do a query in SPARQL that returns information that is indirectly tied to an individual. I will present in detail what I have:

X hasDiameter Diameter10.0
And:
DIameter10.0 hasDiameterValue “10.0”^^xsd:double

I tried to write as follows:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?y .

FILTER (?y >= hose:Diameter10.0)

}


and


SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}


But I do not get a correct answer. How could I do that?

Also, I wonder if it is possible to combine queries, that is, to make filters to get an answer.


Thanks in advance,

Juliana


-- 

Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SPARQL query

Csongor Nyulas
Administrator
Based on the two statements you provided in your question, it seems that you've reified your diameter (i.e. you created an individual to represent a diameter value, Diameter10.0, which, in turn, has a datatype property assertion to represent numeric value of the diameter)
Your question does not provide any hint about the role of the hose:HoseAvailableOption class. Without that it is impossible for us to give you the exact query that would work for sure. Can you please provide the ontology?

In any case the SPARQL query should be a combination of the two queries, something like this:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?d .

               
?d hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}

Some notes:
- SPARQL variable names are case sensitive, i.e. ?x is not the same as ?X. Mixing variables that have names with characters in different case can be an easy source of error.
- what is the type of the Diameter10.0 individual? If it is "Diameter", or something similar, which expresses the nature of its instances, maybe you could use a more generic datatype property name, such as "hasNumericValue", or "hasValue" instead of "
hasDiameterValue". Then you could reuse that property in other Measurement classes, such as "Length" or "Width", to encode their numeric value.
- the mistake in your first query attempt was that you tried to apply a numeric comparison on an individual. You can't do that.

Csongor


On 05/15/2017 12:18 PM, JULIANA SCHMIDT wrote:
Hi!

I would like to do a query in SPARQL that returns information that is indirectly tied to an individual. I will present in detail what I have:

X hasDiameter Diameter10.0
And:
DIameter10.0 hasDiameterValue “10.0”^^xsd:double

I tried to write as follows:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?y .

FILTER (?y >= hose:Diameter10.0)

}


and


SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}


But I do not get a correct answer. How could I do that?

Also, I wonder if it is possible to combine queries, that is, to make filters to get an answer.


Thanks in advance,

Juliana


-- 

Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a moz-do-not-send="true" href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SPARQL query

Juliana.S
Csongor,

Thank you so much. Now the query is answering the information I wanted. 

Juliana

2017-05-15 20:15 GMT-03:00 Csongor Nyulas <[hidden email]>:
Based on the two statements you provided in your question, it seems that you've reified your diameter (i.e. you created an individual to represent a diameter value, Diameter10.0, which, in turn, has a datatype property assertion to represent numeric value of the diameter)
Your question does not provide any hint about the role of the hose:HoseAvailableOption class. Without that it is impossible for us to give you the exact query that would work for sure. Can you please provide the ontology?

In any case the SPARQL query should be a combination of the two queries, something like this:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?d .

               
?d hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}

Some notes:
- SPARQL variable names are case sensitive, i.e. ?x is not the same as ?X. Mixing variables that have names with characters in different case can be an easy source of error.
- what is the type of the Diameter10.0 individual? If it is "Diameter", or something similar, which expresses the nature of its instances, maybe you could use a more generic datatype property name, such as "hasNumericValue", or "hasValue" instead of "
hasDiameterValue". Then you could reuse that property in other Measurement classes, such as "Length" or "Width", to encode their numeric value.
- the mistake in your first query attempt was that you tried to apply a numeric comparison on an individual. You can't do that.

Csongor



On 05/15/2017 12:18 PM, JULIANA SCHMIDT wrote:
Hi!

I would like to do a query in SPARQL that returns information that is indirectly tied to an individual. I will present in detail what I have:

X hasDiameter Diameter10.0
And:
DIameter10.0 hasDiameterValue “10.0”^^xsd:double

I tried to write as follows:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?y .

FILTER (?y >= hose:Diameter10.0)

}


and


SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}


But I do not get a correct answer. How could I do that?

Also, I wonder if it is possible to combine queries, that is, to make filters to get an answer.


Thanks in advance,

Juliana


-- 

Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user




--
Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: (+55-41) 99162-6076

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SPARQL query

Juliana.S
Hello Csongor,

I wonder if it is possible to do a query based on a previous one, such as a pipeline. 
Attached is the ontology model I am working on. 

Thanks in advance,
Juliana

2017-05-16 12:45 GMT-03:00 JULIANA SCHMIDT <[hidden email]>:
Csongor,

Thank you so much. Now the query is answering the information I wanted. 

Juliana

2017-05-15 20:15 GMT-03:00 Csongor Nyulas <[hidden email]>:
Based on the two statements you provided in your question, it seems that you've reified your diameter (i.e. you created an individual to represent a diameter value, Diameter10.0, which, in turn, has a datatype property assertion to represent numeric value of the diameter)
Your question does not provide any hint about the role of the hose:HoseAvailableOption class. Without that it is impossible for us to give you the exact query that would work for sure. Can you please provide the ontology?

In any case the SPARQL query should be a combination of the two queries, something like this:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?d .

               
?d hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}

Some notes:
- SPARQL variable names are case sensitive, i.e. ?x is not the same as ?X. Mixing variables that have names with characters in different case can be an easy source of error.
- what is the type of the Diameter10.0 individual? If it is "Diameter", or something similar, which expresses the nature of its instances, maybe you could use a more generic datatype property name, such as "hasNumericValue", or "hasValue" instead of "
hasDiameterValue". Then you could reuse that property in other Measurement classes, such as "Length" or "Width", to encode their numeric value.
- the mistake in your first query attempt was that you tried to apply a numeric comparison on an individual. You can't do that.

Csongor



On 05/15/2017 12:18 PM, JULIANA SCHMIDT wrote:
Hi!

I would like to do a query in SPARQL that returns information that is indirectly tied to an individual. I will present in detail what I have:

X hasDiameter Diameter10.0
And:
DIameter10.0 hasDiameterValue “10.0”^^xsd:double

I tried to write as follows:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?y .

FILTER (?y >= hose:Diameter10.0)

}


and


SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}


But I do not get a correct answer. How could I do that?

Also, I wonder if it is possible to combine queries, that is, to make filters to get an answer.


Thanks in advance,

Juliana


-- 

Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user




--
Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076



--
Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: (+55-41) 99162-6076

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

Hose2017_12.owl (1M) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SPARQL query

Lorenz B.
SPARQL 1.1 supports sub-SELECTs, but you should make clear whether you really need this. What is not beeing supported are materialized or the like if you mean something like that.

Hello Csongor,

I wonder if it is possible to do a query based on a previous one, such as a pipeline. 
Attached is the ontology model I am working on. 

Thanks in advance,
Juliana

2017-05-16 12:45 GMT-03:00 JULIANA SCHMIDT <[hidden email]>:
Csongor,

Thank you so much. Now the query is answering the information I wanted. 

Juliana

2017-05-15 20:15 GMT-03:00 Csongor Nyulas <[hidden email]>:
Based on the two statements you provided in your question, it seems that you've reified your diameter (i.e. you created an individual to represent a diameter value, Diameter10.0, which, in turn, has a datatype property assertion to represent numeric value of the diameter)
Your question does not provide any hint about the role of the hose:HoseAvailableOption class. Without that it is impossible for us to give you the exact query that would work for sure. Can you please provide the ontology?

In any case the SPARQL query should be a combination of the two queries, something like this:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?d .

               
?d hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}

Some notes:
- SPARQL variable names are case sensitive, i.e. ?x is not the same as ?X. Mixing variables that have names with characters in different case can be an easy source of error.
- what is the type of the Diameter10.0 individual? If it is "Diameter", or something similar, which expresses the nature of its instances, maybe you could use a more generic datatype property name, such as "hasNumericValue", or "hasValue" instead of "
hasDiameterValue". Then you could reuse that property in other Measurement classes, such as "Length" or "Width", to encode their numeric value.
- the mistake in your first query attempt was that you tried to apply a numeric comparison on an individual. You can't do that.

Csongor



On 05/15/2017 12:18 PM, JULIANA SCHMIDT wrote:
Hi!

I would like to do a query in SPARQL that returns information that is indirectly tied to an individual. I will present in detail what I have:

X hasDiameter Diameter10.0
And:
DIameter10.0 hasDiameterValue “10.0”^^xsd:double

I tried to write as follows:

SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameter ?y .

FILTER (?y >= hose:Diameter10.0)

}


and


SELECT ?X

WHERE { ?X rdf:type hose:HoseAvailableOption .

                ?X hose:hasDiameterValue ?y .

FILTER (?y >= 10.0)

}


But I do not get a correct answer. How could I do that?

Also, I wonder if it is possible to combine queries, that is, to make filters to get an answer.


Thanks in advance,

Juliana


-- 

Juliana Schmidt

Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a moz-do-not-send="true" href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
_______________________________________________ protege-user mailing list [hidden email] https://mailman.stanford.edu/mailman/listinfo/protege-user
--
Juliana Schmidt
Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: <a moz-do-not-send="true" href="tel:+55%2041%2099162-6076" value="+5541991626076" target="_blank">(+55-41) 99162-6076
--
Juliana Schmidt
Mestranda em Engenharia Mecânica e de Materiais
Universidade Tecnológica Federal do Paraná (UTFPR)
Cel.: (+55-41) 99162-6076
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Loading...