My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package example.thing;

import thewebsemantic.Thing;
import thewebsemantic.vocabulary.DCTerms;
import thewebsemantic.vocabulary.Rdfs;
import thewebsemantic.vocabulary.Sioc;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.RDFWriter;

public class SiocWriteExample {
private static final String uri9 = "http://johnbreslin.com/blog/category/semantic-web/";
private static final String literal1 = "SIOC provides a unified vocabulary for content and interaction description: a semantic layer that can co-exist with existing discussion platforms.";
private static final String uri8 = "http://johnbreslin.com/blog/index.php?sioc_type=comment&sioc_id=123928";
private static final String uri7 = "http://johnbreslin.com/blog/2006/09/07/creating-connections-between-discussion-clouds-with-sioc/#comment-123928";
private static final String uri6 = "http://johnbreslin.com/blog/category/blogs/";
private static final String uri4 = "http://johnbreslin.com/blog/index.php?sioc_type=user&sioc_id=1";
private static final String uri3 = "http://johnbreslin.com/blog/author/cloud/";
private static final String uri2 = "http://johnbreslin.com/blog/index.php?sioc_type=site#weblog";
private static final String uri1 = "http://johnbreslin.com/blog/2006/09/07/creating-connections-between-discussion-clouds-with-sioc/";

public static void main(String[] args) {
Model m = ModelFactory.createDefaultModel();
m.setNsPrefix("sioc", Sioc.NS);
m.setNsPrefix("dcterms", "http://purl.org/dc/terms/");
Thing thing = new Thing(m);
thing.at(uri1).
as(DCTerms.class).
title("Creating connections between discussion clouds with SIOC").
created("2006-09-07T09:33:30Z").
isa(Sioc.Post.class).
has_container(thing.at(uri2)).
has_creator(
thing.at(uri3).isa(Sioc.User.class).
seeAlso( thing.at(uri4))).
content(literal1).
topic(thing.at(uri6).as(Rdfs.class).label("blogs")).
topic(thing.at(uri9).as(Rdfs.class).label("SemanticWeb")).
has_reply(
thing.at(uri7).
isa(Sioc.Post.class).
seeAlso(thing.at(uri8)));

// this intends to format the rdf as closely as possible
// with the example being duplicated.
RDFWriter w = m.getWriter("RDF/XML-ABBREV");
w.setProperty( "blockRules" , "" );
w.write(m, System.out, null);

}
}
Show details Hide details

Change log

r741 by thewebsemantic on Mar 10, 2009   Diff
[No log message]
Go to: 
Project members, sign in to write a code review

Older revisions

r739 by thewebsemantic on Mar 09, 2009   Diff
[No log message]
r737 by thewebsemantic on Mar 09, 2009   Diff
[No log message]
r732 by thewebsemantic on Mar 08, 2009   Diff
[No log message]
All revisions of this file

File info

Size: 2415 bytes, 52 lines
Hosted by Google Code