Permalink
Browse files

added readme

  • Loading branch information...
1 parent 674947e commit f7dab4574877807fb0d712c4a303d9315388cce9 @gigasquid committed Jun 28, 2011
Showing with 19 additions and 5 deletions.
  1. +12 −0 README.md
  2. +7 −5 example_1.rb
View
@@ -0,0 +1,12 @@
+# JRuby Semantic Web Examples
+
+These are some examples in JRuby following along the examples
+given in the
+in [Jean API Docs](http://openjena.org/tutorial/RDF_API/index.html).
+
+## Running
+
+Run the examples with jruby
+
+
+
View
@@ -9,19 +9,21 @@
require 'javalib/stax-api-1.0.1.jar'
require 'javalib/wstx-asl-3.2.9.jar'
require 'javalib/xercesImpl-2.7.1.jar'
+require 'java'
-#java_import com.hp.hpl.jena.vocabulary.VCARD
-
+java_import 'com.hp.hpl.jena.vocabulary.VCARD'
+java_import 'com.hp.hpl.jena.rdf.model.ModelFactory'
#Creating a model
-m = Java::com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel
-
+m = ModelFactory.create_default_model
#Creating a resource
person_uri = "http://somewhere/JohnSmith"
full_name = "John Smith"
john_smith = m.create_resource(person_uri)
-john_smith.add_property(com.hp.hpl.jena.vocabulary.VCARD::FN, fullName)
+john_smith.add_property(VCARD::FN, full_name)
+m.write(java.lang.System::out)
+

0 comments on commit f7dab45

Please sign in to comment.