Skip to content

Commit

Permalink
Cleaning up example 6
Browse files Browse the repository at this point in the history
  • Loading branch information
gigasquid committed Jul 7, 2011
1 parent 419bc58 commit 476a5ad
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions example_6.rb
@@ -1,13 +1,9 @@
require 'javalib/jena-2.6.4.jar'
require 'javalib/arq-2.8.7.jar'
require 'javalib/icu4j-3.4.4.jar'
require 'javalib/iri-0.8.jar'
require 'javalib/log4j-1.2.13.jar'
require 'javalib/lucene-core-2.3.1.jar'
require 'javalib/slf4j-api-1.5.8.jar'
require 'javalib/slf4j-log4j12-1.5.8.jar'
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'

Expand All @@ -16,19 +12,20 @@
java_import 'com.hp.hpl.jena.vocabulary.VCARD'
java_import 'java.io.InputStream'

john_smith_uri = "http://somewhere/JohnSmith/"
#Tutorial navigating a model

john_smith_uri = "http://somewhere/JohnSmith/"
#Creating a model
m = ModelFactory.create_default_model
model = ModelFactory.create_default_model

#Finding the input file using the Jena File Manager
input_file = FileManager.get.open "sample_input.rdf"

#read the RDF/XML file
m.read(input_file, nil)
model.read(input_file, nil)

#Retreive the john_smith vcard from the model and properties
vcard = m.get_resource(john_smith_uri)
vcard = model.get_resource(john_smith_uri)
name = vcard.get_required_property(VCARD::N).get_object
full_name = vcard.get_required_property(VCARD::FN).get_string;

Expand Down

0 comments on commit 476a5ad

Please sign in to comment.