pfunc的编译首先是在生成plan过程中,将query string 变成op的过程中把表示pfunc的triple变成pfunc的格式
1 2 3 4 5
|
(bgp (triple ?x <http://example/f#search> "EF")) 变为 (propfunc <http://example/f#search> ?x "EF" (table unit))
|
triple变成pfunc是在翻译Algebra的optimize函数中,具体在PropertyFunctionGenerator.compilePattern
他会通过ProoertyFunctionRegistry.manages确定是不是pfunc,将是的triple都加入propertyFunctionTriples,并在makeStages里修改生成最终op。
将triple翻译成op后,执行前pfunc的翻译是在ProcEval.build做的。
1 2 3 4 5 6 7 8 9 10
|
public static Procedure (Node procId, PropFuncArg subjArg, PropFuncArg objArg, ExecutionContext execCxt) { Context context = execCxt.getContext() ; PropertyFunctionRegistry reg = PropertyFunctionRegistry.chooseRegistry(context) ; PropertyFunctionFactory f = reg.get(procId.getURI()) ; PropertyFunction pf = f.create(procId.getURI()) ; pf.build(subjArg, procId, objArg, execCxt) ; return new ProcedurePF(pf, subjArg, procId, objArg) ; }
|
通过registry拿到最终的pFuncFactory,然后将该方法调出来。
本文采用创作共用保留署名-非商业-禁止演绎4.0国际许可证,欢迎转载,但转载请注明来自http://thousandhu.github.io,并保持转载后文章内容的完整。本人保留所有版权相关权利。
本文链接:http://thousandhu.github.io/2016/04/28/propertyFunc-内部编译和调用过程/
近期评论