On Fri, Mar 14, 2014 at 10:48 AM, <
sabi...@yahoo.de> wrote:
> Dear all,
>
> I am a Stardog newbie and have a hard time figuring out how to work with
> stardog rules and ICV. So any hint will be appreciated!
>
> Stardog is running on my PC (running with Windows 7) and I created a db,
> where I would like to experiment with the ICV. I have an ontology
> (describing the syntax of a process modelling language, namely Event driven
> process chains) and an instance of a process (please see attached file
> a_box.gif for a graphical representation of the process. Please disregard
> the german labels, they are not important in this case). The ontology and
> related individuals are contained in one file.
>
> Question 1. How to express the constraints? I found the documentation [1] ,
> where it is strongly recommended to use the native stardog rules syntax.
If you are going to use rules, we recommend Stardog rules syntax
instead of the SWRL syntax. Otherwise using OWL for constraints is
fine and might even be preferable since OWL constraints are typically
more succinct.
> So what I did right now is the following:
> a. I generated the ontology (which contains both the T-Box and the A-Box) in
> Protege and saved it in the Turtle Syntax. The resulting file was
> stardog_epk.ttl.
> b. In a simple text editor, I tried to create a simple rule. In my example I
> have the class Function, the class ControlFlow, and the objectProperty
> :hasIncomingFlow with domain Function and range ControlFlow. I would like to
> formulate a rule stating that if some individual ?f is a Function, and some
> ?c is a ControlFlow, then ?f has to have exactly one :hasIncomingFlow. Would
> this be working?:
> @prefix rule: <tag:stardog:api:rule:> .
> [] a rule:SPARQLRule;
> rule:content """
>
> IF {
> ?f a :Function;
> ?c a :ControlFlow;
> }
> THEN {
> :hasIncomingFlow(?f,?c) exactly 1
> }""" .
>
> I put this rule in the file rule1.ttl
There are couple things wrong with this rule including the syntax.
What you are trying to express here is a regular cardinality
constraint which would be the following OWL axiom:
:Function subClassOf hasIncomingFlow exactly 1 ControlFlow
Expressing cardinality constraints as SPARQL rules would be much harder.
>
> 3. I now would add this file to the db.
>
> Question 2: Is it necesarry to separate the rules from my Ontology
> definition and store it in a separate file?
Yes, because constrains are added to a Stardog database using
"stardog-admin icv add" command where you'd pass the file containing
the constraints.
> Question 3: How should I edit my rules? Using the text editor? Is there is
> user-friendlier way? Currently, I am not even sure, my rule file conforms to
> the Stardog rule syntax.
For the above OWL constraint you can still use Protege. If you are
going to use rules then you can use SWRL rules too since Protege
provides support for writing SWRL rules. In order to use SPARQL rules
you'd need to at least familiarize yourself more with SPARQL syntax.
>
> Question 4: As for the testing, I was planning to add some violation of this
> rule to the A-Box and then use the ICV funtionality in Stardog. How can I
> make sure, my rule is not ignored by Stardog? In the documentation [2] it
> says to include " following line in the logging.properties file in
> STARDOG_HOME:
>
> com.clarkparsia.blackout.level = ALL " But I did not find the
> logging.properties file. Is it possible the documentation means the
> stardog.properties file?
>
Stardog uses SLF4J logging which means you can use whatever logging
framework you want and different frameworks have different ways to
configure them. The suggestion in the documentation is for using JDK
logging which is the default framework Stardog uses. If you add a
logging.properties file to your STRAOG_HOME directory with the
following lines the reasoning warnings would be printed in the log:
handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = WARNING
com.clarkparsia.blackout.level = ALL
Best,
Evren
> --
> -- --
> You received this message because you are subscribed to the C&P "Stardog"
> group.
> To post to this group, send email to
sta...@clarkparsia.com
> To unsubscribe from this group, send email to
>
stardog+u...@clarkparsia.com
> For more options, visit this group at
>
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en