Propertyfunctions and non-native bindings

Is it possible to get a property function to return a binding for a value that isn’t present in the database? I’m inclined to say no because I need to map the value back to a long when you return the solution and if it isn’t in the database you don’t have a mapping. I’m guessing you can do it with integers since they’re inlined. (I think)…but on the other hand that’s what virtual graphs do so I suspect that there may be a way to do it.

This is probably a bad example but supposed I wanted to write a property function that retrieved the quote of the day from some index/service/etc

(?year ?month ?day) mypf:quoteOfTheDay (?quote ?author)

that returned “an apple a day keeps the doctor away”. How do I map that string back to a long?

Thanks.

PS: Would calling add() on the MappingDictionary be enough to add the mapping for the scope of the query?

Hi Zach, apologies for the delay here…

Yes, you should be able to add your mapping to the MappingDictionary, which is available via the ExecutionContext in the Operator implementation of the PropertyFunction. It sounds like you may have already figured that much out, but I still thought it nice to confirm. Are you still having issues after doing that?

No worries. Thanks for the reply. I’ll give it a try and let you know. I
feel like I’m making progress but I still have some things I don’t feel
like I quite grok yet. It’s a little tough to see exactly why or what needs
to be done just from Mike’s example. The code is great but it’s just a
little hard to mentally visualize the internals just from the example. I
see that most of it is boilerplate and the meat of it is in the
PropertyFunctionOperator computeNext method.

I’m a little confused on the operators. In the example the Operator passed to PropertyFunctionOperator is commented as being the child operator but can’t an operator have multiple children? Or is it that a node has two children, this is one and the argument is the other child which would make them siblings? The argument is made optional so if it’s null does that indicate that it’s a leaf node? Under what circumstances would a child operator be an instance of EmptyOperator?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.