Alignment API and Server 4.0

fr.inrialpes.exmo.align.parser
Class RDFParser

java.lang.Object
  extended by fr.inrialpes.exmo.align.parser.RDFParser

public class RDFParser
extends Object

Parser for the EDOAL syntax. The reader is Jena, input is an EDOALAlignment The input document format shall be consistent with format document

$Id: RDFParser.java 1412 2010-03-31 13:57:07Z euzenat $

Version:
$Revision: 1.7 $
Author:
Richard Pöttler

Field Summary
private  EDOALAlignment alignment
           
private  int debug
           
private  boolean isPattern
           
private static Logger logger
           
private static com.hp.hpl.jena.rdf.model.Model rDFModel
           
 
Constructor Summary
RDFParser()
          Creates an RDF Parser.
RDFParser(int debugMode)
          Creates an RDF Parser.
 
Method Summary
protected  URI getNodeId(com.hp.hpl.jena.rdf.model.Resource node)
           
static void initSyntax()
          Initialisation of the structures This creates an RDF Model which contains all the syntactic elements.
 EDOALAlignment parse(File file)
           
 EDOALAlignment parse(InputStream is)
           
 EDOALAlignment parse(com.hp.hpl.jena.rdf.model.Model rdfmodel)
          Parse the input model.
 EDOALAlignment parse(Reader is)
           
 EDOALAlignment parse(String uri)
           
 EDOALAlignment parseAlignment(com.hp.hpl.jena.rdf.model.Resource node)
          Parses a mapping document.
protected  void parseAnnotation(com.hp.hpl.jena.rdf.model.Statement stmt, EDOALAlignment al)
          Parses a given annotaion in the the given node.
protected  EDOALCell parseCell(com.hp.hpl.jena.rdf.model.Resource node)
          Parses a mapping rule.
protected  ClassExpression parseClass(com.hp.hpl.jena.rdf.model.Resource node)
           
protected  Expression parseExpression(com.hp.hpl.jena.rdf.model.Resource node)
           
protected  InstanceExpression parseInstance(com.hp.hpl.jena.rdf.model.Resource node)
           
protected  Ontology parseOntology(com.hp.hpl.jena.rdf.model.Resource node)
          Parse an ontology node <onto1> or <onto2> Node to an Ontology object.
protected  PathExpression parsePathExpression(com.hp.hpl.jena.rdf.model.Resource node)
           
protected  PropertyExpression parseProperty(com.hp.hpl.jena.rdf.model.Resource node)
           
protected  RelationExpression parseRelation(com.hp.hpl.jena.rdf.model.Resource node)
           
protected  ValueExpression parseValue(com.hp.hpl.jena.rdf.model.RDFNode node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static Logger logger

rDFModel

private static com.hp.hpl.jena.rdf.model.Model rDFModel

debug

private int debug

isPattern

private boolean isPattern

alignment

private EDOALAlignment alignment
Constructor Detail

RDFParser

public RDFParser()
Creates an RDF Parser.


RDFParser

public RDFParser(int debugMode)
Creates an RDF Parser.

Parameters:
debugMode - The value of the debug mode
Method Detail

initSyntax

public static void initSyntax()
Initialisation of the structures This creates an RDF Model which contains all the syntactic elements. This is to be called before parsing, i.e., before exploring RDF resources


parse

public EDOALAlignment parse(com.hp.hpl.jena.rdf.model.Model rdfmodel)
                     throws AlignmentException
Parse the input model. The model shall include one statement that include (?,RDF.type,Alignment)

Parameters:
align -
Returns:
the result EDOALAlignment
Throws:
AlignmentException - if there is any exception, throw AlignmentException that include describe infomation and a caused exception.

parse

public EDOALAlignment parse(File file)
                     throws AlignmentException
Throws:
AlignmentException

parse

public EDOALAlignment parse(Reader is)
                     throws AlignmentException
Throws:
AlignmentException

parse

public EDOALAlignment parse(InputStream is)
                     throws AlignmentException
Throws:
AlignmentException

parse

public EDOALAlignment parse(String uri)
                     throws AlignmentException
Throws:
AlignmentException

parseAlignment

public EDOALAlignment parseAlignment(com.hp.hpl.jena.rdf.model.Resource node)
                              throws AlignmentException
Parses a mapping document. The resource passed to this method must be a <Alignment> tag.

Parameters:
node - the alignment resource
Returns:
the parsed mapping document
Throws:
AlignmentException

parseOntology

protected Ontology parseOntology(com.hp.hpl.jena.rdf.model.Resource node)
                          throws AlignmentException
Parse an ontology node <onto1> or <onto2> Node to an Ontology object. The node must contain the <onto...> element.

Parameters:
node - the ontology node
Returns:
the Ontology object
Throws:
NullPointerException - if the node is null
AlignmentException

parseCell

protected EDOALCell parseCell(com.hp.hpl.jena.rdf.model.Resource node)
                       throws AlignmentException
Parses a mapping rule. The parsed node must be a Cell resource including the mandatory Statement. <Cell> tag.

Parameters:
node - the <Cell> tag
Returns:
the parsed rule
Throws:
AlignmentException

parseExpression

protected Expression parseExpression(com.hp.hpl.jena.rdf.model.Resource node)
                              throws AlignmentException
Throws:
AlignmentException

parseClass

protected ClassExpression parseClass(com.hp.hpl.jena.rdf.model.Resource node)
                              throws AlignmentException
Throws:
AlignmentException

parsePathExpression

protected PathExpression parsePathExpression(com.hp.hpl.jena.rdf.model.Resource node)
                                      throws AlignmentException
Throws:
AlignmentException

parseProperty

protected PropertyExpression parseProperty(com.hp.hpl.jena.rdf.model.Resource node)
                                    throws AlignmentException
Throws:
AlignmentException

parseRelation

protected RelationExpression parseRelation(com.hp.hpl.jena.rdf.model.Resource node)
                                    throws AlignmentException
Throws:
AlignmentException

parseInstance

protected InstanceExpression parseInstance(com.hp.hpl.jena.rdf.model.Resource node)
                                    throws AlignmentException
Throws:
AlignmentException

parseValue

protected ValueExpression parseValue(com.hp.hpl.jena.rdf.model.RDFNode node)
                              throws AlignmentException
Throws:
AlignmentException

getNodeId

protected URI getNodeId(com.hp.hpl.jena.rdf.model.Resource node)
                 throws AlignmentException
Throws:
AlignmentException

parseAnnotation

protected void parseAnnotation(com.hp.hpl.jena.rdf.model.Statement stmt,
                               EDOALAlignment al)
                        throws AlignmentException
Parses a given annotaion in the the given node.

Parameters:
node - which is the parent of the annotation node
e - the tag which contains the annotation.
Throws:
NullPointerException - if the node or the element is null
AlignmentException

Alignment API and Server 4.0

(C) INRIA & friends, 2003-2010