Weird Propety missing error

16 views
Skip to first unread message

David

unread,
May 28, 2012, 12:32:40 PM5/28/12
to Gremlin-users
Hello, I'm having a very "interesting" problem where this exception is
randomly thrown in successive runs of a groovy unit test. I special
classes("SubGraph extends Graph, Element". . ." and "MyVertex extends
Vertex") that implement Tinkerpop interfaces as specified. Here is
the groovy unit test:

@Test
public void testSubgraphSearch(){

ApplicationContext context = new
ClassPathXmlApplicationContext("context.xml");
SearchService service = context.getBean("SearchService",
SearchService.class);
SubGraphs graphs = new SubGraphs(service);
Gremlin.load();

subgraph = graphs.SubGraph{vertex ->
vertex.person.names.type.is('Legal Name')}.V

for(MyVertex vertex in subgraph){
println(vertex.id + "has keys:");
println("....names are: " + vertex.names.fullName);
Assert.assertTrue(vertex.names != null);
}
}

.
.
The method SubGraph returns a single SubGraph object with hooks into
the search service. The vertex argument, in the closure, binds to
this SubGraph object and calls the propertyMissing method that is
attached by the Element.load() call. I designed the getProperty(...)
call in such a way so that it builds up a lucene query to pass to a
solr search-service. The is(...) method calls the service.

About half the time, this test works. The other half of the time I
get the following error:

groovy.lang.MissingPropertyException: No such property: person for
class: com.myCompany.SubGraph
.
.
.
This obviously indicates that the Element.metaClass.propertyMissing
method is not defined (half the time). . .or it's not being called for
whatever reason. It's also worth noting that the searchService takes
a while to spool up (lots of beans in the ApplicationContext). Spring
does a lot of weird stuff. . .maybe it's the issue?


-David

David

unread,
May 28, 2012, 3:40:40 PM5/28/12
to Gremlin-users
After a little debugging, I discovered that both Graph and Element
have propertyMissing closures defined for them in GraphLoader and
ElementLoader respectively. . .since I was implementing both, I needed
a deconflict layer.

Marko Rodriguez

unread,
May 28, 2012, 4:11:02 PM5/28/12
to gremli...@googlegroups.com
Hello,

Yes. They make use of propertyMissing for things like:

type -> property('type')
g.V
g.E

This conflicts with Spring?

Marko.

http://markorodriguez.com

David Garcia

unread,
May 29, 2012, 3:31:56 PM5/29/12
to gremli...@googlegroups.com
No it doesn't.  I've just been bitten by spring so often that I often look for any excuse to put that dog down.  The propertyMissing thing is pretty cool.  I'm leveraging it to deal with a database that supports multiple taxonomies and complex properties.  This is pretty good work.  thx for doing a great job!!

-David
Reply all
Reply to author
Forward
0 new messages