3 sep 2012

Resource Desciptor Framework

RDF

In my own words the Resource Descriptor Framework (RDF) is a way to get/indicate specific information (metadata) about resources in the Web.
By example, you cannot get the name of the author of the page www.example.org/index.html.
But with the RDF specification, you are able to provide this information.

For the statement

http://www.example.org/index.html has a creator whose value is John Smith
 
There are 3 terms in the RDF specification:
  • The subject (http://www.example.org/index.html)
  • The predicate (creator)
  • The object (John Smith)
There is a graphic way to describe the statement:

The triples notation allows us to write down the statement in a 3 peers way:
ex:index.html   dc:creator   exstaff:85740 .

We can also have blank nodes, that allows us to get information from the resource.
exstaff:85740   exterms:address         _:johnaddress .
_:johnaddress   exterms:street          "1501 Grant Avenue" .
_:johnaddress   exterms:city            "Bedford" .
_:johnaddress   exterms:state           "Massachusetts" .
_:johnaddress   exterms:postalCode      "01730" .

We can request the type of the object:
ex2terms:book78354   rdf:type          ex2terms:Book .
ex2terms:book78354   ex2terms:author   _:author78354 .
_:author78354        rdf:type          ex2terms:Person .
_:author78354        ex2terms:name     "Jane Smith" .


What about the specification of the data (by default all is a string)
ex:index.html  exterms:creation-date  "1999-08-16"^^xsd:date .

How does it looks in code?

1.  
2.  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
3.              xmlns:dc="http://purl.org/dc/elements/1.1/"
4.              xmlns:exterms="http://www.example.org/terms/">

5.    <rdf:Description rdf:about="http://www.example.org/index.html">
6.         <exterms:creation-date rdf:datatype=
         "http://www.w3.org/2001/XMLSchema#date">1999-08-16
           
7. <dc:language>en 8. <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> 9. 10.
How about a set of products?

1.   
2.   ]>
3.   xml:base="http://www.example.com/2002/04/products">
6. rdf:ID="item10245"> 7. rdf:resource="http://www.example.com/terms/Tent"/> 8. Overnighter 9. 2 10. 2.4 11. 784 12. ...other product descriptions... 13.
This is the subject:
http://www.example.com/2002/04/products#item10245



References 

http://www.w3.org/TR/rdf-primer/


28 may 2012

Colecciones

Resumen de Colecciones de Java


Set

Interface que no permite tener duplicados. Extiende a Collection y a Iterable.

Implementaciones

HashSet: Mejor performance, sin garantia de ordenamiento.
TreeSet: Ordenamiento de acuerdo al valor del objeto en un reb-black tree. Por lo tanto más lenta que un HashSet.
LinkedHashSet: Ordenada de acuerdo al orden en que son introducidos los objetos. Una tabla Hash  con una Lista Ordenada sobre la tabla. Un poco menos eficiente que el HashSet.

List

Interface que permite tener duplicados y ordenamiento.
Las implementanciones de listas nos proveen de nuevos metodos:

  • Acceso a los elementos de acuerdo a su posición.
  • Busqueda.
  • Iterador de ambas direcciones.
  • Sub listas de acuerdo a rangos.

Implementaciones

ArrayLink: Mejor performance.
LinkedList: Mejor performance bajo ciertas circunstancias.
Vector: Anteriormente no implementaba List.

Queue

Interfaz para implementar una cola, tiene muchas clases que implementan sus metodos. Un buen ejemplo es el PriorityQueue.

Map

Un conjunto de llave (única) y un valor. No hereda de Collection.

Implementaciones

HashMap: Mejor performance, sin garantia de ordenamiento.
TreeMap: Ordenamiento de acuerdo al valor del objeto en un reb-black tree. Por lo tanto más lenta que un HashMap.
LinkedHashMap: Ordenada de acuerdo al orden en que son introducidos los objetos. Una tabla Hash  con una Lista Ordenada sobre la tabla. Un poco menos eficiente que el HashSet.



http://docs.oracle.com/javase/tutorial/collections/index.html