Author Archives: latencio

SPARQL Reference

SPARQL  is the language used to query RDF graphs. Through Jena’s ARQ API, you can create SPARQL queries in order to answer questions about your model. Here is a useful and concise reference guide:

In addition, here is a link to a simple tutorial:

JADE Behaviors

JADE provides a concept called a Behavior. A Behavior is a means by which agents can execute actions, such as sending messages. Two very common types of behaviors are the Ticker Behavior ( and the CyclicBehavior (


This abstract class implements a behavior that periodically executes a user-defined piece of code. The user is expected to extend this class re-defining the method onTick() and including the piece of code that must be periodically executed into it. In essence, this is very similar to a scheduled task or a Unit cron task. This behavior is very useful for monitoring states periodically.


This class implements an atomic behaviour that must be executed forever. This abstract class can be extended by application programmers to create behaviours that keep executing continuously (e.g. simple reactive behaviours).

In both cases, the expectation is that the application programmer overrides the action() method in order to provide application specific implementation. Agents can have any number of behaviors and sub-behaviors executing at different internals. The only thing to remember is that behaviors, once executed, will execute until completion. This makes the model very simple and makes sharing of state very straightforward.


Luis Atencio

Terse RDF Triple Language (Turtle)

RDF is a general-purpose declarative language (based on XML) for representing information such as resources or entities on the web.

Proposed by Tim Berners-Lee and David Beckett, the Turtle syntax is aimed at providing a compact and more human-readable notation for RDF. It adds shorthand notation for common patterns and datatypes as well as being compatible with SPARQL syntax — actually SPARQL query syntax for WHERE clauses is very similar to Turtle.

All RDF written in Turtle should be usable inside SPARQL which uses a Turtle syntax for building RDF graphs in its CONSTRUCT clause.

Now we present a brief syntax summary:

In  Turtle, there are 3 types of RDF Terms: RDF URI References, literlas, and blank nodes.

A RDF term is a URI enclosed in brackets. For example:


These are typically abbreviated using Turtle’s @prefix tag.

Literals are written in double quotes as such: “Mary” or “Daisy”. Alternatively, you can wrap the literal in ” ” ” long lone ” ” ” to indicate that the literal might contain line breaks. In addition, you can give literals a language suffix: “Disney World”@en or “El Mundo Disney”@es.

Blank nodes are written as _nodeId: or can also be made with [ ].

Comments in Turtle are created using the hash (#) symbol.

Every complete triple has a dot (.) at the end. A semi colon (;) is valid when the original subject is reused for two or more triples. A comma (,) can be used when reusing a common subject and predicate.

The following is an example Turtle document:

@prefix rdf: <> .
@prefix dc: <> .
@prefix ex: <> .

  dc:title "RDF/XML Syntax Specification (Revised)" ;
  ex:editor [
    ex:fullname "Dave Beckett";
    ex:homePage <>
  ] .




RDFa stands for Resource Description Framework-in attributes and provides a set of XHTML attributes to enhance visual data with machine-readable hints. This standard originates to tackle today’s web which has been built predominantly for human consumption. Even as machine-readable data begins to appear on the web, it is typically distributed in a separate file, with a separate format, and very limited correspondence between the human and machine versions. As a result, web browsers can provide only minimal assistance to humans in parsing and processing web data: browsers only see presentation information.

With RDFa we can embed rich metadata within XHTML documents. This metadata has the form of RDF triples User-Predicate-Object. Some examples of RDFa attributes are the following:

  • about and src – a URI or curie specifying the resource the metadata is about
  • rel and rev – specifying a relationship or reverse-relationship with another resource
  • href and resource – specifying the partner resource
  • property – specifying a property for the content of an element
  • content – optional attribute that overrides the content of the element when using the property attribute
  • datatype – optional attribute that specifies the datatype of text specified for use with the property attribute
  • typeof – optional attribute that specifies the RDF type(s) of the subject (the resource that the metadata is about).

Users can easily combine there attributres with other schemas such as FOAF into web pages in order to build rich compelling social sites. For example,  an event on a web page can be directly imported into a user’s desktop calendar.  A photo’s creator, camera setting information, resolution, and topic can be published as easily as the original photo itself, enabling structured search and sharing. Geo location can be embedded so that users can easily track authors of articles.

RDFa has demonstrate quite an impressive growth in recent years. New research released by Yahoo! shows that RDFa demonstrated explosive growth in 2010 as the  fastest growing data markup format on the Web, and is used on more than 430 million web pages. It accounts for roughly 3.6% of the all of the Web pages on the Internet. How much did RDFa grow last year? 510% .





Open Graph Protocol

The Open Graph Protocol (hereafter just OGP) enables a web site to display rich content in a social graph. This is a very simple but powerful concept, one which sites like Facebook have pioneered and leveraged extensively.

In order for a web site to become part of a social graph, you must add a set of meta data to the page. The protocol implemented relies on RDFa. RDF is the Resource Description Framework, and it is basically a language for modeling different optimized for sharing and interchange of information. RDFa simply adds a set of extra attributes to the XHTML standard in order to support the extra meta needed for OGP.

Basic Metadata

  • og:title : The title of your object as it should appear within the graph.
  • og:type : The type of your object, e.g., “movie”. Depending on the type you specify, other properties may also be required.
  • og:image : An image URL which should represent your object within the graph.
  • og:url : The canonical URL of your object that will be used as its permanent ID in the graph.

With this basic information, your web site can be mapped in a social graph. In addition, there are other types of meta you can add including: location, audio, video, etc.

  • og:latitude – e.g., “37.416343″.
  • og:longitude – e.g., “-122.153013″.

If you wish to specify a human readable address, include the following five properties:

  • og:street-address – e.g., “1601 S California Ave”
  • og:locality – e.g, “Palo Alto”
  • og:region – e.g., “CA”
  • og:postal-code e.g., “94304″
  • og:country-name – e.g., “USA”

After you add all of the meta data of your choice, you can visit: and see how your site was parsed. Go ahead and try it with this site!



Stay Tuned! visit