Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
doc:measurement_units [2014/06/05 11:38]
127.0.0.1 external edit
doc:measurement_units [2014/12/07 08:57] (current)
admin
Line 7: Line 7:
   * The definitions of units, quantities etc are imported from the large [[http://​qudt.org/​|QUDT ontology]]   * The definitions of units, quantities etc are imported from the large [[http://​qudt.org/​|QUDT ontology]]
   * The units can be converted into each other using the convert_to_unit(Input,​ OutputType, Res) predicate   * The units can be converted into each other using the convert_to_unit(Input,​ OutputType, Res) predicate
-  * Transparent conversion is done by an rdf_triple hook definition that accepts queries for values in a given unit like rdf_triple(knowrob:​length,​ '​test-inst',​ literal(type(unit:'​Kilometer',​ Val))). If results in a different unit are found, they are converted transparently and returned in the correct format.+  * Transparent conversion is done by an rdf_triple hook definition that accepts queries for values in a given unit like rdf_triple(knowrob:​length,​ '​test-inst',​ literal(type(unit:'​Kilometer',​ Val))). If results ​are found that are described ​in a different unit, they are converted transparently and returned in the correct format.
   * The conversion routine checks if both units describe the same quantity type (e.g. length, time) and only perform ​ the conversion if this is the case.   * The conversion routine checks if both units describe the same quantity type (e.g. length, time) and only perform ​ the conversion if this is the case.
  
Line 16: Line 16:
  
 <​code>​ <​code>​
- $ roscd knowrob_common/owl + $ roscd knowrob_common 
- $ rosrun rosprolog rosprolog ​ias_knowledge_base+ $ rosrun rosprolog rosprolog ​knowrob_common
    
- ?- owl_parse('​knowrob_units.owl'​, false, false, true). + ?- owl_parse('​package://​knowrob_common/​owl/​knowrob_units.owl'​). 
- ?- consult('​../prolog/​knowrob_units.pl'​).+ ?- consult('​prolog/​knowrob_units.pl'​).
    
  % read information that is asserted for a test instance  % read information that is asserted for a test instance
- ?- rdf_has('​http://​ias.cs.tum.edu/​kb/​knowrob_units.owl#​test-inst',​ + ?- rdf_has('​http://​knowrob.org/​kb/​knowrob_units.owl#​test-inst',​ 
-            '​http://​ias.cs.tum.edu/​kb/​knowrob_units.owl#​length',​ O).+            '​http://​knowrob.org/​kb/​knowrob_units.owl#​length',​ O).
  O = literal(type('​http://​qudt.org/​vocab/​unit#​Centimeter','​12.0'​)) .  O = literal(type('​http://​qudt.org/​vocab/​unit#​Centimeter','​12.0'​)) .
    
Line 41: Line 41:
 <​code>​ <​code>​
  % transparent conversion during the query  ​  % transparent conversion during the query  ​
- ?- rdf_triple('​http://​ias.cs.tum.edu/​kb/​knowrob_units.owl#​length',​  + ?- rdf_triple('​http://​knowrob.org/​kb/​knowrob_units.owl#​length',​  
-               '​http://​ias.cs.tum.edu/​kb/​knowrob_units.owl#​test-inst', ​+               '​http://​knowrob.org/​kb/​knowrob_units.owl#​test-inst', ​
                 literal(type('​http://​qudt.org/​vocab/​unit#​Meter',​ Val))).                 literal(type('​http://​qudt.org/​vocab/​unit#​Meter',​ Val))).
  Val = 0.12 ;  Val = 0.12 ;
    
- ?- rdf_triple('​http://​ias.cs.tum.edu/​kb/​knowrob_units.owl#​length',​  + ?- rdf_triple('​http://​knowrob.org/​kb/​knowrob_units.owl#​length',​  
-               '​http://​ias.cs.tum.edu/​kb/​knowrob_units.owl#​test-inst', ​+               '​http://​knowrob.org/​kb/​knowrob_units.owl#​test-inst', ​
                 literal(type('​http://​qudt.org/​vocab/​unit#​Kilometer',​ Val))).                 literal(type('​http://​qudt.org/​vocab/​unit#​Kilometer',​ Val))).
  Val = 0.00012 ;  Val = 0.00012 ;