Ich verwende TopBraid Free Edition, um OWL-Ontologien mit SPIN-Regeln zu erstellen. Ich bin Laden der Ontologie und SPIN Regeln in Sesame OpenRDF Workbench:Wann wird eine SPIN: Regel ausgeführt?
Application Name OpenRDF Workbench
Version 4.1.2
Runtime Information
Operating System Windows 8.1 6.3 (amd64)
Java Runtime Oracle Corporation Java HotSpot(TM) 64-Bit Server VM (1.8.0_91)
Process User Greg
Memory
Used 646 MB
Maximum 3463 MB
ich einen einfachen Test Ontologie erstellt haben. Es hat eine Klasse mit einer SPIN-Regel und einer Datentypeigenschaft.
CONSTRUCT {
?this BugReproduction:hasTimeStamp ?timeStamp .
}
WHERE {
BIND (now() AS ?timeStamp) .
}
Die SPIN Regel fügt einen xsd:dateTime
Zeitstempel auf die Testinstanz meiner Testklasse. Hier ist die RDF für die gesamte Test Ontologie einschließlich meiner Klasse, Datentyp-Eigenschaft und Regel (kurz):
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:sp="http://spinrdf.org/sp#"
xmlns:BugReproduction="http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproduction#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:spin="http://spinrdf.org/spin#"
xmlns:spl="http://spinrdf.org/spl#"
xmlns:arg="http://spinrdf.org/arg#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xml:base="http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproduction">
<owl:Ontology rdf:about="">
<owl:imports rdf:resource="http://spinrdf.org/spl"/>
<owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Created with TopBraid Composer</owl:versionInfo>
</owl:Ontology>
<owl:Class rdf:ID="TimeStampBug">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<spin:rule>
<sp:Construct>
<sp:templates rdf:parseType="Collection">
<rdf:Description>
<sp:object rdf:parseType="Resource">
<sp:varName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>timeStamp</sp:varName>
</sp:object>
<sp:predicate>
<owl:DatatypeProperty rdf:ID="hasTimeStamp"/>
</sp:predicate>
<sp:subject rdf:resource="http://spinrdf.org/spin#_this"/>
</rdf:Description>
</sp:templates>
<sp:where rdf:parseType="Collection">
<sp:Bind>
<sp:expression>
<sp:now/>
</sp:expression>
<sp:variable rdf:parseType="Resource">
<sp:varName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>timeStamp</sp:varName>
</sp:variable>
</sp:Bind>
</sp:where>
</sp:Construct>
</spin:rule>
</owl:Class>
<owl:DatatypeProperty rdf:about="#hasTimeStamp">
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
</owl:DatatypeProperty>
</rdf:RDF>
<!-- Created with TopBraid -->
Also, meine SPIN-Repository in Sesame löschen und die Modify Werkbank nutzen/Add-Befehl (mit der „Verwendung Basis URI als Kontextidentifizierer "deaktiviert, was wichtig ist, um einen Fehler zu vermeiden. Dann benutze ich eine Abfrage SPARQL-Update eine Testinstanz meiner Klasse zu erstellen:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sxxicc: <http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/SXXIComplianceCheck#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX sp: <http://spinrdf.org/sp#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX smf: <http://topbraid.org/sparqlmotionfunctions#>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
PREFIX spl: <http://spinrdf.org/spl#>
PREFIX spin: <http://spinrdf.org/spin#>
PREFIX arg: <http://spinrdf.org/arg#>
PREFIX SXXIComplianceCheckIndividuals: <http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/SXXIComplianceCheckIndividuals#>
PREFIX sxxicci: <http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/SXXIComplianceCheckIndividuals#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bugs: <http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproduction#>
PREFIX bugsi: <http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#>
INSERT DATA {
bugsi:aTimeStampBug_test1 a bugs:TimeStampBug .
}
ich dann erkunden Sie die resultierende bugsi: aTimeStampBug_test1 Individuum, das SPIN zu finden: Regel mehrmals ausgeführt und produzierte mehrere Zeitstempel. Die Anzahl der Zeitstempel variiert von Test zu Test. Hier ist ein Beispielergebnis:
Subject
Predicate
Object
Context
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.571-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.592-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.594-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.595-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.596-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.597-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.598-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.599-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.600-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.601-05:00
<http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/BugReproductionInstantiations#aTimeStampBug_test1>
BugReproduction:hasTimeStamp
2016-07-11T20:56:58.602-05:00
Also meine SPIN: Regel wurde mehrmals für eine Instanziierung der Klasse ausgeführt. Wie oft sollte eine SPIN: Regel für eine Instanziierung einer Klasse ausgeführt werden? Ich dachte, es würde nur einmal laufen, aber es scheint, dass ich falsch liege.
Sie könnten besser diese Frage in der Benutzergruppe rdf4j stellen oder das Problem als Github-Problem veröffentlichen. –
Es sollte nur einmal pro Klassenmitglied ausgeführt werden. – scotthenninger
Dank @scotthenninger. Ich wollte dies bestätigen, bevor ich dies zu github als einen Fehlerbericht für rdf4j nahm. Wenn ich dort eine nützliche Antwort bekomme, poste ich sie hier für die Vollständigkeit dieses Eintrags. –