SADI in Perl - Protege Plugin Tutorial (fixed Aug 24, 2011)
Sample data and other ur ls
1. SAMPLE DATA as N3:
@prefix mged: <http://mged.sourceforge.net/ontologies/MGEDOntology.owl#> .
@prefix demo: <http://linkeddata.systems/ontologies/SADITutorial.owl#> .
@prefix example: <http://example.org/patients#> .
example:Mark
a demo:PatientData;
mged:has_height "1.93";
demo:has_mass "96".
example:Jerven
a demo:PatientData;
mged:has_height "2.00";
demo:has_mass "85".
SAMPLE DATA as XML:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:mged="http://mged.sourceforge.net/ontologies/MGEDOntology.owl#"
xmlns:demo="http://linkeddata.systems/ontologies/SADITutorial.owl#" >
<rdf:Description rdf:about="http://example.org/patients#Jerven">
<mged:has_height>2.00</mged:has_height>
<demo:has_mass>85</demo:has_mass>
<rdf:type rdf:resource="http://linkeddata.systems/ontologies/SADITutorial.owl#PatientData"/>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/patients#Mark">
<demo:has_mass>96</demo:has_mass>
<rdf:type rdf:resource="http://linkeddata.systems/ontologies/SADITutorial.owl#PatientData"/>
<mged:has_height>1.93</mged:has_height>
</rdf:Description>
</rdf:RDF>
See your service definition
http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl
2. -- note that, because of annoying peculiarities in how Chrome handles
certain XML content-types, it is necessary (for humans) to view this in
Firefox, so that the XSLT transform is triggered correctly… Grrrrrr
Execute from command line:
curl -H 'Content-Type: text/rdf+n3' -H 'Accept: text/rdf+n3' -i --data-binary
@tutorialsampledata.n3 'http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl'
Register the service
http://sadiframework.org/registry/register/
(there is a REST interface you can use for bulk registrations, but you
don’t get a lot of feedback on failure…)
Copy of XML sample data at: (for use in SPARQL queries)
http://linkeddata.systems/sampledata.rdf
Ontology:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:demo="http://linkeddata.systems/ontologies/SADITutorial.owl#"
3. xmlns:mged="http://mged.sourceforge.net/ontologies/MGEDOntology.owl#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
<owl:DatatypeProperty
rdf:about="http://mged.sourceforge.net/ontologies/MGEDOntology.owl#has_height">
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://linkeddata.systems/ontologies/SADITuto rial.owl#has_mass">
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://sadiframework.org/examples/bmi.owl#BMI">
</owl:DatatypeProperty>
<owl:Class rdf:ID="PatientData">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty
rdf:resource="http://mged.sourceforge.net/ontologies/MGEDOntology.owl#has_height"/>
<owl:minCardinality
rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</owl:minCardinality>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty
rdf:resource="http://linkeddata.systems/ontologies/SADITutorial.owl#has_mass"/>
<owl:minCardinality
rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</owl:minCardinality>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
<owl:Class rdf:ID="PatientBMI">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://sadiframework.org/examples/bmi.owl#BMI"/>
<owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#long"/>
</owl:Restriction>
</owl:equivalentClass>
</owl:Class>
</rdf:RDF>
SPARQL Query for SHARE (http://dev.biordf.net/cardioSHARE/)
SELECT * FROM <http://linkeddata.systems/sampledata.rdf>
WHERE {
?s <http://sadiframework.org/examples/bmi.owl#BMI> ?val
}
Have a look at this:
http://linkeddata.systems/sampledata_untyped.rdf
Use that in your “FROM” clause… SHARE is using DL reasoning to
automatically discover and rdf:type the input data for the service!
4. Dynamic match-making between “generic” RDF data and appropriate service
interfaces.
Also look at this:
curl -H 'Content-Type: text/rdf+n3' -H 'Accept: application/n-quads' -i --data-binary
@tutorialsampledata.n3 'http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl'