Dear Irene,

Thanks for the hints. I try to answer the questions below. Hopefully more 
understandable
For the API, I meant if the version from 1 July 2020 (
https://w3c.github.io/shacl/shacl-af/) is already supported
I see in GitHub reference only to the version from 2017. So just wanted to 
be sure.

Best regards
Chavdar  

В 22:16:21 UTC+2на понеделник, 10 август 2020 г. Irene Polikoff написа:

> Dear Chavdar,
>
> SHACL SPARQL is not in the Advanced Features. It is in the main SHACL 
> Specification. SHACL API coverage is described in GitHub.
>
> SPARQL-based targets are in the Advanced features, but I do not know if 
> you need them. 
>
> If you use SHACL SPARQL and/or SPARQL based targets, then yes, you would 
> need to carefully consider your queries and performance.
>
> Below are some questions and possible pointers.
>
> You do not have to answer these questions for me as I am not likely to 
> have time to help you with this project. They are just a food for thought.
>
> It may be that someone else on this mailing list will have time to help.
>
> Regards,
>
> Irene
>
> On Aug 10, 2020, at 2:47 PM, Chavdar Ivanov <ch.i...@gmail.com> wrote:
>
> Dear all,
>
> I am trying to use the API to define some constraints and figure out that 
> for many I need to use SPARQL
>
> I was given some reference to the SHACL Advanced Features 1.1 but I am not 
> sure if this is already supported by TopBraid API that is now posted in 
> Maven
>
> In order to illustrate what I need to do I attached some sample data xml 
> and ttl that are same (just different format ). I would like to give some 
> hints on how I could do the following constraints. I guess the target 
> will need to be carefully selected and the query might need to have 
> subquery.
>
> - constraint 1
>
> Only one Class1 has attribute1 that is the highest value(non-zero) and all 
> others shall be equal to 0
>
> This should also check if the highest value is appearing once i.e. not ok 
> if attribute1 is 2 in one instance and 2 in the other
>
>
> Not sure I understand. Only one member of Class 1 has a non zero value for 
> attribute 1?
>
> If so, you could use sh:targetObjectsOf to target nodes that are subjects 
> of the attribute 1 and use sh:or to say that if the target value is not 
> zero, then there is only 1 subject that is a member of Class 1.
> Chavdar: yes there can be many members of Class1 and there should be 1 
> that has attribute1 which is not zero. I will try to see how I could use 
> sh:targetObjectsOf. There is a variation of this where it is allowed to 
> have multiple non-zero values but the max value needs to be only in one 
> member of Class1.
>
>  
>
> - constraint 2
>
> Class3.attribute1 shall be equal to one of the associated 
> Class2.attribute1 values.
>
> Here I wanted to have a List of all Class2.attribute1 values and just 
> filter if Class3.attribute1 is IN or NOT IN
>
> The question is how to iterate to build the list. Or maybe the list idea 
> is a wrong approach to this.
>
>
> Do you meant that for a member of Class 3, value of the attribute 1 has to 
> be the same as the value of attribute 1 for an associated member of Class 
> 3? What is the relationship between these resources?
>
> You may be able to use a complex path with sh:equals 
> https://www.w3.org/TR/shacl/#EqualsConstraintComponent.
> Chavdar: You almost got it. Class2 has an association to Class3. So Class3 
> would have 0..n associated members of Class2. the equal should be a as 
> number not as string. I have the feeling sh:equals compares as strings
>
 

>
>  
>
> - constraint 3
>
> Instances of Class4 are required (Violation) to be instantiated for Class3 
> and Class5. If Class4 is instantiated for Class2 the severity is Info.
>
> In addition looking at Class3 how I can count how many instances of Class2 
> are associated via Class2.Class3. I guess GROUP BY can be used.
>
>  
>
> No idea what this means. What does it mean for instances of Class 4 to be 
> instantiated for Class 3? 
>
> Is there some relationship between members of these classes? And for a 
> member of Class 3, the value of relationship must exist and must be a 
> resource that is a member of Class 4? If so, this is a straight forward 
> sh:class and sh:maxCount constraints on the relationship at Class 3.
>
> Or are you taking about a situation where an instance of Class4 must also 
> be of type 3 and 5?
>
Chavdar: There is an optional relationship between classes 4 and 3 , 4 and 
5, 4 and 2. Members of Class4 must be referenced by all members of Class 3 
and Class5 but optionally (Info)  by members of Class2. 

>
> -Constraint 4
>
> Class4 is instantiated only for instances that are referenced by Class6
>
>
> Again, do not understand the language
>
Chavdar: Class6 includes references/associations to different members of 
Class2. Now Class 4 shall have members that are referenced by a member of 
Class6 but shall not have members that are not referenced by a member of 
Class6.  

>
>  
>
> -Constraint 5
>
> If only one instance of Class7 is associated with Class2 instance then 
> Class7.attribute1 shall equal Class2.attribute2
>
> Not enough information e.g., what is a relationship between these classes 
> and are values of this relationship for Class7 always members of Class 2 or 
> could there be some other values? If latter than you would need to look at 
> qualified value shapes.
>
>  think this is sh:or
>
> Again, not sure if you need SPARQL or could create something using sh:or, 
> sh:equals and, possibly, sh:values property rule.
>
Chavdar: how I do the if here. I guess I need to check now many members of 
Class7 are present and then if it is only one then compare the related 
properties.  Does sh:equals compare numbers (as numbers, not strings)? 

>  
> - Constraint 6
> check if Class3 is referenced by at least 3 instances of Class2 
>
>
> This is maxCount on the connecting property, but, again, the question is 
> if all values belong to the same class or could there be 3 values of one 
> and 2 values of another and that is still valid. Then, you need to look at 
> the qualified value shapes.
>
> and there should be one instance Class2 for which Class2.attribute1 is 
> negative and another instance of Class2 for which Class2.attribute2 is 
> positive 
>
>
> This is definitely qualified value shapes 
> https://www.w3.org/TR/shacl/#QualifiedValueShapeConstraintComponent
>
> Chavdar: I will see if qualified would work. I need to check if a member 
> of Class3 is referenced by at least 3 members of Class2 and then study the 
> properties of each of these members, but generally they could be more than 
> 3 members of Class2 so I need to check the values of their properties and 
> see f there is one positive and one negative.
>
> Best regards
> Chavdar 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to topbraid-user...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/de8f635c-9777-44ae-98e1-fde322145f80o%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/de8f635c-9777-44ae-98e1-fde322145f80o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> <Example.ttl><Example.xml>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/694793ce-29b6-4275-b197-31bbf534aa27n%40googlegroups.com.

Reply via email to