How to use Interface Example.PropertySelector - java

I want to use PropertySelector in Example in hibernate but I didn't find any example on net that guide how to use it.
I found document here http://docs.jboss.org/hibernate/orm/3.5/javadoc/org/hibernate/criterion/Example.PropertySelector.html
Basically what I am trying to do is
Example example = Example.create(user);
PropertySelector propertySelector;
propertySelector.include(user, "emailId", org.hibernate.type.Type);
It gives error org.hibernate.type.Type cannot be resolved to a variable, so what to use in third argument?

Related

setContextPath() not found

I am trying to use the library Porcupine on Android. I have now downloaded a Rhino context file (.rhn) but can't find a way how to implement that file into my code.
The documentation says that I should use setContextPath() but this gives me the error:
Cannot resolve method 'setContextPath' in 'Builder'
That's how I tried it:
try {
porcupineManager = new PorcupineManager.Builder()
.setModelPath("porcupine_params_de.pv")
.setAccessKey(ACCESS_KEY)
.setKeywordPath("my_file_de_android_v2_0_0.ppn")
.setContextPath("my_file_de_android_v2_0_0.rhn");
.setSensitivity(0.7f).build(
getApplicationContext(),
porcupineManagerCallback);
porcupineManager.start();
}
...
I don't know what this method is good for since I can't even find it in its class.
So how can I use my .rhn file?
In the sample code from the link you provide, this method is called on different class:
PicovoiceManager picovoiceManager = new PicovoiceManager.Builder()
.setAccessKey("${ACCESS_KEY}")
.setKeywordPath("${KEYWORD_FILE_PATH}")
.setWakeWordCallback(wakeWordCallback)
.setContextPath("${CONTEXT_FILE_PATH}")
.setInferenceCallback(inferenceCallback)
.build(context);
you use PorcupineManager while sample code uses PicovoiceManager.

SmartEdit setup in spartacus

I am trying to setup SmartEdit in our spartacusstorefront. We use a customized extension which is based on spartacussampledataaddon.
Followed in the instructions in: https://sap.github.io/spartacus-docs/smartEdit-setup-instructions-for-spartacus/
But in smartedit, we get this error:
No component factory found for SmarteditElementComponent. Did you add it to #NgModule.entryComponents
Any pointers
This error actually does not relate to Spartacus, it's a SmartEdit edit error instead. The SmartEdit team is not watching this channel, so Id recommend to use existing help/support/consultant channels to fix your issue.

How to Query search index on cloudant using java?

I am newbie for cloudant and trying to learn full text search on cloudant through tutorial video. I am successful in searching on the cloudant.com through http request ,Now I want that code to be in java as i am working on GWT framework with java. Till now , I am just able to create connection with cloudant.com by studying the particular github project GITHUBLINK
There its given for search like this
Search search = db.search("views101/animals");
SearchResult<Animal> rslt = search
.limit(10)
.includeDocs(true)
.counts(new String[] {"class","diet"})
.querySearchResult("l*", Animal.class);
My Questions:
1. what exactly is this Animal.class refer to?
2. If this not the way what are the steps for full text search on cloudant.
I have created the view and the search index manually on cloudant.com under a designdoc of a database.
Animal.class refers to the class that the documents found will be deserialised into, if you do not have a class to deserialise the data into, you should be able to a HashMap or similar class to access the data returned.
You can find the example source code for the Animal class in this location: https://github.com/cloudant/java-cloudant/blob/88202a1bd7b9b04d96c4b7b8498a1b8f7f99c9e5/src/test/java/com/cloudant/tests/Animal.java.
Like the previous answer indicated, you could also have the results returned as a generic JsonObject that provides access to the properties and values.

How to use OWL.INVERSEOF using Openrdf in Java

I am trying to create some statements and their inverse in Java using OpenRDF's Sesame. I am following the tutorial in the Sesame 2.7 documentation as well. Let's say I have created the following URIs and statements and added them to the Sesame repository:
RepositoryConnection connection;
ValueFactory factory = ValueFactoryImpl.getInstance();
Resource author_1 = new createURI("http://www.author.org/author_1");
Resource article_1 = new createURI("http://www.title.org/article_1");
URL wrote = factory.createURI("http://www.paper.org/wrote");
URL writtenby = factory.createURI("http://www.paper.org/writtenby");
Statement statement_1 = factory.createStatement(author_1, wrote, article_1);
connection.add(statement_1);
The code above is for creating a statement to describe that an author wrote an article. In the OpenRDF Workbench, I can see this statement. What I am trying to do is to do the inverse using OWL.INVERSEOF to get that article_1 is written by author_1 as follows:
connection.add(writtenby, OWL.INVERSEOF, wrote);
When I run the project and get back to the OpenRDF Workbench, I see the following statements:
<http://www.author.org/author_1>, http://www.paper.org/wrote, http://www.title.org/article_1>
<http://www.paper.org/writtenby>, <http://www.w3.org/2002/owl#inverseOf>, <http://www.paper.org/wrote>
When I click on <http://www.paper.org/writtenby>, I can't find the inverse statement that the article_1 is written by author1 but I can find the author_1 wrote article_1. Is my way of doing this inverse wrong or do I misunderstand something with this concept? Thank you very much for your help in advance.
It is as Joshua says. OpenRDF/Sesame doesn't have support for this kind of reasoning. I think it supports only some kind of basic RDF/S reasoning during load. It also (still) doesn't support custom rules I think.
You can achieve what you are asking by using Sesame with OWLIM. OWLIM-Lite and OWLIM-SE do have support for OWL reasoning (rule-based, forward-chaining, materialization). There is a number of predefined rule sets supported by OWLIM. You would probably want owl-max.
Depending on what you are trying to achieve, you might want to use a real OWL reasoner such as Pellet. However, Sesame doesn't support Pellet...

Restlet : Unable to find a converter for this representation : [application/json,UTF-8]

I have researched this quite heavily but have been unable to find a solution. I have created the simplest unit test to fetch a single entity but am still receiving the "Unable to find converter" exception. I have included the org.restlet.ext.servlet.jar,org.json.jar and org.restlet.ext.net.jar in my class path. I am also able to see the json returned and have been able to print using the cr.get(MediaType.APPLICATION_JSON) method.
ClientResource cr = new ClientResource("http://localhost:8888/r/establishment/29");
Establishment est = cr.get(Establishment.class);
System.out.println("Establishment name is " + est.getName());
I am using restlet-gae-2.1rc6 on GAE vs 1.7.1
You need to register a converter. Example:
Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
See a question with the same solution but a different problem: Android to gae restlet example doesn't work on the Android side
I found the solution here: https://stackoverflow.com/a/5205993/435605

Categories

Resources