30644

swrlx:makeOWLThing is creating only one individual

Question:

Using Protege and SWRL tab, I have the ontology mentioned hereinafter. It is composed of the Class Test and the class Shadow, where Test has three individuals t1, t2, t3. I was trying to define an SWRL rule that creates an individual of Shadow class for each existing individual of Test, the rule is

Test(?x) ^ swrlx:makeOWLThing(?new, ?x) -> Shadow(?new)

<strong>QUESTIONS:</strong>

<ol><li>Only one individual of Shadow, named fred is created, instead of three (corresponding to t1, t2, t3).</li> <li>

How to control the naming of the resulting individual which is always named fred?

Prefix(:=<http://www.semanticweb.org/hilal/ontologies/2016/5/untitled- ontology-58#>) Prefix(owl:=<http://www.w3.org/2002/07/owl#>) Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>) Prefix(xml:=<http://www.w3.org/XML/1998/namespace>) Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>) Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>) Ontology(<http://www.semanticweb.org/hilal/ontologies/2016/5/untitled- ontology-58> Declaration(Class(:Shadow)) Declaration(Class(:Test)) Declaration(NamedIndividual(:t1)) Declaration(NamedIndividual(:t2)) Declaration(NamedIndividual(:t3)) Declaration(AnnotationProperty(<http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled>)) ############################ # Named Individuals ############################ # Individual: :t1 (:t1) ClassAssertion(:Test :t1) # Individual: :t2 (:t2) ClassAssertion(:Test :t2) # Individual: :t3 (:t3) ClassAssertion(:Test :t3) DLSafeRule(Annotation(<http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> "true"^^xsd:boolean) Annotation(rdfs:comment ""^^xsd:string) Annotation(rdfs:label "S1"^^xsd:string) Body(BuiltInAtom(<http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl#makeOWLThing> Variable(<new>) Variable(<x>)) ClassAtom(:Test Variable(<x>)))Head(ClassAtom(:Shadow Variable(<new>)))) ) </li> </ol>

Answer1:

SWRL rules cannot create new individuals, as far as I understand the DL Safe conditions.

Answer2:

In the comments, you linked to <a href="http://wiki.ruleml.org/index.php/SWRL" rel="nofollow">an article</a> describing the semantics of that extension:

<blockquote>

One of the the first built-ins I implemented provided the ability to create new individuals in a controlled manner. There is a detailed explanation in [2], but basically a built-in called swrlx:makeOWLThing creates a new individual and binds it to its first unbound argument; a new individual is created for each unique pattern of the remaining arguments.

</blockquote>

Now, let's take a look at your rule as written in the question:

<blockquote>

Test(?x) ^ swrlx:makeOWLThing(?new, ?x) -> Shadow(?new)

</blockquote>

If the atoms are processed from left to right, then ?x should be bound when makeOWLThing is encountered, but ?new isn't. That means that you should get a new individuals bound to the variable ?new, and for each value of ?x you should get a different value of ?new. That's what it sounds like you want. However, in the code you posted, I see this:

DLSafeRule( Annotation(<http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> "true"^^xsd:boolean) Annotation(rdfs:comment ""^^xsd:string) Annotation(rdfs:label "S1"^^xsd:string) Body( BuiltInAtom(<http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl#makeOWLThing> Variable(<new>) Variable(<x>)) ClassAtom(:Test Variable(<x>))) Head( ClassAtom(:Shadow Variable(<new>)))) )

I'm not certain, but if that's processed from left to right as well, the <strong>makeOWLThing(?new,?x)</strong> appears <em>first</em>, in which case ?x would be unbound when the new individual is created, so you'd only get one new individual.

Recommend

  • SPARQL Federated Query Not Returning All Solutions
  • Could anyone help me with a tool for RDF/OWL visualization?
  • Use RDF API (Jena, OpenRDF or Protege) to convert OpenIE outputs
  • How to get associated (English) Wikipedia page from Wikidata page / Q number using Wikidata dump?
  • How to create Alignment Object using alignment API
  • How to use a Java GUI panel?
  • Lifetime of RDF nodes in Redland RDF after parsing a model?
  • Encountering Error when doing post-back using __doPostBack()
  • Delete blank node from ontology through SPARQL UPDATE
  • Jena Sparql Error java.lang.Integer
  • Is it possible to add tickboxes in a DT datatable?
  • Count values that satisfy a constraint and return 0 for those that don't satisfy it in SPARQL
  • How to retrieve elements of OWL enumerated datatype expression?
  • Is there a better method than to reuse a complicated table in DocBook?
  • Java PrintWriter output looks weird in notepad
  • Sending Content-Type application/x-www-form-urlencoded WSO2 ESB
  • Feature detection of foreignObject in SVG
  • XSD with multi occurrences unordered
  • SPARQL date range
  • ZipList with Scalaz
  • Alamofire and Reachability.swift not working on xCode8-beta5
  • Sesame : how to remove the inference during queries?
  • CERN ROOT exporting data to plain text
  • Question about instantiating object
  • Jetty 9 HashLoginService
  • Play WS (2.2.1): post/put large request
  • Email verification using google app script and google forms
  • Cancel a live stream “fast motion” catch-up in Flash
  • Read a local file using javascript
  • Deserializing XML into class C#
  • Is there a mandatory requirement to switch app.yaml?
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal