Skip to content
Browse files

example 9

  • Loading branch information...
1 parent 1596c2b commit 613463d3c14af0e1c75e060b602fe5b696589815 @gigasquid committed Jul 6, 2011
Showing with 111 additions and 0 deletions.
  1. +45 −0 example_9.rb
  2. +52 −0 vc-db-3.rdf
  3. +14 −0 vc-db-4.rdf
View
45 example_9.rb
@@ -0,0 +1,45 @@
+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'
+
+java_import 'com.hp.hpl.jena.rdf.model.ModelFactory'
+java_import 'com.hp.hpl.jena.util.FileManager'
+java_import 'java.io.InputStream'
+
+file_name_1 = "vc-db-3.rdf"
+file_name_2 = "vc-db-4.rdf"
+
+#Creating a model
+m1 = ModelFactory.create_default_model
+m2 = ModelFactory.create_default_model
+
+#Finding the input file using the Jena File Manager
+input_file_1 = FileManager.get.open file_name_1
+input_file_2 = FileManager.get.open file_name_2
+
+#read the RDF/XML file
+m1.read(input_file_1, nil)
+m2.read(input_file_2, nil)
+
+#Union of the 2 models
+m_union = m1.union(m2)
+
+m_union.write(java.lang.System::out)
+
+
+
+
+
+
+
+
+
View
52 vc-db-3.rdf
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<rdf:RDF
+ xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
+ xmlns:vCard='http://www.w3.org/2001/vcard-rdf/3.0#'
+ xmlns:info='http://somewhere/peopleInfo#'
+ >
+
+ <rdf:Description rdf:about="http://somewhere/JohnSmith/">
+ <vCard:FN>John Smith</vCard:FN>
+ <info:age>25</info:age>
+ <vCard:N rdf:parseType="Resource">
+ <vCard:Family>Smith</vCard:Family>
+ <vCard:Given>John</vCard:Given>
+ </vCard:N>
+ <vCard:TEL rdf:parseType="Resource">
+ <rdf:value>+44 117 555 5555</rdf:value>
+ <rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#work"/>
+ <rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#voice"/>
+ </vCard:TEL>
+ <vCard:TEL rdf:parseType="Resource">
+ <rdf:value>+44 117 555 7777</rdf:value>
+ <rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#home"/>
+ <rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#voice"/>
+ </vCard:TEL>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="http://somewhere/RebeccaSmith/">
+ <vCard:FN>Becky Smith</vCard:FN>
+ <info:age>23</info:age>
+ <vCard:N rdf:parseType="Resource">
+ <vCard:Family>Smith</vCard:Family>
+ <vCard:Given>Rebecca</vCard:Given>
+ </vCard:N>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="http://somewhere/SarahJones/">
+ <vCard:FN>Sarah Jones</vCard:FN>
+ <vCard:N rdf:parseType="Resource">
+ <vCard:Family>Jones</vCard:Family>
+ <vCard:Given>Sarah</vCard:Given>
+ </vCard:N>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="http://somewhere/MattJones/">
+ <vCard:FN>Matt Jones</vCard:FN>
+ <vCard:N
+ vCard:Family="Jones"
+ vCard:Given="Matthew"/>
+ </rdf:Description>
+
+</rdf:RDF>
View
14 vc-db-4.rdf
@@ -0,0 +1,14 @@
+<rdf:RDF
+ xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
+ xmlns:vCard='http://www.w3.org/2001/vcard-rdf/3.0#'
+ >
+
+ <rdf:Description rdf:about="http://somewhere/JohnSmith/">
+ <vCard:FN>John Smith</vCard:FN>
+ <vCard:EMAIL rdf:parseType="Resource">
+ <rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#internet"/>
+ <rdf:value>John@somewhere.com</rdf:value>
+ </vCard:EMAIL>
+ </rdf:Description>
+
+</rdf:RDF>

0 comments on commit 613463d

Please sign in to comment.
Something went wrong with that request. Please try again.