RDF4J SPIN Inference help #3208
-
We have configured RDF4J as indicated below, but can't get inferences to work. Our ontology model includes SPIN rules that aren't firing, and even putting them directly into the Update window doesn't do the trick. For example, I would expect this: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX AMP: <http://lingualogica.net/AMP#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX spin: <http://spinrdf.org/spin#>
PREFIX sp: <http://spinrdf.org/sp#>
WITH <http://lingualogica.net/AMP>
INSERT {
?x AMP:instrument AMP:CERESInstrument }
WHERE {
?x rdf:type AMP:CER_SSF1deg-Day_Aqua-MODIS_Edition4A
} to insert an assertion for the single test instance of AMP:CER_SSF1deg-Day_Aqua-MODIS_Edition4A, but it doesn't. We can't figure out where we've gone wrong. Any ideas? Thanks! @prefix ms: <http://www.openrdf.org/config/sail/memory#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rep: <http://www.openrdf.org/config/repository#> .
@prefix sail: <http://www.openrdf.org/config/sail#> .
@prefix sb: <http://www.openrdf.org/config/sail/base#> .
@prefix sr: <http://www.openrdf.org/config/repository/sail#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<#memory-spin-rdfs> a rep:Repository;
rep:repositoryID "memory-spin-rdfs";
rep:repositoryImpl [
rep:repositoryType "openrdf:SailRepository";
sr:sailImpl [
sail:delegate [
sail:delegate [
sail:delegate [
sail:sailType "openrdf:MemoryStore";
sb:evaluationStrategyFactory "org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategyFactory";
ms:persist true
];
sail:sailType "openrdf:DedupingInferencer"
];
sail:sailType "rdf4j:SchemaCachingRDFSInferencer"
];
sail:sailType "openrdf:SpinSail"
]
];
rdfs:label "Memory store with RDFS and full SPIN support" . |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Can you share what your actual SPIN rule (in the context of your ontology) looks like? You've shared a SPARQL INSERT operation, but SPIN rules are typically expressed as CONSTRUCT queries I believe. Secondly, can you talk us through how you test things? With the SPIN Sail, I believe it is important to have the rule in place in the database before you add the data that is supposed to trigger the rule. Finally, I hope you are aware that SPIN support is deprecated, and is scheduled to be removed in RDF4J 4.0. See the big orange warning in the documentation. |
Beta Was this translation helpful? Give feedback.
-
Looks like you are adding data to an existing resource in your database. This is not supported by the SpinSail. Do you see the same results if you start with an empty repository, add your spin rules in one transaction then add all your data in another transaction? What use case do you have for SPIN? I am always interested to hear about people who are still using it! |
Beta Was this translation helpful? Give feedback.
Looks like you are adding data to an existing resource in your database. This is not supported by the SpinSail.
Do you see the same results if you start with an empty repository, add your spin rules in one transaction then add all your data in another transaction?
What use case do you have for SPIN? I am always interested to hear about people who are still using it!