I have two questions :
(1) The function getOWLDatatypeMinInclusiveRestriction (and similarily for MaxInclusive, (min, max) exclusive) for constraining facets
for the datatype accept as input only double or integer values.
Is that means that facets restrictions with OWL API cannot be applied for decimals.
(2) How can I get the datatype of a dataTypeProperty by OWL API?
1) the methods you mention are shorthand for (perceived) most common uses. You can create the same restrictions with decimals but you'll have to create the literals and combine them manually. I don't have an example at hand but can add one later if you need.
2) look for data property range axioms on that property.
Related
I'm using Azure Logic apps and one of the steps is to parse an API JSON response. I'm uploading a payload to generate the schema.
One of my properties is a decimal type for Tax, specific in the JSON as “Number” type
The value in my source JSON comes through as this…
"TaxAmount": 999.00
However when its parsed it is set as "Integer"
When I change the value to...
"TaxAmount": 999.01
It will correctly come through as a "Number" type
Is there a way I can define the value of 999.00 and it be parsed as a “Number” rather than an “Integer”?
Any help would be appreciated
One workaround is to directly(i.e., manually) change the type of the variable while parsing. Something like
to
Unfortunatly, no.
Some programming languages and parsers use different internal
representations for floating point numbers than they do for integers.
For consistency, integer JSON numbers SHOULD NOT be encoded with a
fractional part.
https://json-schema.org/draft/2020-12/json-schema-core.html#integers
Note that this is SHOULD NOT, so it MAY be allowable.
But, consider, implementations may behave differently.
"SHOULD NOT" means, "you really should not do this unless you have a really good reason, and you better document it if you do".
If you need this, consider encoding the numbers in strings and using regular expression to do the validation.
I'm working on a simple search engine where I use the TF-IDF formula to score how important a search word is. I see people using different bases for the formula, but I see no explanation for when to use which. Does it matter at all, and do you have any recommendations?
My current implementation uses the regular log() function of the math.h library
TF-IDF literature usually uses base 2, although a common implementation sklearn uses natural logarithms for example. Just take in count that the lower the base, the bigger the score, which can affect truncation of search resultset by score.
Note that from a mathematical point of view, the base can always be changed later. It's easy to convert from one base to another, because the following equality holds:
log_a(x)/log_a(y) = log_b(x)/log_b(y)
You can always convert from one base to another. It's actually very easy. Just use this formula:
log_b(x) = log_a(x)/log_a(b)
Often bases like 2 and 10 are preferred among engineers. 2 is good for halftimes, and 10 is our number system. Math people prefer the natural logarithm, because it makes calculus a lot easier. The derivative of the function b^x where b is a constant is k*b^x. Bur if b is equal to e (the natural logarithm) then k is 1.
So let's say that you want to send in the 2-logarithm of 5.63 using log(). Just use log(5.63)/log(2).
If you have the need for it, just use this function for arbitrary base:
double logb(double x, double b) {
return log(x)/log(b);
}
I am working on building a simple software ontology in Protege v5.2 and I am trying to classify pieces of software (using a reasoner plugin) as CPU intensive if their CPU time is larger than 80% of their physical execution time.
For this reason, each individual has the following data properties filled with float values:
a) hasCPUTime
b) hasPhysicalExecutionTime
I have created a class CPUIntensive and I want to add a restriction that individuals which have hasCPUTime > 0.8 * hasPhysicalExecutionTime belong in this class.
Can this be done in Protege?
OWL 2 doesn't allow arithmetic computations, e.g. multiplication (though some kind of comparison is possible using data ranges).
You need SWRL with builtins:
hasCPUTime (?ind, ?cpu) ^
hasPhysicalTime (?ind, ?phy) ^
swrlb:greaterThan (?cpu, ?mul) ^
swrlb:multiply (?mul, 0.8, ?phy)
-> CPUIntensive(?ind)
The swrlb:multiply builtin is satisfied iff the first argument is equal to the arithmetic product of the second argument through the last argument, and if the first argument is unbound, binds it to the arithmetic product of them, much like Mul is 0.8*Phy. works in Prolog.
Pellet does support those builtins:
What's the syntax for the maximum of 2 INTEGERS?
Eiffel documentation is so bad, literally could not find the answer to this simple question anywhere!
Or does it not exist and I have to use if-statements?
In most cases in Eiffel, the source is all the documentation you need. By right-clicking on a class' name in EiffelStudio, you can see its ancestor tree. You can also use the flat view feature to see all the inherited features of a class within the same editor.
Typically, INTEGER is an alias for INTEGER_32. INTEGER_32 inherits from COMPARABLE (through INTEGER_32_REF). COMPARABLE provides the max and min features. Their signature is
max (other: like Current): like Current
meaning all descendants of COMPARABLE take and return another value of the same type as themselves.
Therefore:
local
a, b, maximum: INTEGER
do
a := <some value>
b := <some value>
maximum := a.max(b) -- or b.max(a)
end
Eiffel has a unified type system, which means every type is defined as a class, even 'primitive' types that get special treatments in most other languages. INTEGER, CHARACTER, BOOLEAN, ARRAY and other such basic types thus come with a rich set of features you can consult in their own class files like you would with any other type. Since operators are defined as regular features too, this is also the way to figure out exactly what operators exist for any given class.
Not sure if this is within the realm of SO but:
Using VDM-SL, I have been looking around for the 'best' way of describing a single, finite subset of ℕ. In my travels I have found several ways that people are conveying this but I wonder which is the most accepted.
I initially thought that F(ℕ) would do but I believe that this is the set of finite subsets of ℕ, rather than a single subset.
Would it be enough to say, "Let S be finite: S ⊂ ℕ?"
Or does such a notation exist?
All sets in VDM language are finite by definition, so I believe there is no need to explicitly specify that part. As defined here http://wiki.overturetool.org/images/c/cb/VDM10_lang_manV2.pdf section 3.2.1
Now, to model a type which is a subset of a set s2 , one of the ways is to use an invariant on that type. such as "inv t == s1 subset s2".