AllFemaleGame is a class that corresponds to the class of every game whose players and observers are all women.
Classes:
Declaration(Class(ns:Game))
Declaration(Class(ns:Person))
Declaration(Class(ns:Female))
Declaration(Class(ns:Observer))
SubClasses:
SubClassOf(ns:Female ns:Person)
Object Properties:
ObjectProperty(ns:isPlayerOf)
ObjectPropertyDomain(ns:isPlayerOf ns:Person)
ObjectPropertyRange(ns:isPlayerOf ns:Game)
EquivalentClasses(m:AllFemaleGame ObjectIntersectionOf(m:Game ObjectAllValuesFrom(m:isPlayerOf m:Female) ObjectAllValueFrom(m:isObserverOf m:Female)))
Am I doing it correctly?
The class expression ObjectAllValuesFrom(m:isPlayerOf m:Female) describes the things x such that if x m:isPlayerOf y, then y is m:Female. Moreover, the domain of m:isPlayerOf is m:Person, and the range is m:Game, so if such a y existed, then x would be a person, and y a game. It seems you have it in the wrong direction. Try this:
EquivalentClasses(
m:AllFemaleGame
ObjectIntersectionOf(
m:Game
ObjectAllValuesFrom(ObjectInverseOf(m:isPlayerOf) m:Female)
ObjectAllValueFrom(ObjectInverseOf(m:isObserverOf) m:Female)
)
)
Note that this class also contains games that do not have players or observers.
Related
i am using a lefleat tile layer with xyz system to query a list of postgis layers,i use a geotools jdbc datastore to fetch layers from database ,but i have to work with bbox or a geotools refernce envelope,how i can transform xyz coordinate to a bbox or a refernce envelope,so i can pass it later to my datastore feature source so i can find geometries or elements in a given bbox ,my coordinate system is EPSG:4326.
You can use the code in gt-tile-client to work with XYZ services.
I think the following should work for you.
String ref = "7/61/53";
String[] parts = ref.split("/");
int z = Integer.valueOf(parts[0]);
int x = Integer.valueOf(parts[1]);
int y = Integer.valueOf(parts[2]);
OSMTile tile = new OSMTile(x, y, new WebMercatorZoomLevel(z), new OSMService("name", "url"));
System.out.println(tile.getExtent());
which gives
ReferencedEnvelope[-8.4375 : -5.625, 27.05912578437406 : 29.535229562948455]
While creating a new search facet in Hybris 5.7 I've found that in SolrIndexedProperty type there is an attribute called rangeSet and there is also a many-to-many relation called SolrIndexedProperty2SolrValueRangeSetRelation between SolrIndexedProperty and SolrValueRangeSet.
What's the difference between these fields? None of them is deprecated or something. Which one should I use in order to create my own facet with particular value ranges?
I hope you have already find the answer for your question. Still adding my understanding just in case...
A SolrValueRangeSet is a collection of related SolrValueRange.
There are two different fields in hybris to support rangeSet and rangeSets.
One can add a SolrValueRangeSet or a Collection of SolrValueRangeSet to a SolrIndexedProperty to support one-2-many or one-2-many-2many property range values. You can consider the later as the enhancement over the prior.
If you want to allow multi facet ranges for different values you can use rangeSets as shown in below example
INSERT_UPDATE SolrValueRangeSet;name[unique=true]; qualifier; type; solrValueRanges(&rangeValueRefID)
;priceRange-USD ; PriceRangeUSD; double; usd-range1, usd-range2
;priceRange-EUR ; PriceRangeEUR; double; eur-range1, eur-range2
SolrValueRange : Define related price range values like below
INSERT_UPDATE SolrValueRange; &rangeValueRefID;s olrValueRangeSet(name)[unique=true]; name[unique=true]; from; to
;usd-range1;priceRange-USD; Rating 1; 0; 50
;usd-range2;priceRange-USD; Rating 2; 50; 100
;eur-range1;priceRange-EUR; Rating 1; 0; 120
;eur-range2;priceRange-EUR; Rating 2; 120; 300
INSERT_UPDATE SolrIndexedProperty; name[unique = true];rangeSets(name)
; price range; priceRange-USD , priceRange-EUR
What is the Kotlin equivalent of the following Java code?
class Test {
Class<? extends Number> types = new Class[] {
Integer.class, Long.class, Short.class, Byte.class, Float.class, Double.class
};
}
You can use out keyword:
var types: Array<Class<out Number>> = arrayOf(
Integer::class.java,
Long::class.java,
Short::class.java,
Byte::class.java,
Float::class.java,
Double::class.java
)
out modifier is used to indicate covariance (similar to ? extends T in Java). Covariance - is the ability to change the generic type argument from a class to one of its parents, i.e. assign List<String> to List<Any>.
What you need here is a covariant array, or out variance on your generic parameter:
var types: Array<Class<out Number>> = arrayOf(
Int::class.java,
Long::class.java,
Short::class.java,
Byte::class.java,
Float::class.java,
Double::class.java
)
This sort of thing is covered in the documentation under variance (although it might take a while to untangle it all, if you're new to it).
In addition to other answers, you could produce the same code in Kotlin using Kotlin data types as;
var types: Array<KClass<out Number>> = arrayOf(
Int::class,
Long::class,
Short::class,
Byte::class,
Float::class,
Double::class
)
Here we use KClass which is the Kotlin class reference type and out is covariance type annotation (producer).
I have documents in my solr already indexed. I want to find Producer and model in tire.
I have file with producer and model like this:
Nokian;WR G2 SUV
Nokian;WR SUV
Nokian;V
Query:
((productname:"NOKIAN" OR producer:"NOKIAN") AND (productname:"V" OR description:"V" OR referencenumber:"V"))
But it found for example this:
"2X NOKIAN 215/55 R17 94V LINE (3)"
Because in this product speed index is V and here model is Line. My algorithm take this product for Nokian;V not for Nokian;Line.
How to ask solr to gives me only this product where this V don't have any other letters around?
LETNIE 225/45/17 94V NOKIAN V FINLAND - PŁOTY
This found beautiful. Its Nokian;V.
As far as I understand your question you need to put MUST quantifier before each boolean clause. So query will look like:
(
+(productname:"NOKIAN" OR producer:"NOKIAN") AND
+(productname:"V" OR description:"V" OR referencenumber:"V")
)
If your productname field is of type text it has the WordDelimiterFilter in the analysis chain. One of the default behaviors of this filter is to split terms on letter-number boundaries causing:
2X NOKIAN 215/55 R17 94V LINE (3)
to generate the following tokens:
2 X NOKIAN 215 55 R 17 94 V LINE 3
(which matches the "V" in your query).
You can always run debug=results to get an explanation for why something matches. I think in this particular case, you might construct another field type for your productname field that analyzes your model string less aggressively.
I solved the problem in such a way that sorted out brand,model Dictionary. I used my own comparer.
public class MyComparer : IComparer<string>
{
int IComparer<string>.Compare(string x, string y)
{
if (x == y)
{
return 0;
}
if (x.Contains(y))
{
return -1;
}
else
{
return 1;
}
}
}
All model that have V or H now are on the end of Dcitionary. It's works very well. Because first solr searched Nokian;Line and this product where found add to other list alreadyFound and skip this product where found model. Thanks all for your reply.
I have a datastore model representing items in an ecommerce site:
class Item(db.Model):
CSIN = db.IntegerProperty()
name = db.StringProperty()
price = db.IntegerProperty()
quantity = db.IntegerProperty()
Is there some way to enforce integrity constraints? For instance, I would like to make sure that quantity is never set to be less than 0.
The Property constructor lets you specify a function with the 'validator' named argument. This function should take one argument, the value, and raise an exception if the valid is invalid. For example:
def range_validator(minval, maxval):
def validator(v):
if (minval is not None and v < minval) or (maxval is not None and v > maxval):
raise ValueError("Value %s outside range (%s, %s)" % (v, minval, maxval))
return validator
class Item(db.Model):
CSIN = db.IntegerProperty()
name = db.StringProperty()
price = db.IntegerProperty()
quantity = db.IntegerProperty(validator=range_validator(0, None))
Note that the example uses a nested function to define general-purpose validators - you can, of course, use simple functions if you want to write a more special purpose validator.