se.kmr.scam.rdf.util
Class Import

java.lang.Object
  extended byse.kmr.scam.rdf.util.Import

public class Import
extends Object

Helper for importing RDF. Primarily to be used for IMS Content Packaging models.
An insertionpoint is the object from IMSCP.manifest pointed by SCAM.include.

Title:

Description:

Copyright: Copyright (c) 2002

Company:

Version:
$Revision $
Author:
jand

Field Summary
protected static org.apache.log4j.Category LOG
          Log4j-logger
 
Constructor Summary
Import()
           
 
Method Summary
static Resource importResource(Model dest, Model src, Resource res)
          Standard import of a resource (non-IMS Container).
static Resource importSubItem(Model dest, Model src, Resource iPoint, Resource item)
          Import a sub-item from one model to another.
static Model IMSCP(Model dest, Model src)
          Method for importing IMS Content Packaging models.
static void main(String[] args)
           
static Model simple(Model dest, Model src)
          Method for importing metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.log4j.Category LOG
Log4j-logger

Constructor Detail

Import

public Import()
Method Detail

IMSCP

public static Model IMSCP(Model dest,
                          Model src)
                   throws RDFException
Method for importing IMS Content Packaging models. Multiple IMSCP.manifest OK in source model. Multiple insertionpoints OK for each IMSCP.manifest. Non-existing insertionpoints will be inserted in a default IMS Container. If a sub-item or resource already exists, that old sub-model will be replaced. New sub-items will be inserted last (next ordinal) at insertionpoint.
Note: This will NOT change existing insertionpoint's metadata!
Note: Requires matching IMSCP.manifest:s.

"RDF Syntax:"

     <rdf:RDF
     xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
     xmlns:imscp='http://www.imsproject.org/xsd/ims_cp_rootv1p1#'
     xmlns:scam='http://kmr.nada.kth.se/scam#'>

     <rdf:Description rdf:about='http://ulldb.ull.uu.se:8080/jand/manifest'>
     <rdf:type rdf:resource='http://www.imsproject.org/xsd/ims_cp_rootv1p1#manifest'/>
     <scam:include rdf:resource='http://ulldb.ull.uu.se:8080/jand/hierarchy/1'/>
     <scam:include rdf:resource='http://www.unt.se'/>
     </rdf:Description>

     <!-- This resource is an IMS Container -> IMSCP import -->
     <!-- If .../hierarchy/1 exist at destination, all the children (../item/99) will be inserted there -->
     <!-- If it does not exist, it will be inserted in a default IMS Container -->
     <rdf:Description rdf:about='http://ulldb.ull.uu.se:8080/jand/hierarchy/1'>
     <rdf:type rdf:resource='http://www.imsproject.org/xsd/ims_cp_rootv1p1#item'/>
     <rdf:_1 rdf:resource='http://ulldb.ull.uu.se:8080/jand/item/99'/>
     </rdf:Description>

     <!-- If this resource exist in destination, it will be replaced by this new sub-model (same ordinal at parent) -->
     <!-- Otherwise it will be inserted last -->
     <rdf:Description rdf:about='http://ulldb.ull.uu.se:8080/jand/item/99'>
     <rdf:type rdf:resource='http://www.imsproject.org/xsd/ims_cp_rootv1p1#item'/>
     <imscp:content rdf:resource='http://www.unt.se'/>
     <!-- Metadata -->
     </rdf:Description>

     <!-- Non-IMS Container -> basic import (replace or add) -->
     <rdf:Description rdf:about='http://www.unt.se'>
     <!-- Metadata -->
     </rdf:Description>
     ...
     ...
     </rdf:RDF>
 

Parameters:
dest - Destination model
src - Source Model
Returns:
Same as param dest
Throws:
RDFException
To do:
validation of correct IMSCP

simple

public static Model simple(Model dest,
                           Model src)
                    throws RDFException
Method for importing metadata. If a resource already exists, the old sub-resource-model will be replaced.
Note: This is a "brute-force" import, NO consideration is taken if some resources are IMS Resources.

Parameters:
dest - Destination model
src - Source Model
Returns:
Same as param dest
Throws:
RDFException
To do:
validation for correct metadata

importSubItem

public static Resource importSubItem(Model dest,
                                     Model src,
                                     Resource iPoint,
                                     Resource item)
                              throws RDFException
Import a sub-item from one model to another. If a sub-item already exists, the old sub-item-model will be replaced, otherwise it will be inserted last (next ordinal).

Parameters:
dest - Destination model
src - Source model
iPoint - "Parent" (IMSCP Container)
item - "Child"
Returns:
The imported sub-item (destination)
Throws:
RDFException
To do:
Check if item is an IMS Container?

importResource

public static Resource importResource(Model dest,
                                      Model src,
                                      Resource res)
                               throws RDFException
Standard import of a resource (non-IMS Container). If a resource already exists, the old resource-model will be replaced. Verifying that source and destination resource has the same type (IMS Container or non-IMS Container).

Parameters:
dest - Destination model
src - Source model
res - Resource
Returns:
The imported resource (destination)
Throws:
RDFException

main

public static void main(String[] args)


Copyright © 2003 SCAM. All Rights Reserved.