Why use RDF instead of XML for the semantic web - semantic-web

I've done a bit of searching around the web about why we use RDF instead of XML for the semantic modeling. I came across this article, but it's still not completely clear to me. i was wondering if someone could just give me a couple of points on why we cannot use XML instead of RDF. From my limited understanding, XML's extensibility just gives us a way to define a document but does not give us any mechanisms to describe the meaning of it. Any examples would be greatly appreciated.
Thank you very much

From my limited understanding, XML's extensibility just gives us a way to define a document but does not give us any mechanisms to describe the meaning of it.
You're correct. XML describes data but does not do well at describing the relationship between different data elements.
RDF describes the data and the data relationships. Think of RDF as a textual meta-database. The article calls RDF a semantic model.
Here's an RDF example:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire Burlesque">
<cd:artist>Bob Dylan</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Hide your heart">
<cd:artist>Bonnie Tyler</cd:artist>
<cd:country>UK</cd:country>
<cd:company>CBS Records</cd:company>
<cd:price>9.90</cd:price>
<cd:year>1988</cd:year>
</rdf:Description>
.
.
.
</rdf:RDF>

Related

Mount a SPARQL endpoint for use with custom ontologies and triple RDFs

I've been trying to figure out how to mount a SPARQL endpoint for a couple of days, but as much as I read I can not understand it.
Comment my intention: I have an open data server mounted on CKAN and my goal is to be able to use SPARQL queries on the data. I know I could not do it directly on the datasets themselves, and I would have to define my own OWL and convert the data I want to use from CSV format (which is the format they are currently in) to RDF triple format (to be used as linked data).
The idea was to first test with the metadata of the repositories that can be generated automatically with the extension ckanext-dcat, but is that I really do not find where to start. I've searched for information on how to install a Virtuoso server for the SPARQL, but the information I've found leaves a lot to be desired, not to say that I can find nowhere to explain how I could actually introduce my own OWLs and RDFs into Virtuoso itself.
Someone who can lend me a hand to know how to start? Thank you
I'm a little confused. Maybe this is two or more questions?
1. How to convert tabular data, like CSV, into the RDF semantic format?
This can be done with an R2RML approach. Karma is a great GUI for that purpose. Like you say, a conversion like that can really be improved with an underlying OWL ontology. But it can be done without creating a custom ontology, too.
I have elaborated on this in the answer to another question.
2. Now that I have some RDF formatted data, how can I expose it with a SPARQL endpoint?
Virtuoso is a reasonable choice. There are multiple ways to deploy it and multiple ways to load the data, and therefore LOTs of tutorial on the subject. Here's one good one, from DBpedia.
If you'd like a simpler path to starting an RDF triplestore with a SPARQL endpoint, Stardog and Blazegraph are available as JARs, and RDF4J can easily be deployed within a container like Tomcat.
All provide web-based graphical interfaces for loading data and running queries, in addition to SPARQL REST endpoints. At least Stardog also provides command-line tools for bulk loading.

How to validate JSON-LD against an schema?

As I understand there are ways to validate serialized RDF (e.g RDF/XML) against RDF Schema (How to validate a RDF with your RDF schema).
Also, there are various converters from RDF/XML to JSON-LD serialization format (and vice versa).
Searching the Internet I could not find a straightforward way to validate JSON-LD against some sort of JSON Schema that relates to JSON-LD as RDF Schema relates to RDF(/XML).
Of course, there are various JSON-LD document forms so I assume that one schema cannot easily describe all forms.
So my question is, what is the proper or recommended way of validating JSON-LD document from the RDF perspective?
BTW I run on a project that tries to solve validation of JSON linked data https://github.com/common-workflow-language/schema_salad.
RDF Schema is somewhat Mia-named, but can be used to make sense of (actually, infer information from) an RDF graph. OWL provides more mechanisms for asserting shapes of RDF Graphs as does new work on RDF Shapes. The key is that these work on the data model, not the syntax. Both RDF/XML and JSON-LD are RDF serializations, which can be used to reduce documents expressed in an appropriate syntax into an RDF Graph, where these tools operate.
The Structured Data Linter uses this approach to "validate" web pages representing information in schema.org and many other vocabularies using these principles.
RDF Schema is not for validation. In fact you cannot express a contradiction with RDF Schema alone. For example if an instance of Person is the subject of a triple with maximumSpeed as predicate and the property maximumSpeed has Vehicle (rather than Person) as rdfs:domain there is no contradiction, there is simply a thing that is both a Person and a Vehicle. To say that something cannot at the same time be a person and a vehicle you would need OWL, RDF Schema is not enough for that.
RDF Data Shapes will allow constraints and validation.

SPARQL search by autoID generated in Protege 5

I am a newbie from SPARQL & Prot. I have followed the tutorials in Youtube by Dr Noureddin Sadawi and a bit of the Pizza example tutorial in Protege Wiki. Here it is said that:
"In the Entity URI pane, select auto ID. When you create a new class, property or individual P4 will give it a meaningless URI and a readable label. That way if you exchange ontologies, correcting spelling mistakes (by merely changing labels) won’t cause the links between the ontologies to break"
Afterwards, I have created a small ontology for a "user" class with 3 "Data Property": age, email and gender. Then, I created 2 entities in order to make some tests.
In the final stage of my test with Fuseki server as in the Youtube tutorials, but with v2 and I tried to search for one of the users. However, the owl file is generated with the AutoIDs I created the classes and properties, so I don't know how to proceed with SPARQL.
For instance, this is one of the entities:
<!-- http://localhost/ontologies/2015/user-test#OWLNamedIndividual_84a421a4_9a25_4960_9e94_c8df6e58053c -->
<owl:NamedIndividual rdf:about="&user-test;OWLNamedIndividual_84a421a4_9a25_4960_9e94_c8df6e58053c">
<rdf:type rdf:resource="&user-test;OWLClass_a3e98b7d_52be_4a6b_af80_64ea7697332b"/>
<rdfs:label xml:lang="es">user02</rdfs:label>
<OWLDataProperty_9ade37f6_4e7c_4693_a830_2e0d895b7127 rdf:datatype="&xsd;string">25-34</OWLDataProperty_9ade37f6_4e7c_4693_a830_2e0d895b7127>
<OWLDataProperty_4492a8ab_183f_4e0d_b456_cbffdaeead79 rdf:datatype="&xsd;string">female</OWLDataProperty_4492a8ab_183f_4e0d_b456_cbffdaeead79>
<OWLDataProperty_2da03b48_c32a_4c74_91c7_fb552c9c39e5 rdf:datatype="&xsd;string">sus02#hotmail.com</OWLDataProperty_2da03b48_c32a_4c74_91c7_fb552c9c39e5>
</owl:NamedIndividual>
Is this the correct way of proceeding? Which is the best alternative to work with Protege, Jena engine, Fuseki and so on?
Thanks in advance

What is the difference between RDF Schema and Ontology?

I am new to Semantic Web and confused regarding RDFs and Ontology. Can someone explain the difference between RDF Schema and Ontology?
RDF Schema (RDFS) is a language for writing ontologies.
An ontology is a model of (a relevant part of) the world, listing the types of object, the relationships that connect them, and constraints on the ways that objects and relationships can be combined.
A simple example of an ontology (though not written in RDFS syntax):
class: Person
class: Project
property: worksOn
worksOn domain Person
worksOn range Project
which says that in our model of the world, we only care about People and Projects. People can work on Projects, but not the other way around.
Do you mean 'what is the difference between RDF Schema' and 'Web Ontology Language (OWL2)'. If so then there are a few main differences. Both are ways to create vocabularies of terms to describe data when represented as RDF. OWL2 and its subsets (OWL DL, OWL Full, OWL Lite) contain all the terms contained in RDFS but allow for greater expressiveness, including quite sophisticated class and property expressions. In additional, one of the subsets of OWL2 (OWL Full) can be modelled in such a way that when reasoned using an OWL Full reasoner, is undecidable. Both are representable as RDF and both are W3C Web Standards.
If you want to compare RDFS and ontology, not specifically in the context above, but in the context of Semantic Web, then my advice would be to very careful. Careful because you will find several distinct and not necessarily mutually exclusive camps; those with an interest in ontology from a philosophical perspective, those from a computing perspective, those who think the philosophical perspective should be the only perspective and those that don't. If you are any of those ways inclined, you can end up having great debates. But if you want to engage in Semantic Web Development, then the fastest route is to study and understand the Web Standards mentioned initially.
Conceptually there is no difference, i.e., RDFS can be utilised to create a (e.g. domain specific) vocabulary or ontology, where RDFS is bootstrapping itself in companion with RDF (everything is at least an rdfs:Resource). Furthermore, in the context of Semantic Web technologies you could utilise OWL to describe advanced semantics of your ontology/vocabulary. See also this definition of ontology.
As per the spec, RDF schema is purely that - a schema or structure for defining things semantically. It gives you the vocabulary (key words and properties) for describing things. Think of it like an XML schema as used in XML documents and web pages.
An ontology is a classification hierarchy (for example, the biological taxonomy of life) normally combined with instances of those classes. It is used for classifying and reasoning.
What is an instance depends on how you define a taxonomy. It might be that you have an ontology of living creatures and so a living, breathing person is an instance of the ontological class "Homo Sapiens", or it might be that you have an ontology of species and so the entire Homo Sapiens species is an instance of the ontological class "Species".
In non technical terms, I would say RDFS is a language that helps to represent information. And an ontology is the term used to refer to all the information about a domain.
Cheers

How can I do offline reasoning with Pellet?

I have an OWL ontology and I am using Pellet to do reasoning over it. Like most ontologies it starts by including various standard ontologies:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
I know that some reasoners have these standard ontologies 'built-in', but Pellet doesn't. Is there any way I can continue to use Pellet when I am offline & can't access them? (Or if their URL goes offline, like dublincore.org did last week for routine maintenance)
Pellet recognizes all of these namespaces when loading and should not attempt to dereference the URIs. If it does, it suggests the application using Pellet is doing something incorrectly.
You may find more help on the pellet-users mailing list.
A generalized solution to this problem -- access to ontologies w/out public Web access -- is described in Local Ontology Repositories with Pellet. Enjoy.
Make local copies of the four files and replace the remote URLs with local URIs (i.e. file://... or serve them from your own box: http://localhost...).