def register(): prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("pos", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.addMonotonicInputPredicate(0) # prop.setAtomlevellinear(True) dlvhex.addAtom("id2", (dlvhex.PREDICATE, dlvhex.CONSTANT), 1, prop)
def register(): prop = dlvhex.ExtSourceProperties() # setdiff is monotonic in input predicate 0 and antimonotonic in input predicate 1 prop.addMonotonicInputPredicate(0) prop.addAntimonotonicInputPredicate(1) # output element 0 can only contain values which appear in the first input predicate prop.addRelativeFiniteOutputDomain(0, 0) # setdiff has two predicate input parametrers and its output arity is 1 dlvhex.addAtom("setdiff", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop)
def register(): prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) prop.addFiniteOutputDomain(1) prop.addFiniteOutputDomain(2) dlvhex.addAtom("rdf", (dlvhex.CONSTANT, ), 3, prop) prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1, prop)
def register(): reg_dyadic('pyForward') dlvhex.addAtom('pyRank8', (dlvhex.CONSTANT, dlvhex.CONSTANT), 0, get_prop()) dlvhex.addAtom('pyPawn', (dlvhex.CONSTANT, dlvhex.CONSTANT), 0, get_prop()) reg_dyadic('pyHead') reg_dyadic('pyTail') dlvhex.addAtom('pyEmpty', (dlvhex.CONSTANT, ), 0, get_prop()) dlvhex.addAtom('pyPiece', (dlvhex.CONSTANT, ), 0, get_prop()) reg_triadic('pyPrepend') dlvhex.addAtom('pyDbg', (dlvhex.CONSTANT, ), 0, get_prop())
def register(arguments): logging.info("Java API loaded with arguments %s", arguments) global loadedPlugins for classname in arguments: logging.info("loading Java Plugin %s", classname) try: jclass = jpype.JClass(classname) assert (jclass is not None) logging.debug("instantiating Plugin") jinst = jclass() assert (jinst is not None) jholder = JavaPluginHolder(classname, jinst) assert (jholder is not None) loadedPlugins.append(jholder) logging.info("registering atoms of plugin %s with name %s", classname, jinst.getName()) for jpluginatom in jholder.jplugin.createAtoms(): pred = str(jpluginatom.getPredicate()) inputArguments = jpluginatom.getInputArguments() outputArguments = jpluginatom.getOutputArguments() jesp = jpluginatom.getExtSourceProperties() prop = convertExtSourceProperties(jesp) if pred in globals(): logging.error( "trying to override '%s' in globals - duplicate external atom name or conflict with python internal names", pred) else: globals()[pred] = JavaPluginCallWrapper( pred, jholder, jpluginatom) dlvhex.addAtom(pred, convertInputArguments(inputArguments), int(outputArguments), prop) except JException as e: logJavaExceptionWithStacktrace(e) raise logging.info("loaded %d Java plugins", len(loadedPlugins))
def register(): # setdiff has two predicate input parameters # and its output arity is 1 dlvhex.addAtom("setdiff", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) # concat has arbitrarily many input parameters # of type constant (=TUPLE) and its output arity is 1 dlvhex.addAtom("concat", (dlvhex.TUPLE,), 1) # sortandmap has two predicate input parameters # and its output arity is 2 dlvhex.addAtom("sortandmap", (dlvhex.PREDICATE, dlvhex.PREDICATE), 2)
def register(): prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) prop.addFiniteOutputDomain(1) prop.addFiniteOutputDomain(2) prop.addFiniteOutputDomain(3) dlvhex.addAtom("route", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT ), 4, prop) prop = dlvhex.ExtSourceProperties() prop.addMonotonicInputPredicate(0) prop.setProvidesPartialAnswer(True) dlvhex.addAtom("needRestaurant", (dlvhex.PREDICATE, dlvhex.CONSTANT ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setFunctional(True) dlvhex.addAtom("getJSON", (dlvhex.CONSTANT, dlvhex.TUPLE ), 1, prop)
def register(): prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("pos", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop)
def register(): dlvhex.addAtom("needFuel", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0)
def register(): dlvhex.addAtom("multiply", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("test", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 2) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("id", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("neg", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("aOrNotB", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("parity", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("fibonacci", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1) prop = dlvhex.ExtSourceProperties() prop.addMonotonicInputPredicate(0) prop.addAntimonotonicInputPredicate(1) dlvhex.addAtom("testSetMinus", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) dlvhex.addAtom("testSetMinus2", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) # prop.addMonotonicInputPredicate(0) # prop.addAntimonotonicInputPredicate(1) prop.addAtomDependency(0, 0, 0) prop.addAtomDependency(1, 0, 0) dlvhex.addAtom("testSetMinusPartial", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("contains", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.setComplianceCheck(1) prop.addFiniteOutputDomain(0) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("adjacent", (dlvhex.CONSTANT, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.setComplianceCheck(2) dlvhex.addAtom("pick", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.PREDICATE), 3, prop) prop = dlvhex.ExtSourceProperties() dlvhex.addAtom("fair", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("isEmpty", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("numberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addAntimonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("partialTest", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("date", (), 1) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("satCheck", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("pseudoBoolean", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("generalizedSubsetSum", (dlvhex.PREDICATE, dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("subgraph", (dlvhex.PREDICATE, dlvhex.PREDICATE), 2, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("preferences", (dlvhex.PREDICATE, dlvhex.PREDICATE), 2, prop) prop = dlvhex.ExtSourceProperties() dlvhex.addAtom("greater", (dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("sizeDist", (dlvhex.PREDICATE, dlvhex.PREDICATE, dlvhex.CONSTANT), 2, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("strategicConflict", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("controls", (dlvhex.PREDICATE, ), 2, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("controlsMajority", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("controlsMajorityWithMax", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("controlsMajorityNonmonotonic", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) #prop.addMonotonicInputPredicate(0) #prop.addMonotonicInputPredicate(1) dlvhex.addAtom("strategic", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("idPartial", (dlvhex.PREDICATE, ), 1, prop) dlvhex.addAtom("greaterOrEqual", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0) prop = dlvhex.ExtSourceProperties() prop.addWellorderingStrlen(0, 0) dlvhex.addAtom("tail", (dlvhex.CONSTANT, ), 1, prop) dlvhex.addAtom("cnt", (dlvhex.PREDICATE, ), 1)
def register(): prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) dlvhex.addAtom("edges", (dlvhex.CONSTANT, ), 1, prop) dlvhex.addAtom("check", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT), 0)
def register(): #XFAIL = expected failure dlvhex.addAtom("testA", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testB", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) dlvhex.addAtom("testC", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testZeroArity0", tuple(), 0) dlvhex.addAtom("testZeroArity1", tuple(), 0) #XFAIL unused dlvhex.addAtom("testConcatAll", (dlvhex.PREDICATE,), 1) #unused dlvhex.addAtom("testListDomain", (dlvhex.TUPLE,), 1) #unused dlvhex.addAtom("testListConcat", (dlvhex.TUPLE,), 1) #unused dlvhex.addAtom("testListLength", (dlvhex.CONSTANT,dlvhex.CONSTANT), 1) #unused dlvhex.addAtom("testListSplit", (dlvhex.CONSTANT,dlvhex.CONSTANT), 2) #unused dlvhex.addAtom("testListHalf", (dlvhex.CONSTANT,), 2) #unused dlvhex.addAtom("testListMerge", (dlvhex.CONSTANT,dlvhex.CONSTANT,dlvhex.CONSTANT), 2) dlvhex.addAtom("testSubstr", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("testStrlen", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("testSmallerThan", (dlvhex.CONSTANT, dlvhex.CONSTANT), 0) dlvhex.addAtom("testEven", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0) #unused dlvhex.addAtom("testOdd", (dlvhex.PREDICATE,dlvhex.PREDICATE), 0) #unused dlvhex.addAtom("testLessThan", (dlvhex.PREDICATE,dlvhex.PREDICATE), 0) #unused dlvhex.addAtom("testEqual", (dlvhex.PREDICATE,dlvhex.PREDICATE), 0) dlvhex.addAtom("id", (dlvhex.PREDICATE, ), 1) #XFAIL partial dlvhex.addAtom("idp", (dlvhex.PREDICATE,), 1) dlvhex.addAtom("idc", (dlvhex.CONSTANT, ), 1) #TODO testCautiousQuery dlvhex.addAtom("testSetMinus", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) dlvhex.addAtom("testSetMinus2", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) dlvhex.addAtom("testNonmon", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testNonmon2", (dlvhex.PREDICATE, ), 1) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("isEmpty", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("testIsEmpty", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("numberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("testNumberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addAntimonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("testNumberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("testNumberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("partialTest", (dlvhex.PREDICATE, ), 0, prop) #XFAIL (TODO) sumD0 #XFAIL getreq #unused mapping #unused getSizes #unused getSizesRestr #XFAIL getDiagnoses prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) dlvhex.addAtom("testConcat", (dlvhex.TUPLE, ), 1, prop) dlvhex.addAtom("functionCompose", (dlvhex.TUPLE, ), 1) dlvhex.addAtom("functionDecompose", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("functionDecompose1", (dlvhex.CONSTANT, ), 2) dlvhex.addAtom("functionDecompose2", (dlvhex.CONSTANT, ), 3) dlvhex.addAtom("functionDecompose3", (dlvhex.CONSTANT, ), 4) dlvhex.addAtom("getArity", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("isFunctionTerm", (dlvhex.CONSTANT, ), 0) dlvhex.addAtom("rdf", (dlvhex.CONSTANT, ), 3)
def register(): dlvhex.addAtom("get_routes", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT), 3) dlvhex.addAtom("get_routes_data", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT), 3) dlvhex.addAtom("get_max_pollution", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("get_parking_spaces", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("get_availability", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("get_total_cost", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("get_walking_distance", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1)
def register(): # concat has arbitrarily many input parameters # of type constant (=TUPLE) and its output arity is 1 dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1)
def register(): dlvhex.addAtom("multiply", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("test", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 2) dlvhex.addAtom("fibonacci", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1) prop = dlvhex.ExtSourceProperties() prop.addMonotonicInputPredicate(0) prop.addAntimonotonicInputPredicate(1) dlvhex.addAtom("testSetMinus", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) dlvhex.addAtom("testSetMinus2", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) dlvhex.addAtom("date", (), 1)
def register(): dlvhex.addAtom("id", (dlvhex.PREDICATE, ), 1)
def register(): prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) # specify that the graph is finite dlvhex.addAtom("friendsOfDegree", (dlvhex.CONSTANT,), 1, prop)
def reg_dyadic(name): dlvhex.addAtom(name, (dlvhex.CONSTANT, ), 1, get_prop())
def register(): dlvhex.addAtom("multiply", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("test", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 2) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("id", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("neg", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("aOrNotB", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("parity", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("fibonacci", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1) prop = dlvhex.ExtSourceProperties() prop.addMonotonicInputPredicate(0) prop.addAntimonotonicInputPredicate(1) dlvhex.addAtom("testSetMinus", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) dlvhex.addAtom("testSetMinus2", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) # prop.addMonotonicInputPredicate(0) # prop.addAntimonotonicInputPredicate(1) dlvhex.addAtom("testSetMinusPartial", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("isEmpty", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("numberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addAntimonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("partialTest", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("date", (), 1) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("satCheck", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("pseudoBoolean", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("generalizedSubsetSum", (dlvhex.PREDICATE, dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("strategicConflict", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("controls", (dlvhex.PREDICATE, ), 2, prop) dlvhex.addAtom("greaterOrEqual", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0) prop = dlvhex.ExtSourceProperties() prop.addWellorderingStrlen(0, 0) dlvhex.addAtom("tail", (dlvhex.CONSTANT, ), 1, prop)
def register(arguments=None): if arguments == ['foo', '3']: sys.stdout.write("testplugin loaded with arguments %s" % str(arguments)) if arguments == ['jsonout']: dlvhex.registerModelCallbackClass(JSONModelCallback) #XFAIL = expected failure dlvhex.addAtom("testA", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testB", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) dlvhex.addAtom("testC", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testZeroArity0", tuple(), 0) dlvhex.addAtom("testZeroArity1", tuple(), 0) #XFAIL unused dlvhex.addAtom("testConcatAll", (dlvhex.PREDICATE,), 1) #unused dlvhex.addAtom("testListDomain", (dlvhex.TUPLE,), 1) #unused dlvhex.addAtom("testListConcat", (dlvhex.TUPLE,), 1) #unused dlvhex.addAtom("testListLength", (dlvhex.CONSTANT,dlvhex.CONSTANT), 1) #unused dlvhex.addAtom("testListSplit", (dlvhex.CONSTANT,dlvhex.CONSTANT), 2) #unused dlvhex.addAtom("testListHalf", (dlvhex.CONSTANT,), 2) #unused dlvhex.addAtom("testListMerge", (dlvhex.CONSTANT,dlvhex.CONSTANT,dlvhex.CONSTANT), 2) dlvhex.addAtom("testSubstr", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("testStrlen", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("testSmallerThan", (dlvhex.CONSTANT, dlvhex.CONSTANT), 0) dlvhex.addAtom("testEven", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0) #unused dlvhex.addAtom("testOdd", (dlvhex.PREDICATE,dlvhex.PREDICATE), 0) #unused dlvhex.addAtom("testLessThan", (dlvhex.PREDICATE,dlvhex.PREDICATE), 0) #unused dlvhex.addAtom("testEqual", (dlvhex.PREDICATE,dlvhex.PREDICATE), 0) dlvhex.addAtom("id", (dlvhex.PREDICATE, ), 1) #XFAIL partial dlvhex.addAtom("idp", (dlvhex.PREDICATE,), 1) dlvhex.addAtom("idc", (dlvhex.CONSTANT, ), 1) #TODO testCautiousQuery dlvhex.addAtom("testSetMinus", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) dlvhex.addAtom("testSetMinusLearn", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1) dlvhex.addAtom("testNonmon", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testNonmon2", (dlvhex.PREDICATE, ), 1) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("isEmpty", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("testIsEmpty", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("numberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("testNumberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addAntimonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("testNumberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("testNumberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("partialTest", (dlvhex.PREDICATE, ), 0, prop) # someSelected and variations dlvhex.addAtom("someSelected", (dlvhex.PREDICATE, ), 0) dlvhex.addAtom("someSelectedLearning", (dlvhex.PREDICATE, ), 0) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("someSelectedPartial", (dlvhex.PREDICATE, ), 0, prop) #XFAIL (TODO) sumD0 #XFAIL getreq #unused mapping #unused getSizes #unused getSizesRestr #XFAIL getDiagnoses prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) dlvhex.addAtom("testConcat", (dlvhex.TUPLE, ), 1, prop) dlvhex.addAtom("functionCompose", (dlvhex.TUPLE, ), 1) dlvhex.addAtom("functionDecompose", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("functionDecompose1", (dlvhex.CONSTANT, ), 2) dlvhex.addAtom("functionDecompose2", (dlvhex.CONSTANT, ), 3) dlvhex.addAtom("functionDecompose3", (dlvhex.CONSTANT, ), 4) dlvhex.addAtom("getArity", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("isFunctionTerm", (dlvhex.CONSTANT, ), 0) dlvhex.addAtom("rdf", (dlvhex.CONSTANT, ), 3) dlvhex.addAtom("issue_2_num", (dlvhex.PREDICATE, ), 1) dlvhex.addAtom("testArity1OneTupleA", (), 1) dlvhex.addAtom("testArity1OneTupleB", (), 1) dlvhex.addAtom("testArity1TwoTuples", (), 1) dlvhex.addAtom("testStoreParseable", (dlvhex.CONSTANT, ), 1)
def reg_monadic(name): dlvhex.addAtom(name, (dlvhex.CONSTANT, ), 0, get_prop())
def register(): dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1)
def register(): prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain(0) dlvhex.addAtom("friendsOfDegree", (dlvhex.CONSTANT, ), 1, prop)
def register(): prop = dlvhex.ExtSourceProperties() # specify that "edges" produces finite set of output tuples prop.addFiniteOutputDomain(0) dlvhex.addAtom("edges", (dlvhex.CONSTANT, dlvhex.CONSTANT), 2, prop)
def register(): prop = dlvhex.ExtSourceProperties() prop.addFiniteOutputDomain ( 0 ) dlvhex.addAtom("edges",(dlvhex.CONSTANT,), 1, prop) dlvhex.addAtom("check",(dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.CONSTANT,), 1, prop)
def reg_triadic(name): dlvhex.addAtom(name, (dlvhex.CONSTANT, dlvhex.CONSTANT), 1, get_prop())
def register(): dlvhex.addAtom("test", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 2) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("neg", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("aOrNotB", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("parity", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("fibonacci", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("date", (), 1) prop = dlvhex.ExtSourceProperties() dlvhex.addAtom("greater", (dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) dlvhex.addAtom("greaterOrEqual", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0) prop = dlvhex.ExtSourceProperties() prop.addWellorderingStrlen(0, 0) dlvhex.addAtom("tail", (dlvhex.CONSTANT, ), 1, prop) dlvhex.addAtom("cnt", (dlvhex.PREDICATE, ), 1)
def register(): """Registers the external predicate into DLVHEX.""" dlvhex.addAtom("isCollision", (dlvhex.PREDICATE, ), 0)
def register(): dlvhex.addAtom("multiply", (dlvhex.CONSTANT, dlvhex.CONSTANT), 1) dlvhex.addAtom("test", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 2) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("id", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("neg", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("aOrNotB", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setSupportSets(True) prop.setCompletePositiveSupportSets(True) dlvhex.addAtom("parity", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("fibonacci", (dlvhex.CONSTANT, ), 1) dlvhex.addAtom("concat", (dlvhex.TUPLE, ), 1) prop = dlvhex.ExtSourceProperties() prop.addMonotonicInputPredicate(0) prop.addAntimonotonicInputPredicate(1) dlvhex.addAtom("testSetMinus", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) dlvhex.addAtom("testSetMinus2", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) # prop.addMonotonicInputPredicate(0) # prop.addAntimonotonicInputPredicate(1) prop.addAtomDependency(0,0,0) prop.addAtomDependency(1,0,0) dlvhex.addAtom("testSetMinusPartial", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("contains", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.setComplianceCheck(1) prop.addFiniteOutputDomain(0) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("adjacent", (dlvhex.CONSTANT, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.setComplianceCheck(2) dlvhex.addAtom("pick", (dlvhex.CONSTANT, dlvhex.CONSTANT, dlvhex.PREDICATE), 3, prop) prop = dlvhex.ExtSourceProperties() dlvhex.addAtom("fair", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("isEmpty", (dlvhex.PREDICATE, ), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("numberOfBalls", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addAntimonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsSE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("numberOfBallsGE", (dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("partialTest", (dlvhex.PREDICATE, ), 0, prop) dlvhex.addAtom("date", (), 1) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("satCheck", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("pseudoBoolean", (dlvhex.CONSTANT, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("generalizedSubsetSum", (dlvhex.PREDICATE, dlvhex.PREDICATE, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("subgraph", (dlvhex.PREDICATE, dlvhex.PREDICATE), 2, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("preferences", (dlvhex.PREDICATE, dlvhex.PREDICATE), 2, prop) prop = dlvhex.ExtSourceProperties() dlvhex.addAtom("greater", (dlvhex.CONSTANT, dlvhex.CONSTANT), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("sizeDist", (dlvhex.PREDICATE, dlvhex.PREDICATE, dlvhex.CONSTANT), 2, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("strategicConflict", (dlvhex.PREDICATE, dlvhex.PREDICATE), 0, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) dlvhex.addAtom("controls", (dlvhex.PREDICATE, ), 2, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("controlsMajority", (dlvhex.PREDICATE, dlvhex.PREDICATE ), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("controlsMajorityWithMax", (dlvhex.PREDICATE, dlvhex.PREDICATE ), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) dlvhex.addAtom("controlsMajorityNonmonotonic", (dlvhex.PREDICATE, dlvhex.PREDICATE ), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) #prop.addMonotonicInputPredicate(0) #prop.addMonotonicInputPredicate(1) dlvhex.addAtom("strategic", (dlvhex.PREDICATE, dlvhex.PREDICATE), 1, prop) prop = dlvhex.ExtSourceProperties() prop.setProvidesPartialAnswer(True) prop.addMonotonicInputPredicate(0) prop.addMonotonicInputPredicate(1) dlvhex.addAtom("idPartial", (dlvhex.PREDICATE,), 1, prop) dlvhex.addAtom("greaterOrEqual", (dlvhex.PREDICATE, dlvhex.CONSTANT, dlvhex.CONSTANT), 0) prop = dlvhex.ExtSourceProperties() prop.addWellorderingStrlen(0, 0) dlvhex.addAtom("tail", (dlvhex.CONSTANT, ), 1, prop) dlvhex.addAtom("cnt", (dlvhex.PREDICATE, ), 1)