using arithmetic functions in custom GraphDB ruleset












0















I want to add a custom rule to the OWL-2-RL ruleset (builtin_owl2-rl.pie) that establishes a isOppositeDirectionOf object property between vectors that are in opposite direction to each other. I would think it should look something like this:



Id: oppositeDirectionVector_rule
v1 <rdf:type> <cad:Vector>
v1 <cad:x> v1x // example data property for v1x: "1.0"^^xsd:double
v1 <cad:y> v1y
v1 <cad:z> v1z
v2 <rdf:type> <cad:Vector>
v2 <cad:x> -v1x
v2 <cad:y> -v1y
v2 <cad:z> -v1z
-------------------------------
v1 <cad:isOppositeDirectionOf> v2


Without the minuses, this rule does work to create isSameVectorAs object properties.
Is there a way I can use basic arithmetic functions on data properties in rules?










share|improve this question























  • And I would also like to know if its possible to create new instances (also called individuals in Protégé) via custom rules in .pie files. I have only seen corollaries (what's below the ---- line of a rule) being used to establish new links between existing things.

    – benjaminaaron
    Nov 13 '18 at 11:35











  • I understand Constraint, but what is [Cut] and [Context] mean next to an Axiom (what's above the ---- line of a rule)? I can't seem to google that...

    – benjaminaaron
    Nov 13 '18 at 11:37











  • Context is just used to restrict the result of one rule to others is input if the share the same context.

    – AKSW
    Nov 13 '18 at 13:54











  • The syntax you used is clearly wrong. And given that something like BIND isn't possible, I don't think its currently possible. Or at least, it's not mentioned in the docs, you could try whether it works nevertheless.

    – AKSW
    Nov 13 '18 at 13:56













  • The only solution I see right now is to use a SPARQL Update query. Clearly, it's unclear how to combine this with the rule inference given that a fix-point iteration is usually done, thus, a single SPARQL query might lead to an incomplete result (very likely in my opinion, but depends on the rest of the data). Running it after the OWL RL materialization, then re-run the OWL RL materialization and compare the number triples in the triple store - that would be my way.

    – AKSW
    Nov 13 '18 at 13:59
















0















I want to add a custom rule to the OWL-2-RL ruleset (builtin_owl2-rl.pie) that establishes a isOppositeDirectionOf object property between vectors that are in opposite direction to each other. I would think it should look something like this:



Id: oppositeDirectionVector_rule
v1 <rdf:type> <cad:Vector>
v1 <cad:x> v1x // example data property for v1x: "1.0"^^xsd:double
v1 <cad:y> v1y
v1 <cad:z> v1z
v2 <rdf:type> <cad:Vector>
v2 <cad:x> -v1x
v2 <cad:y> -v1y
v2 <cad:z> -v1z
-------------------------------
v1 <cad:isOppositeDirectionOf> v2


Without the minuses, this rule does work to create isSameVectorAs object properties.
Is there a way I can use basic arithmetic functions on data properties in rules?










share|improve this question























  • And I would also like to know if its possible to create new instances (also called individuals in Protégé) via custom rules in .pie files. I have only seen corollaries (what's below the ---- line of a rule) being used to establish new links between existing things.

    – benjaminaaron
    Nov 13 '18 at 11:35











  • I understand Constraint, but what is [Cut] and [Context] mean next to an Axiom (what's above the ---- line of a rule)? I can't seem to google that...

    – benjaminaaron
    Nov 13 '18 at 11:37











  • Context is just used to restrict the result of one rule to others is input if the share the same context.

    – AKSW
    Nov 13 '18 at 13:54











  • The syntax you used is clearly wrong. And given that something like BIND isn't possible, I don't think its currently possible. Or at least, it's not mentioned in the docs, you could try whether it works nevertheless.

    – AKSW
    Nov 13 '18 at 13:56













  • The only solution I see right now is to use a SPARQL Update query. Clearly, it's unclear how to combine this with the rule inference given that a fix-point iteration is usually done, thus, a single SPARQL query might lead to an incomplete result (very likely in my opinion, but depends on the rest of the data). Running it after the OWL RL materialization, then re-run the OWL RL materialization and compare the number triples in the triple store - that would be my way.

    – AKSW
    Nov 13 '18 at 13:59














0












0








0








I want to add a custom rule to the OWL-2-RL ruleset (builtin_owl2-rl.pie) that establishes a isOppositeDirectionOf object property between vectors that are in opposite direction to each other. I would think it should look something like this:



Id: oppositeDirectionVector_rule
v1 <rdf:type> <cad:Vector>
v1 <cad:x> v1x // example data property for v1x: "1.0"^^xsd:double
v1 <cad:y> v1y
v1 <cad:z> v1z
v2 <rdf:type> <cad:Vector>
v2 <cad:x> -v1x
v2 <cad:y> -v1y
v2 <cad:z> -v1z
-------------------------------
v1 <cad:isOppositeDirectionOf> v2


Without the minuses, this rule does work to create isSameVectorAs object properties.
Is there a way I can use basic arithmetic functions on data properties in rules?










share|improve this question














I want to add a custom rule to the OWL-2-RL ruleset (builtin_owl2-rl.pie) that establishes a isOppositeDirectionOf object property between vectors that are in opposite direction to each other. I would think it should look something like this:



Id: oppositeDirectionVector_rule
v1 <rdf:type> <cad:Vector>
v1 <cad:x> v1x // example data property for v1x: "1.0"^^xsd:double
v1 <cad:y> v1y
v1 <cad:z> v1z
v2 <rdf:type> <cad:Vector>
v2 <cad:x> -v1x
v2 <cad:y> -v1y
v2 <cad:z> -v1z
-------------------------------
v1 <cad:isOppositeDirectionOf> v2


Without the minuses, this rule does work to create isSameVectorAs object properties.
Is there a way I can use basic arithmetic functions on data properties in rules?







owl rules reasoning graphdb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 11:26









benjaminaaronbenjaminaaron

32




32













  • And I would also like to know if its possible to create new instances (also called individuals in Protégé) via custom rules in .pie files. I have only seen corollaries (what's below the ---- line of a rule) being used to establish new links between existing things.

    – benjaminaaron
    Nov 13 '18 at 11:35











  • I understand Constraint, but what is [Cut] and [Context] mean next to an Axiom (what's above the ---- line of a rule)? I can't seem to google that...

    – benjaminaaron
    Nov 13 '18 at 11:37











  • Context is just used to restrict the result of one rule to others is input if the share the same context.

    – AKSW
    Nov 13 '18 at 13:54











  • The syntax you used is clearly wrong. And given that something like BIND isn't possible, I don't think its currently possible. Or at least, it's not mentioned in the docs, you could try whether it works nevertheless.

    – AKSW
    Nov 13 '18 at 13:56













  • The only solution I see right now is to use a SPARQL Update query. Clearly, it's unclear how to combine this with the rule inference given that a fix-point iteration is usually done, thus, a single SPARQL query might lead to an incomplete result (very likely in my opinion, but depends on the rest of the data). Running it after the OWL RL materialization, then re-run the OWL RL materialization and compare the number triples in the triple store - that would be my way.

    – AKSW
    Nov 13 '18 at 13:59



















  • And I would also like to know if its possible to create new instances (also called individuals in Protégé) via custom rules in .pie files. I have only seen corollaries (what's below the ---- line of a rule) being used to establish new links between existing things.

    – benjaminaaron
    Nov 13 '18 at 11:35











  • I understand Constraint, but what is [Cut] and [Context] mean next to an Axiom (what's above the ---- line of a rule)? I can't seem to google that...

    – benjaminaaron
    Nov 13 '18 at 11:37











  • Context is just used to restrict the result of one rule to others is input if the share the same context.

    – AKSW
    Nov 13 '18 at 13:54











  • The syntax you used is clearly wrong. And given that something like BIND isn't possible, I don't think its currently possible. Or at least, it's not mentioned in the docs, you could try whether it works nevertheless.

    – AKSW
    Nov 13 '18 at 13:56













  • The only solution I see right now is to use a SPARQL Update query. Clearly, it's unclear how to combine this with the rule inference given that a fix-point iteration is usually done, thus, a single SPARQL query might lead to an incomplete result (very likely in my opinion, but depends on the rest of the data). Running it after the OWL RL materialization, then re-run the OWL RL materialization and compare the number triples in the triple store - that would be my way.

    – AKSW
    Nov 13 '18 at 13:59

















And I would also like to know if its possible to create new instances (also called individuals in Protégé) via custom rules in .pie files. I have only seen corollaries (what's below the ---- line of a rule) being used to establish new links between existing things.

– benjaminaaron
Nov 13 '18 at 11:35





And I would also like to know if its possible to create new instances (also called individuals in Protégé) via custom rules in .pie files. I have only seen corollaries (what's below the ---- line of a rule) being used to establish new links between existing things.

– benjaminaaron
Nov 13 '18 at 11:35













I understand Constraint, but what is [Cut] and [Context] mean next to an Axiom (what's above the ---- line of a rule)? I can't seem to google that...

– benjaminaaron
Nov 13 '18 at 11:37





I understand Constraint, but what is [Cut] and [Context] mean next to an Axiom (what's above the ---- line of a rule)? I can't seem to google that...

– benjaminaaron
Nov 13 '18 at 11:37













Context is just used to restrict the result of one rule to others is input if the share the same context.

– AKSW
Nov 13 '18 at 13:54





Context is just used to restrict the result of one rule to others is input if the share the same context.

– AKSW
Nov 13 '18 at 13:54













The syntax you used is clearly wrong. And given that something like BIND isn't possible, I don't think its currently possible. Or at least, it's not mentioned in the docs, you could try whether it works nevertheless.

– AKSW
Nov 13 '18 at 13:56







The syntax you used is clearly wrong. And given that something like BIND isn't possible, I don't think its currently possible. Or at least, it's not mentioned in the docs, you could try whether it works nevertheless.

– AKSW
Nov 13 '18 at 13:56















The only solution I see right now is to use a SPARQL Update query. Clearly, it's unclear how to combine this with the rule inference given that a fix-point iteration is usually done, thus, a single SPARQL query might lead to an incomplete result (very likely in my opinion, but depends on the rest of the data). Running it after the OWL RL materialization, then re-run the OWL RL materialization and compare the number triples in the triple store - that would be my way.

– AKSW
Nov 13 '18 at 13:59





The only solution I see right now is to use a SPARQL Update query. Clearly, it's unclear how to combine this with the rule inference given that a fix-point iteration is usually done, thus, a single SPARQL query might lead to an incomplete result (very likely in my opinion, but depends on the rest of the data). Running it after the OWL RL materialization, then re-run the OWL RL materialization and compare the number triples in the triple store - that would be my way.

– AKSW
Nov 13 '18 at 13:59












1 Answer
1






active

oldest

votes


















0














You cannot use basic arithmetic functions in the rules. Due performance reasons the GraphDB rule engine works with the internal database identifiers, but not the actual RDF values i.e. internal id 10001 instead of "1"^^xsd:double. Thus, the only supported variable comparison operations are if the two internal identifiers are equal or not equal.



Edit following the comment below: GraphDB's Plugin API is the only mechanism to integrate your code with the database. A plugin can materialize for every statement with ?s <cad:x> ?o predicate a new statement ?s <cad:oppositeX> -?o. Unfortunately, it should handle also the deletes.






share|improve this answer


























  • I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

    – benjaminaaron
    Nov 14 '18 at 15:37













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280025%2fusing-arithmetic-functions-in-custom-graphdb-ruleset%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You cannot use basic arithmetic functions in the rules. Due performance reasons the GraphDB rule engine works with the internal database identifiers, but not the actual RDF values i.e. internal id 10001 instead of "1"^^xsd:double. Thus, the only supported variable comparison operations are if the two internal identifiers are equal or not equal.



Edit following the comment below: GraphDB's Plugin API is the only mechanism to integrate your code with the database. A plugin can materialize for every statement with ?s <cad:x> ?o predicate a new statement ?s <cad:oppositeX> -?o. Unfortunately, it should handle also the deletes.






share|improve this answer


























  • I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

    – benjaminaaron
    Nov 14 '18 at 15:37


















0














You cannot use basic arithmetic functions in the rules. Due performance reasons the GraphDB rule engine works with the internal database identifiers, but not the actual RDF values i.e. internal id 10001 instead of "1"^^xsd:double. Thus, the only supported variable comparison operations are if the two internal identifiers are equal or not equal.



Edit following the comment below: GraphDB's Plugin API is the only mechanism to integrate your code with the database. A plugin can materialize for every statement with ?s <cad:x> ?o predicate a new statement ?s <cad:oppositeX> -?o. Unfortunately, it should handle also the deletes.






share|improve this answer


























  • I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

    – benjaminaaron
    Nov 14 '18 at 15:37
















0












0








0







You cannot use basic arithmetic functions in the rules. Due performance reasons the GraphDB rule engine works with the internal database identifiers, but not the actual RDF values i.e. internal id 10001 instead of "1"^^xsd:double. Thus, the only supported variable comparison operations are if the two internal identifiers are equal or not equal.



Edit following the comment below: GraphDB's Plugin API is the only mechanism to integrate your code with the database. A plugin can materialize for every statement with ?s <cad:x> ?o predicate a new statement ?s <cad:oppositeX> -?o. Unfortunately, it should handle also the deletes.






share|improve this answer















You cannot use basic arithmetic functions in the rules. Due performance reasons the GraphDB rule engine works with the internal database identifiers, but not the actual RDF values i.e. internal id 10001 instead of "1"^^xsd:double. Thus, the only supported variable comparison operations are if the two internal identifiers are equal or not equal.



Edit following the comment below: GraphDB's Plugin API is the only mechanism to integrate your code with the database. A plugin can materialize for every statement with ?s <cad:x> ?o predicate a new statement ?s <cad:oppositeX> -?o. Unfortunately, it should handle also the deletes.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 12:19

























answered Nov 13 '18 at 17:39









vassil_momtchevvassil_momtchev

77837




77837













  • I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

    – benjaminaaron
    Nov 14 '18 at 15:37





















  • I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

    – benjaminaaron
    Nov 14 '18 at 15:37



















I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

– benjaminaaron
Nov 14 '18 at 15:37







I see, thanks @vassil_momtchev. Do you think there might be a chance to understand these internal ID mappings? Then I could try to use those to trigger something if one value is "1"^^xsd:double and the other one is the negative version of it "-1"^^xsd:double by comparing their internal IDs instead of actually applying arithmetics.

– benjaminaaron
Nov 14 '18 at 15:37




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280025%2fusing-arithmetic-functions-in-custom-graphdb-ruleset%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python