Questions tagged [rdf]

The Resource Description Framework (RDF) is a language for representing information about resources in the World Wide Web. It is a syntax independent data model that may be serialised in a variety of concrete syntaxes. RDF is the core data format used on the Semantic Web.

The Resource Description Framework (RDF) is a language for representing information about resources in the World Wide Web. It is a syntax independent data model that may be serialised in a variety of concrete syntaxes. RDF is the core data format used on the Semantic Web.

Data Model

The data model for RDF is Graph based. Every fact in the data is represented as a Triple (or Statement) composed of a Subject, Predicate and Object. The Subject and Object can be thought of as nodes in the Graph while the Predicate is an arc in the Graph. Graphs are composed of a set of Triples, note that duplicates have no meaning.

Subjects must be resources which can either be named (using a IRI) or anonymous (known as Blank Nodes). IRIs are considered to be globally scoped while Blank Nodes are scoped to the Graph in which they appear.

Predicates must always be named resources i.e. IRIs.

Objects may be resources - IRIs/Blank Nodes - or they may be Literal values. Literal values are of three types:

  1. Simple Literals - These are just strings e.g. "simple literal"
  2. Literals with Language Specifiers - These are strings with the language of strings specified using standard language tags e.g. "literal with language tag"@en-gb
  3. Literals with DataTypes - These are values with a declared data type e.g. "123"^^xsd:integer . XML Schema DataTypes are commonly used and supported by related standards like SPARQL

Syntaxes

RDF is a syntax independent model but has a variety of officially and semi-officially standardised concrete syntaxes which are used to serialise it.

Official Standards (W3C)

The following are official standards created by the W3C

  • RDF/XML is the official XML based serialisation of RDF. RDF/XML is quite commonly used but has some drawbacks in being difficult for a human to understand or write by hand.
  • NTriples is the official plain text format for serialising RDF. It is a very simple serialisation that uses no syntactic sugar, it is very quick to parse and can be read/written by hand. It's disadvantage is that it is very verbose compared to other syntaxes.
  • RDFa is the officially recommended mechanism for embedding RDF into existing (X)HTML web pages. It is easy to use once learned but is sometimes criticised for the fact that the DOM structures required to embed RDFa often don't fit with the DOM structures of pages forcing developers to embed additional hidden elements with the RDFa.
  • Turtle is a readable yet compact plain text serialisation of RDF developed by Dave Beckett who was one of the members of the W3C working group that created the RDF specifications. It is quick and easy to parse and includes various syntactic sugar for compressing the data to make it less verbose. Turtle is a superset of NTriples and a subset of Notation 3 Turtle was introduces as an official RDF serialization in February 2014.
  • JSON-LD - JSON-LD is another JSON serialisation of RDF. It emphasises compact syntax and the ability to add RDF into your existing JSON data. It becamse official along with Turtle in February 2014.

Unofficial Standards

While the following are not officially standardised they are reasonably well specified and are widely implemented in RDF/Semantic Web APIs:

  • Notation 3 is a readable yet compact plain text serialisation of RDF developed by Tim Berners-Lee. It is a superset of Turtle and is capable of expressing data which is outside of the core RDF model as well as expressing all valid RDF.
  • Talis RDF/JSON - One of several competing JSON serialisations of RDF that tries to be as compact as possible

Resources

4248 questions
18
votes
1 answer

Binding a variable to one of two values with IF?

In the following SPARQL query, I'm not sure how to use if to bind one of two strings to the variable ?result. I heard that there are concepts of “in scope” and “out of scope,” but I don't really see the difference. I've also tried putting the if…
user2983384
  • 199
  • 1
  • 2
  • 5
18
votes
3 answers

Convert or translate a big RDF/XML file to JSON-LD format - HOW?

I need to convert this 40MB file of RDF/XML to the JSON-LD format and I've only found this web tool, that doesn't work at all. When you paste 40MB of text, it crashes, and when you give it the URL of the file, it says that the service isn't…
Akku
  • 4,373
  • 4
  • 48
  • 67
17
votes
2 answers

How to write SPARQL query that efficiently matches string literals while ignoring case

I am using Jena ARQ to write a SPARQL query against a large ontology being read from Jena TDB in order to find the types associated with concepts based on rdfs label: SELECT DISTINCT ?type WHERE { ?x
lmsurprenant
  • 1,723
  • 2
  • 14
  • 28
16
votes
7 answers

The State of RDF in Ruby

I'm wondering about the current support there is in Ruby for semantic web technologies. Is there good RDF options? It seems that the last surveys done were circa 2007 (…
Daniel
  • 16,026
  • 18
  • 65
  • 89
16
votes
3 answers

Selecting some distinct and some not-distinct tags in SPARQL

I'm trying to query DBPedia for a list of properties relating to a given class in the ontology, but since the human-readable "labels" aren't always clear, I'd also like to provide an example from the database. The problem is that while I want to…
Paul
  • 10,381
  • 13
  • 48
  • 86
16
votes
1 answer

Filter by date range in SPARQL

I am using Jena's SPARQL engine and trying to write a query to filter on a date range as I need to find the value of a property after a fixed date. My date property is in the following format: Fri May 23 10:20:13 IST 2014 How do I write a SPARQL…
cooljohny
  • 656
  • 5
  • 13
  • 31
16
votes
4 answers

Specify multiple rdf:types in a SPARQL query

I have a SPARQL query like this PREFIX prefix: SELECT * WHERE { ?x rdf:type ?type . } Suppose now I want to specify the type of ?type as being either prefix:type1 or prefix:type2; how should this be done?
Noor
  • 19,638
  • 38
  • 136
  • 254
15
votes
1 answer

RDF / Graph to Object Mapping Framework

Has anyone used, implemented, knows or just have heard of any graph (especially RDF) to object mapping frameworks for java. We are evaluating frameworks at the moment. So far we have: KMS JenaBean Alibaba Elmo Tinkerpop Stack - Especially…
Thomas Fritz
  • 1,285
  • 9
  • 12
15
votes
6 answers

Versioned RDF store

Let me try rephrasing this: I am looking for a robust RDF store or library with the following features: Named graphs, or some other form of reification. Version tracking (probably at the named graph level). Privacy between groups of users, either…
Mat
  • 82,161
  • 34
  • 89
  • 109
15
votes
1 answer

What is the use of @vocab in JSON-LD and what is the difference to @context?

What is the @vocab attribute in JSON-LD for? As I see it you can "import" a remote vocabulary, but isn't this the same you can do with @context? If I'm not wrong then you can "import" a remote source for @context as well. So where is the difference…
el-lugy
  • 378
  • 2
  • 15
15
votes
2 answers

CONSTRUCT into a named graph

I am attempting to use a SPARQL Construct query to create a new named graph from an existing one. The database I am querying contains http://graph.com/old as an existing named graph. I am using Jena TDB as the database, accessed through a Jena…
Yoav Zimmerman
  • 588
  • 4
  • 11
14
votes
2 answers

What is the SPARQL query to get the name of all graphs existing in my triplestore?

I want to get the name of all existing graphs in my Fuseki server, it should return a message with a list of all graphs name.
user3457185
  • 175
  • 1
  • 1
  • 7
14
votes
5 answers

What is a good RDF library for .net?

I'm looking for a library that can deal with RDF and OWL data. So far I have found: semweb (no owl support for all I know) rowlex (more of a 'browser' application) Your recommendations: LinqToRdf (very interesting, thanks mark!)
kitsune
  • 11,516
  • 13
  • 57
  • 78
14
votes
3 answers

SPARQL DESCRIBE query

Seems I don't grok SPARQL DESCRIBE queries. I need to retrieve the full graphs of resources matching a condition. On one SPARQL endpoint I have tried (Norwegian Rådata Nå, http://data.bibsys.no/data/query_authority.html) this works just fine: PREFIX…
Nils Weinander
  • 2,081
  • 2
  • 15
  • 20
14
votes
3 answers

How is OWL actually used when building a semantic web application?

I've been reading about semantic web technologies such as RDF and OWL, and am intrigued about the possibilities of building an RDF / triple-store semantic database on top of my existing relational DBs. It's simply an R&D exercise, to see what I can…
user888734
  • 3,797
  • 5
  • 36
  • 67