Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pre-commit run --all-files
with no errorsStarted writing a parser for QUDT. QUDT has defined 1100 quantitykinds, which are like the 'kind' previously discussed in pint #676. There's also a load of metadata for the quantitykind and units:
quantitykind and unit examples
.$\text{amp}$ ,
unit:A
a qudt:Unit ;
dcterms:description """$\textit{Ampere}$, often shortened to
is the SI unit of electric current and is one of the seven SI base units defined as:
$$\text{A} \equiv \frac{\textit{C}}{\textit{s}}
\equiv \frac{\textit{coulomb}}{\textit{second}}
\equiv \frac{\text{joule}}{\text{weber}}$$
Note that SI supports only the use of symbols and deprecates the use of any abbreviations for units.
"""^^qudt:LatexString ;
qudt:applicableSystem sou:CGS-EMU ;
qudt:applicableSystem sou:CGS-GAUSS ;
qudt:applicableSystem sou:PLANCK ;
qudt:applicableSystem sou:SI ;
qudt:conversionMultiplier 1.0 ;
qudt:conversionMultiplierSN 1.0E0 ;
qudt:dbpediaMatch "http://dbpedia.org/resource/Ampere"^^xsd:anyURI ;
qudt:hasDimensionVector qkdv:A0E1L0I0M0H0T0D0 ;
qudt:hasQuantityKind quantitykind:CurrentLinkage ;
qudt:hasQuantityKind quantitykind:DisplacementCurrent ;
qudt:hasQuantityKind quantitykind:ElectricCurrent ;
qudt:hasQuantityKind quantitykind:ElectricCurrentPhasor ;
qudt:hasQuantityKind quantitykind:MagneticTension ;
qudt:hasQuantityKind quantitykind:MagnetomotiveForce ;
qudt:hasQuantityKind quantitykind:TotalCurrent ;
qudt:iec61360Code "0112/2///62720#UAA101" ;
qudt:iec61360Code "0112/2///62720#UAD717" ;
qudt:informativeReference "http://en.wikipedia.org/wiki/Ampere?oldid=494026699"^^xsd:anyURI ;
qudt:omUnit http://www.ontology-of-units-of-measure.org/resource/om-2/ampere ;
qudt:siExactMatch si-unit:ampere ;
qudt:symbol "A" ;
qudt:ucumCode "A"^^qudt:UCUMcs ;
qudt:udunitsCode "A" ;
qudt:uneceCommonCode "AMP" ;
rdfs:isDefinedBy http://qudt.org/2.1/vocab/unit ;
rdfs:label "Ampere"@de ;
rdfs:label "amper"@hu ;
rdfs:label "amper"@pl ;
rdfs:label "amper"@ro ;
rdfs:label "amper"@sl ;
rdfs:label "amper"@tr ;
rdfs:label "ampere"@en ;
rdfs:label "ampere"@it ;
rdfs:label "ampere"@ms ;
rdfs:label "ampere"@pt ;
rdfs:label "amperio"@es ;
rdfs:label "amperium"@LA ;
rdfs:label "ampère"@fr ;
rdfs:label "ampér"@cs ;
rdfs:label "αμπέρ"@el ;
rdfs:label "ампер"@bg ;
rdfs:label "ампер"@ru ;
rdfs:label "אמפר"@he ;
rdfs:label "آمپر"@fa ;
rdfs:label "أمبير"@ar ;
rdfs:label "एम्पीयर"@hi ;
rdfs:label "アンペア"@ja ;
rdfs:label "安培"@zh ;
skos:altLabel "amp" ;
.
#################################
quantitykind:Acceleration
a qudt:QuantityKind ;
dcterms:description "Acceleration is the (instantaneous) rate of change of velocity. Acceleration may be either linear acceleration, or angular acceleration. It is a vector quantity with dimension \(length/time^{2}\) for linear acceleration, or in the case of angular acceleration, with dimension \(angle/time^{2}\). In SI units, linear acceleration is measured in \(meters/second^{2}\) (\(m \cdot s^{-2}\)) and angular acceleration is measured in \(radians/second^{2}\). In physics, any increase or decrease in speed is referred to as acceleration and similarly, motion in a circle at constant speed is also an acceleration, since the direction component of the velocity is changing."^^qudt:LatexString ;
qudt:applicableUnit unit:CentiM-PER-SEC2 ;
qudt:applicableUnit unit:FT-PER-SEC2 ;
qudt:applicableUnit unit:G ;
qudt:applicableUnit unit:GALILEO ;
qudt:applicableUnit unit:IN-PER-SEC2 ;
qudt:applicableUnit unit:KN-PER-SEC ;
qudt:applicableUnit unit:KiloM-PER-SEC2 ;
qudt:applicableUnit unit:KiloPA-M2-PER-GM ;
qudt:applicableUnit unit:M-PER-SEC2 ;
qudt:applicableUnit unit:MI_US-PER-SEC2 ;
qudt:applicableUnit unit:MicroG ;
qudt:applicableUnit unit:MilliG ;
qudt:applicableUnit unit:MilliGAL ;
qudt:applicableUnit unit:MilliM-PER-SEC2 ;
qudt:applicableUnit unit:YD-PER-SEC2 ;
qudt:dbpediaMatch "http://dbpedia.org/resource/Acceleration"^^xsd:anyURI ;
qudt:exactMatch quantitykind:LinearAcceleration ;
qudt:hasDimensionVector qkdv:A0E0L1I0M0H0T-2D0 ;
qudt:iec61360Code "0112/2///62720#UAD002" ;
qudt:informativeReference "http://en.wikipedia.org/wiki/Acceleration"^^xsd:anyURI ;
qudt:siExactMatch si-quantity:ACCE ;
rdfs:isDefinedBy http://qudt.org/2.1/vocab/quantitykind ;
rdfs:label "Beschleunigung"@de ;
rdfs:label "Pecutan"@ms ;
rdfs:label "Zrychlení"@cs ;
rdfs:label "acceleratio"@LA ;
rdfs:label "acceleration"@en ;
rdfs:label "accelerazione"@it ;
rdfs:label "accelerație"@ro ;
rdfs:label "accélération"@fr ;
rdfs:label "aceleración"@es ;
rdfs:label "aceleração"@pt ;
rdfs:label "ivme"@tr ;
rdfs:label "pospešek"@sl ;
rdfs:label "przyspieszenie"@pl ;
rdfs:label "Όγκος"@el ;
rdfs:label "Ускоре́ние"@ru ;
rdfs:label "التسارع"@ar ;
rdfs:label "شتاب"@fa ;
rdfs:label "त्वरण"@hi ;
rdfs:label "加速度"@ja ;
rdfs:label "加速度"@zh ;
.
I think Quantitykind definition can be split into another PR to make things smaller.
Not sure what the best way to right tests for parsing files is either.
The QUDT data is updated regularly, so would need to be downloaded rather than be saved in pint, which would need an optional dependency like requests - Should I add code for downloading files to this?
Would be good to get @hgrecco 's thoughts on the parsing (I've mostly copied pint and adapted as needed so far)
I wonder if it would be possible/better to change the delimiter to "\n.\n" or something instead of using a block?
Also unsure on how to deal with multiline strings
todo:
I'm interested in what functionality quantitykind will allow.