Jackrabbit Sql2-Query -> DescendantNodeJoinCondition - jackrabbit

idb:photo
idb:uploadName jcr:primaryType="idbt:metaData" idb:value="4.jpg"
idb:size jcr:primaryType="idbt:metaData" idb:value="276757"
idb:title jcr:primaryType="idbt:metaData" idb:value="Title: 4.jpg"
idb:photo>
first of all i cant see my code example!
-> clicked on {} and filed in my code!
i would like to get the information of a photo-node where for example the title is
Title: 4.jpg
i have the following query:
Query query = queryManager.createQuery("select * from [idbt:photo] as p inner join [idbt:metaData] as c on isdescendantnode(p, c) where c.[idb:value] = 'Title: 4.jpg'", Query.JCR_SQL2);
my resultset is empty. it should be filled with my matched node!
what is wrong?
Greetings

I don't understand how the nodes are stored. Is it metadata-node/photo-node OR photo-node/metadata-node?
In the Query you have isdescendantnode(descendent, parent), don't you? Is it a child node? have you tried ischildnode?. Take a look at http://www.h2database.com/jcr/grammar.html#join
What version of JackRabbit are you using? How do you know that the result is empty? If for some reason you are using query.execute().getRows.getSize() to try to get the total number of results first, look at this https://issues.apache.org/jira/browse/JCR-2765

Related

How can we create test record for "WebStoreNetwork" object in test class?-

I need to create record of WebStoreNetwork in my test class.
SELECT WebStoreId
FROM WebStoreNetwork
WHERE NetworkId = :communityId
WITH SECURITY_ENFORCED
This is the query which is not getting covered in my test class. I am getting value in communityId variable in test class. Facing error "List has no rows to assignment".
Does anyone have any idea? Thanks.
I suggest you post to Salesforce StackExchange.
But a direct answer is that as of Dec-2022 is not possible.
As of the next release, it should be: see Spring'23 release notes.

Gremlin: The provided traverser does not map to a value

g.V()
.has('atom', '_value', 'red').fold()
.coalesce(unfold(), addV('atom').property('_value', 'red')).as('atom')
.out('view').has('view', '_name', 'color').fold()
.coalesce(unfold(), addE('view').from('atom').to(addV('view').property('_name', 'color')))
Gives me an error:
The provided traverser does not map to a value: []->[SelectOneStep(last,atom)] (597)
What does it mean?
Adding to this in case someone else comes across this.
This specific error occurs when you use the id as a string in from() instead of the vertex object.
To see what I mean, as a simple test run the following gremlin query:
g.addE('view').from('atom').to(addV('view').property('_name', 'color'))
then run this query:
g.addE('view').from(V('atom')).to(addV('view').property('_name', 'color'))
The first query will give you the error stated above, the second one will not.
So it looks like when as() is followed by fold() it deletes the variable set in the as() step. I used aggregate() instead as follows:
g.V()
.has('atom', '_value', 'red')
.fold().coalesce(
unfold(),
addV('atom').property('_value', 'red')
)
.aggregate('atom')
.out('view').has('view', '_name', 'color')
.fold().coalesce(
unfold(),
addE('view')
.from(select('atom').unfold())
.to(addV('view').property('_name', 'color'))
.inV()
)
The as() step is what is known as a reducing barrier step. With reducing barrier steps any path history of a query (such as applying a label via as()) is lost. In reducing barrier steps many paths are reduced down to a single path. After that step there would be no way to know which of the many original labeled vertices would be the correct one to retrieve.

viewcriteria is not working for data having word "and"

i am working with applying view criteria programaticlly, till now it was fine, but when i searched with "develop and unit test" it is showing 0 records even though my table having data. iam using like operator. could any one help on this .
i have one table, having option to filter by providing select combo box list of vales, for every column when i select any thing in lov in value change listener i am applying viewcriteria programatically on table vo.
note. every thing is programatic view object only there is no point of entity, or sql
Sample Code:
DCIteratorBinding bindIterator = ADFUtils.findIterator("Tri2EWS_ETKAPIData_VO1Iterator");//Table viewObject(programatic)
Tri2EWS_ETKAPIData_VOImpl voimpl = (Tri2EWS_ETKAPIData_VOImpl) bindIterator.getViewObject();
ViewCriteria viewCriteria = voimpl.createViewCriteria();
viewCriteria.setName("MyVc");
ViewCriteriaRow viewCriteriaRow = viewCriteria.createViewCriteriaRow();
viewCriteriaRow.setOperator("ViewAttr1", "LIKE");
viewCriteriaRow.setAttribute("ViewAttr1", "stack and OverFlow");
viewCriteria.add(viewCriteriaRow);
viewCriteria.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);
voimpl.applyViewCriteria(viewCriteria, true);
voimpl.executeQuery();
voipmpl.getRowCount();//Getting 0 here (Actually i should get 1)
Turn on debug messages for ADF BC (jbo.debugoutput) so you can see the SQL that is being generated.
This will help you figure out if the query is correctly formatted.

Search db Code Igniter string contained

I'm trying to do a "searcher" in code igniter and I'm new on it. I know I can do:
$query= $this->db->get_where('products', array('producto_nombre' => 'Arenal');
To get the exact coincidences. What can I do if I want to get on my query every partial coincidence, I mean, I want to get the product "Arenal" and also the product "Arenal Sound" and so.
try LIKE instead of WHERE
$this->db->like('producto_nombre', 'Arenal', 'both');
$query = $this->db->get('products');
Looking for Similar Data - codeigniter.com

Cypher Query: All actors who have played in the same movie as Hugo Weaving

I'm trying to learn Cypher.
In their online console, I am trying to write a query that will give me all the actors (label "Person") who have played in the same movie as Hugo Weaving.
Based on what I've read so far, this should work:
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)-[:ACTED_IN]->(hugo:Person{Name:"Hugo Weaving"})
RETURN p.Name
However, it is not.
I've also tried:
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE (:Person{Name:"Hugo Weaving"})-[:ACTED_IN]->(m)
RETURN p.Name
But again - no avail.
Does anyone know what I'm doing wrong?
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(hugo:Person{name:"Hugo Weaving"})
RETURN p.name
direction of the relation in your query (m:Movie)<-[:ACTED_IN]-(hugo:Person is causing the problem

Resources