Plug in for Protege to Create/Edit SPIN Constraints and Constructors?

474 views Asked by At

Is there a plug-in or other means to create and edit SPARQL/SPIN constraints and constructors in Protege?

As I understand it, to capture SPIN constraints in RDF, the SPARQL code for the ASK or CONSTRUCT queries needs to be parsed and encoded. It's not stored as an opaque string. Therefore, it would seem that some plugin with knowledge of SPARQL and SPIN would be required.

I've loaded RDF from Topbraid Composer including SPIN constraints into Protege 4.3.0, and it seems to see the constraints as annotations, but I cannot seem to find all of the details, critically including all of the underlying SPARQL code. I do see it when text editing the RDF file.

In the broad sense, I'm trying to find a way to create/edit SPIN constraints and constructors and load them into Sesame to have them operate on individuals instantiated from my classes. I posted another question about the path from TopBraid Composer into Sesame. I'm trying to keep my questions more specific since I'm a newbie on Stack Overflow.

BTW, no I don't want to use SWRL instead. I've had trouble expressing the constraints I need using SWRL. I've had success using SPARQL.

Thanks.

1

There are 1 answers

1
scotthenninger On

In some versions TopBraid Composer will store SPIN constraints in RDF by default. Given that the query is stored as RDF triples, there should be no problem storing them in any RDF data store. Applying the SPIN constraints is a different issue, as the system will need to know how to interpret the queries for different SPIN properties.

Are you certain you cannot "see" them in Protégé or Sesame? The constraints are defined on the class using the property spin:constraint and should appear as a bnode. Make sure you also import http://spinrdf.org/spin, or at least define a property named spin:constraint. In the very least, the following should always work to find your constraints:

SELECT ?constraint ?class
WHERE {
   ?class <http://spinrdf.org/spin#constraint> ?constraint
}

...where ?constraint is bound to a bnode representing the constraint in RDF and ?class is the class the constraint is defined for.

Also, if you would rather store the constraints as SPARQL strings, see Preferences > TopBraid Composer > SPIN and check one of the boxes in "Generate sp:text...". Then you can get the query text via the following query:

SELECT ?query ?class
WHERE {
   ?class <http://spinrdf.org/spin#constraint> ?constraint .
   ?constraint <http://spinrdf.org/sp#text> ?query
}