You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Claude Warren <cl...@xenei.com> on 2017/06/23 21:11:46 UTC

org.apache.jena.sparql.util.Iso Question

{noformat}
public static boolean nodeIso(Node n1, Node n2, NodeIsomorphismMap isoMap)
    {
        if ( isoMap != null ) {
            if ( n1.isBlank() && n2.isBlank() )
                return isoMap.makeIsomorphic(n1, n2) ;
            if ( Var.isBlankNodeVar(n1) && Var.isBlankNodeVar(n2) )
                return isoMap.makeIsomorphic(n1, n2) ;
    }
        return n1.equals(n2) ;
    }
{noformat}

Assuming:

   1. isoMap is not null
   2. if n1 is a Node_Variable
   3. and n2 is Var.asNode()
   4. and both are printed as ?x

should nodeIso return true?  Currently it does not.

Claude

-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: org.apache.jena.sparql.util.Iso Question

Posted by Claude Warren <cl...@xenei.com>.
I'm working on the Union-of-one problem and for the solution trying to get
rid of the regex comparisons.  So it is not in current code and I worked
around it by creating a proper var.  I was just wondering if it was
incorrect.  thx for the answer.

Claude



On Fri, Jun 23, 2017 at 11:12 PM, Andy Seaborne <an...@apache.org> wrote:

>
>
> On 23/06/17 22:16, Andy Seaborne wrote:
>
>>
>>
>> On 23/06/17 22:11, Claude Warren wrote:
>>
>>> {noformat}
>>> public static boolean nodeIso(Node n1, Node n2, NodeIsomorphismMap
>>> isoMap)
>>>      {
>>>          if ( isoMap != null ) {
>>>              if ( n1.isBlank() && n2.isBlank() )
>>>                  return isoMap.makeIsomorphic(n1, n2) ;
>>>              if ( Var.isBlankNodeVar(n1) && Var.isBlankNodeVar(n2) )
>>>                  return isoMap.makeIsomorphic(n1, n2) ;
>>>      }
>>>          return n1.equals(n2) ;
>>>      }
>>> {noformat}
>>>
>>> Assuming:
>>>
>>>     1. isoMap is not null
>>>     2. if n1 is a Node_Variable
>>>     3. and n2 is Var.asNode()
>>>     4. and both are printed as ?x
>>>
>>> should nodeIso return true?  Currently it does not.
>>>
>>
>> They aren't .equals.
>>
>
> See also Node_RuleVariable.
>
>
>
>> That are different objects and much of ARQ will treat Node_Variable, not
>> Var, as a constant term.
>>
>> Where are Var and directly created Node_Variable being mixed?
>>
>>      Andy
>>
>>
>>> Claude
>>>
>>>


-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: org.apache.jena.sparql.util.Iso Question

Posted by Andy Seaborne <an...@apache.org>.

On 23/06/17 22:16, Andy Seaborne wrote:
> 
> 
> On 23/06/17 22:11, Claude Warren wrote:
>> {noformat}
>> public static boolean nodeIso(Node n1, Node n2, NodeIsomorphismMap 
>> isoMap)
>>      {
>>          if ( isoMap != null ) {
>>              if ( n1.isBlank() && n2.isBlank() )
>>                  return isoMap.makeIsomorphic(n1, n2) ;
>>              if ( Var.isBlankNodeVar(n1) && Var.isBlankNodeVar(n2) )
>>                  return isoMap.makeIsomorphic(n1, n2) ;
>>      }
>>          return n1.equals(n2) ;
>>      }
>> {noformat}
>>
>> Assuming:
>>
>>     1. isoMap is not null
>>     2. if n1 is a Node_Variable
>>     3. and n2 is Var.asNode()
>>     4. and both are printed as ?x
>>
>> should nodeIso return true?  Currently it does not.
> 
> They aren't .equals.

See also Node_RuleVariable.

> 
> That are different objects and much of ARQ will treat Node_Variable, not 
> Var, as a constant term.
> 
> Where are Var and directly created Node_Variable being mixed?
> 
>      Andy
> 
>>
>> Claude
>>

Re: org.apache.jena.sparql.util.Iso Question

Posted by Andy Seaborne <an...@apache.org>.

On 23/06/17 22:11, Claude Warren wrote:
> {noformat}
> public static boolean nodeIso(Node n1, Node n2, NodeIsomorphismMap isoMap)
>      {
>          if ( isoMap != null ) {
>              if ( n1.isBlank() && n2.isBlank() )
>                  return isoMap.makeIsomorphic(n1, n2) ;
>              if ( Var.isBlankNodeVar(n1) && Var.isBlankNodeVar(n2) )
>                  return isoMap.makeIsomorphic(n1, n2) ;
>      }
>          return n1.equals(n2) ;
>      }
> {noformat}
> 
> Assuming:
> 
>     1. isoMap is not null
>     2. if n1 is a Node_Variable
>     3. and n2 is Var.asNode()
>     4. and both are printed as ?x
> 
> should nodeIso return true?  Currently it does not.

They aren't .equals.

That are different objects and much of ARQ will treat Node_Variable, not 
Var, as a constant term.

Where are Var and directly created Node_Variable being mixed?

	Andy

> 
> Claude
>