gr.forth.ics.rdfsuite.swkm.model.impl
Class RDF_Model

java.lang.Object
  extended by gr.forth.ics.rdfsuite.swkm.model.impl.RDF_Model
All Implemented Interfaces:
IRDF_Model
Direct Known Subclasses:
RDFDB_Model

public class RDF_Model
extends java.lang.Object
implements IRDF_Model


Field Summary
protected  AvailableStreams available_streams
           
protected  RDF_DAG class_dag
          Utility variables
protected  java.util.HashMap<java.lang.String,IRDF_Individual> class_instances
          RDF object variables
protected  org.apache.commons.collections.MultiMap comments
           
protected  org.apache.commons.collections.MultiMap comments_hashed_on_object
           
protected  java.util.Map comments_hashed_on_subject_object
           
protected  java.util.HashMap<java.lang.String,IRDF_Container> containers
           
protected  org.apache.commons.collections.MultiMap domains
           
protected  org.apache.commons.collections.MultiMap domains_hashed_on_object
           
protected  java.util.Map domains_hashed_on_subject_object
           
protected  boolean fetch_all_ns
           
protected  java.util.HashMap<java.lang.String,IRDF_Graphspace> graphspaces
           
 HierarchyLabeler hlabel
           
protected  org.apache.commons.collections.MultiMap isdefinedbys
           
protected  org.apache.commons.collections.MultiMap isdefinedbys_hashed_on_object
           
protected  java.util.Map isdefinedbys_hashed_on_subject_object
           
protected  boolean label_created
           
protected  org.apache.commons.collections.MultiMap labels
           
protected  org.apache.commons.collections.MultiMap labels_hashed_on_object
           
protected  java.util.Map labels_hashed_on_subject_object
           
protected  java.util.HashMap<java.lang.String,IRDF_Literal> literals
           
protected static org.apache.log4j.Logger log
           
protected  org.apache.commons.collections.MultiMap members
           
protected  org.apache.commons.collections.MultiMap members_hashed_on_object
           
protected  java.util.Map members_hashed_on_subject_object
           
protected  RDF_DAG meta_class_dag
           
protected  RDF_DAG meta_property_dag
           
static gr.forth.ics.taskmonitor.Monitor monitor
           
protected  java.util.HashMap<java.lang.String,IRDF_Namespace> namespaces
           
protected  java.util.HashMap<IRDF_Statement,IRDF_Object> objects
           
protected  java.util.HashMap<java.lang.Object,IRDF_Object> objects_hashed_on_object
           
protected  java.util.HashMap<MultiKey,IRDF_Object> objects_hashed_on_subject_object
           
static java.lang.String PLAIN_TRIPLES
           
protected  java.util.HashMap<IRDF_Statement,IRDF_Predicate> predicates
           
protected  java.util.HashMap<IRDF_Resource,IRDF_Predicate> predicates_hashed_on_object
           
protected  java.util.HashMap<MultiKey,IRDF_Predicate> predicates_hashed_on_subject_object
           
protected  java.util.Map<java.lang.String,java.util.List<java.util.Map>> predicatesMaps
           
protected  RDF_DAG property_dag
           
protected  org.apache.commons.collections.MultiMap property_instances
           
protected  java.util.Map property_instances_hashed_on_all
           
protected  org.apache.commons.collections.MultiMap property_instances_hashed_on_object
           
protected  org.apache.commons.collections.MultiMap property_instances_hashed_on_predicate_object
           
protected  org.apache.commons.collections.MultiMap property_instances_hashed_on_subject
           
protected  org.apache.commons.collections.MultiMap property_instances_hashed_on_subject_object
           
protected  org.apache.commons.collections.MultiMap property_instances_hashed_on_subject_predicate
           
protected  org.apache.commons.collections.MultiMap ranges
           
protected  org.apache.commons.collections.MultiMap ranges_hashed_on_object
           
protected  java.util.Map ranges_hashed_on_subject_object
           
static java.lang.String RDF_XML
           
protected  java.util.HashMap<java.lang.String,IRDF_Resource> resources
           
protected  org.apache.commons.collections.MultiMap seealsos
           
protected  org.apache.commons.collections.MultiMap seealsos_hashed_on_object
           
protected  java.util.Map seealsos_hashed_on_subject_object
           
protected  boolean strict
           
protected  org.apache.commons.collections.MultiMap subclasses
           
protected  org.apache.commons.collections.MultiMap subclasses_hashed_on_object
           
protected  java.util.Map subclasses_hashed_on_subject_object
           
protected  java.util.HashMap<IRDF_Statement,IRDF_Subject> subjects
           
protected  java.util.HashMap<IRDF_Resource,IRDF_Subject> subjects_hashed_on_object
           
protected  java.util.HashMap<MultiKey,IRDF_Subject> subjects_hashed_on_subject_object
           
protected  org.apache.commons.collections.MultiMap subproperties
           
protected  org.apache.commons.collections.MultiMap subproperties_hashed_on_object
           
protected  java.util.Map subproperties_hashed_on_subject_object
           
static long time
           
static java.lang.String TRIG
           
protected  org.apache.commons.collections.MultiMap types
           
protected  org.apache.commons.collections.MultiMap types_hashed_on_object
           
protected  java.util.Map types_hashed_on_subject_object
           
protected  ValidationParams validation_params
           
 
Constructor Summary
RDF_Model()
           
 
Method Summary
 void addClassInstance(IRDF_Individual class_instance)
          Adds a class instance in MM
 void addComment(IRDF_Resource resource, IRDF_Comment comment)
          Adds a comment relation in Main Memory
 void addContainer(IRDF_Container container)
          Adds a container in MM
 void addDomain(IRDF_Property property, IRDF_Domain domain)
          Adds a domain relation in Main Memory
 void addGraphspace(IRDF_Graphspace graphspace)
          Adds an RDF_Graphspace object in the HashMap of RDF_Graphspace objects with key its uri
 void addIsDefinedBy(IRDF_Resource resource, IRDF_IsDefinedBy isdefinedby)
          Adds a isDefinedBy relation in Main Memory
 void addLabel(IRDF_Resource resource, IRDF_Label label)
          Adds a label relation in Main Memory
 void addLiteral(IRDF_Literal literal)
           
 void addMember(IRDF_Container container, IRDF_Member member)
          Adds a member relation in Main Memory
 void addNamespace(IRDF_Namespace namespace)
          Adds an RDF_Namespace object in the HashMap of RDF_Namespace objects with key its uri
 void addObject(IRDF_Statement statement, IRDF_Object object)
          Adds a object relation in Main Memory
 void addPredicate(IRDF_Statement statement, IRDF_Predicate predicate)
          Adds a predicate relation in Main Memory
 void addPropertyInstance(IRDF_PropertyInstance property_instance)
          Adds a property instance in MM
 void addRange(IRDF_Property property, IRDF_Range range)
          Adds a range relation in Main Memory
protected  void addResource(IRDF_Resource resource)
           
 void addSeeAlso(IRDF_Resource resource, IRDF_SeeAlso seealso)
          Adds a seeAlso relation in Main Memory
 boolean addStatement(java.lang.String subject, java.lang.String predicate, java.lang.String object, java.lang.String namespace_uri, java.lang.String graphspace_uri, Position pos)
          Explicitly adds a string triple in the given namespace,graphspace When this method is not called iternally by the model, the default namespaces, rdf_scheme,rdf.xml_schema,rdfsuite should be imported using the appropriate import methods in the model.
 void addSubClass(IRDF_Class rdf_class, IRDF_SubClass subclass)
          Adds a subClass relation in Main Memory
 void addSubject(IRDF_Statement statement, IRDF_Subject subject)
          Adds a subject relation in Main Memory
 void addSubProperty(IRDF_Property property, IRDF_SubProperty subproperty)
          Adds a subProperty relation in Main Memory
 void addType(IRDF_Resource resource, IRDF_Type type)
          Adds a type relation in Main Memory
protected  void castResourcesToClasses(IRDF_MetaClass rdf_meta_class)
          This method iterates over the type triples and casts to classes all resources that are subjects of triples with object this metaclass
protected  void castResourcesToClassInstances(IRDF_Class rdf_class)
          This method iterates over the type triples and casts to class instances all resources that are subjects of triples with object this class
protected  void castResourcesToProperties(IRDF_MetaClass rdf_meta_class)
          This method iterates over the type triples and casts to properties all resources that are subjects of triples with object this metaclass(of properties)
 RDF_DAG createClassDag()
          Creates the subsumption dag for all the model's classes
 RDF_DAG createClassDag(boolean createAlways)
          getDirectAncestors returns the class itself which has to be removed in order for no loops to appear
protected  IRDF_Individual createClassInstance(java.lang.String class_instance_uri, Position pos)
           
protected  IRDF_Container createContainer(java.lang.String container_uri, int kind, Position pos)
           
 void createDags()
          Creates the subsumption dags for classes,proeprties,metaclasses,metaproperties.
 void createLabels()
          Given the class dag,property dag,metaclass dag nad metaproperty dag for this model assignes a unique label to each resource of the model
 RDF_DAG createMetaClassDag()
          Creates the subsumption dag for all the model's metaclass
 RDF_DAG createMetaClassDag(boolean createAlways)
           
 RDF_DAG createMetaPropertyDag()
          Creates the subsumprion dag for all the model's metaproperties
 RDF_DAG createMetaPropertyDag(boolean createAlways)
           
protected  void createPostorder(RDF_DAG subClassDag, RDF_DAG subPropertyDag, RDF_DAG subMetaClassDag, RDF_DAG subMetaPropertyDag)
           
 RDF_DAG createPropertyDag()
          Creates the subsumprion dag for all the model's properties
protected  RDF_PropertyInstance createPropertyInstance(java.lang.String uri, IRDF_Resource subject_resource, java.lang.Object object, Position pos)
           
 IRDF_Resource createResource(java.lang.String resource_uri, Position pos)
           
 void eliminateRedundancies()
          Eliminates redundant triples in model.
protected  void enter_alt(java.lang.String subject, Position pos, java.lang.String graphspace_uri, java.lang.String namespace_uri)
           
protected  void enter_bag(java.lang.String subject, Position pos, java.lang.String graphspace_uri, java.lang.String namespace_uri)
           
protected  void enter_class_instance(java.lang.String subject, Position pos, java.lang.String graphspace_uri, IRDF_Class object_class, java.lang.String namespace_uri)
           
protected  boolean enter_comment(java.lang.String subject, java.lang.String predicate, java.lang.String object, Position pos, java.lang.String graphspace_uri, boolean strict)
           
protected  int enter_label(java.lang.String subject, java.lang.String predicate, java.lang.String object, Position pos, java.lang.String graphspace_uri, boolean strict)
           
protected  int enter_property_instance(java.lang.String subject, java.lang.String predicate, java.lang.String object, Position pos, java.lang.String graphspace_uri, java.lang.String namespace_uri, boolean strict)
           
protected  void enter_sequence(java.lang.String subject, Position pos, java.lang.String graphspace_uri, java.lang.String namespace_uri)
           
protected  int enter_type(java.lang.String subject, java.lang.String predicate, java.lang.String object, Position pos, java.lang.String graphspace_uri, boolean strict, java.lang.String namespace_uri)
           
 AvailableStreams getAvailableStreams()
          Retrieves the Available namespace streams for building this model
 RDF_DAG getClass_dag()
           
 java.util.Collection<IRDF_Class> getClasses(boolean considerRDFNS, boolean considerXSDNS)
           
 IRDF_Individual getClassInstance(java.lang.String class_instance_uri)
          Retrieves a class instance given its uri
 java.util.HashMap<java.lang.String,IRDF_Individual> getClassInstances()
          Retrieves all class instances from MM
 java.util.Collection getComment(IRDF_Resource rdf_resource)
          Retrieves the Collection of RDF_Comment objects in which rdf_resource "participates"
 org.apache.commons.collections.MultiMap getComments()
          Retrieves all the comment relations stored in main memory
 IRDF_Comment getCommentWithSubjectAndObject(IRDF_Resource subject, IRDF_Literal object)
           
 IRDF_Container getContainer(java.lang.String container_uri)
          Retrieves a container given its uri
 java.util.HashMap<java.lang.String,IRDF_Container> getContainers()
          Retrieves all containers from MM
 java.util.Collection getDomain(IRDF_Property rdf_property)
          Retrieves the Collection of RDF_Domains objects in which rdf_property "participates"
 org.apache.commons.collections.MultiMap getDomains()
          Retrieves all the domain relations stored in main memory
 IRDF_Domain getDomainWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
 boolean getFetch_all_ns()
           
 IRDF_Graphspace getGraphspace(java.lang.String graphspace_uri)
          Retrieves an RDF_Graphspace from the MM using the given graphspace uri as a key
 java.util.HashMap<java.lang.String,IRDF_Graphspace> getGraphspaces()
          Retrieves all the Graphspaces stored in Main Memory(MM)
 HierarchyLabeler getHlabel()
           
 java.util.Collection<IRDF_Type> getInstances(IRDF_Class rdf_class)
          Retrieves the Collection of RDF_Type objects in which the given class "participates" as the type class.
 java.util.Collection getIsDefinedBy(IRDF_Resource rdf_resource)
          Retrieves the Collection of RDF_IsDefinedBy objects in which rdf_resource "participates"
 org.apache.commons.collections.MultiMap getIsDefinedBys()
          Retrieves all the isDefinedBy relations stored in main memory
 IRDF_IsDefinedBy getIsDefinedByWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
 java.util.Collection getLabel(IRDF_Resource rdf_resource)
          Retrieves the Collection of RDF_Label objects in which rdf_resource "participates"
 org.apache.commons.collections.MultiMap getLabels()
          Retrieves all the label relations stored in main memory
 boolean getLabelsCreated()
          Returns true if labels are created for this model
 IRDF_Label getLabelWithSubjectAndObject(IRDF_Resource subject, IRDF_Literal object)
           
 IRDF_Literal getLiteral(java.lang.String literal)
           
 java.util.HashMap<java.lang.String,IRDF_Literal> getLiterals()
           
 java.util.Collection getMember(IRDF_Container container)
          Retrieves the Collection of RDF_Member objects in which rdf_container "participates"
 org.apache.commons.collections.MultiMap getMembers()
          Retrieves all the container membership relations stored in main memory
 IRDF_Member getMemberWithSubjectAndObject(IRDF_Container subject, java.lang.Object object)
           
 IRDF_Member getMemberWithSubjectAndObject(IRDF_Resource subject, java.lang.Object object)
           
 RDF_DAG getMetaClass_dag()
           
 RDF_DAG getMetaProperty_dag()
           
 IRDF_Namespace getNamespace(java.lang.String namespace_uri)
          Retrieves an RDF_Namespace from the MM using the given namespace uri as a key
 java.util.HashMap<java.lang.String,IRDF_Namespace> getNamespaces()
          Retrieves all the Namespaces stored in Main Memory(MM)
 IRDF_Object getObject(IRDF_Statement rdf_statement)
          Retrieves the Collection of RDF_Object objects in which rdf_statement "participates"
 java.util.HashMap<IRDF_Statement,IRDF_Object> getObjects()
          Retrieves all the object relations stored in main memory
protected  IRDF_Comment getOrCreateCommentTriple(IRDF_Resource subject_resource, IRDF_Literal comment, boolean inferred)
           
 IRDF_Graphspace getOrCreateGraphspace(java.lang.String graphspace_uri)
          This method retrieves an RDF_Graphspace with a given uri.
protected  IRDF_Label getOrCreateLabelTriple(IRDF_Resource subject_resource, IRDF_Literal label, boolean inferred)
          If a subclass triple for subject class and object_class already exists it retrieves it ore else it creates a new one
protected  IRDF_Literal getOrCreateLiteral(java.lang.String literal)
           
protected  IRDF_Member getOrCreateMemberTriple(IRDF_Container subject_resource, java.lang.Object member, int member_index, boolean inferred)
           
 IRDF_Namespace getOrCreateNamespace(java.lang.String namespace_uri)
          This method retrieves an RDF_Namespace with a given uri from MM.
protected  IRDF_Resource getOrCreateResource(java.lang.String resource_uri, Position pos)
           
protected  IRDF_Type getOrCreateTypeTriple(IRDF_Resource subject_resource, IRDF_Resource object_resource, boolean inferred, IRDF_Namespace ns)
           
 IRDF_Predicate getPredicate(IRDF_Statement statement)
          Retrieves the Collection of RDF_Predicate objects in which statement "participates"
 java.util.HashMap<IRDF_Statement,IRDF_Predicate> getPredicates()
          Retrieves all the predicate relations stored in main memory
 java.util.Collection<IRDF_Property> getProperties(boolean considerRDFNS, boolean considerXSDNS)
           
 RDF_DAG getProperty_dag()
           
 java.util.Collection<IRDF_PropertyInstance> getPropertyInstance(java.lang.String property_instance_uri)
          Retrieves a property instance given its uri
 org.apache.commons.collections.MultiMap getPropertyInstances()
          Retrieves all the property instances stored in MM
 java.util.Collection getPropertyInstanceWithObject(java.lang.String object, java.lang.String property_instance_uri)
           
 java.util.Collection getPropertyInstanceWithSubject(java.lang.String subject, java.lang.String property_instance_uri)
           
 java.util.Collection<IRDF_PropertyInstance> getPropertyInstanceWithSubjectAndObject(java.lang.String subject, java.lang.String object)
          Retrieves all the property instances with the given subject and object
 IRDF_PropertyInstance getPropertyInstanceWithSubjectPredicateAndObject(java.lang.String subject, java.lang.String property_instance_uri, java.lang.String object)
          Retrieves all the property instances with the given subject,predicate,object
 java.util.Collection getRange(IRDF_Property rdf_property)
          Retrieves the Collection of RDF_Range objects in which rdf_property "participates"
 org.apache.commons.collections.MultiMap getRanges()
          Retrieves all the range relations stored in main memory
 IRDF_Range getRangeWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
protected  IRDF_Resource getResource(java.lang.String resource_uri)
           
protected  java.util.HashMap getResources()
           
 java.util.Collection getSeeAlso(IRDF_Resource rdf_resource)
          Retrieves the Collection of RDF_SeeAlso objects in which rdf_resource "participates"
 org.apache.commons.collections.MultiMap getSeeAlsos()
          Retrieves all the seeAlso relations stored in main memory
 IRDF_SeeAlso getSeeAlsoWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
 org.apache.commons.collections.MultiMap getSubClasses()
          Retrieves all the subClass relations stored in main memory
 java.util.Collection<IRDF_SubClass> getSubClassOf(IRDF_Class rdf_class)
          Retrieves the Collection of RDF_SubClass objects in which rdf_class "participates" as the subClass!!!
 IRDF_SubClass getSubClassWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
 IRDF_Subject getSubject(IRDF_Statement rdf_statement)
          Retrieves the Collection of RDF_Subject objects in which rdf_statement "participates"
 java.util.HashMap<IRDF_Statement,IRDF_Subject> getSubjects()
          Retrieves all the subject relations stored in main memory
 org.apache.commons.collections.MultiMap getSubProperties()
          Retrieves all the subProperty relations stored in main memory
 java.util.Collection<IRDF_SubProperty> getSubProperty(IRDF_Property rdf_property)
          Deprecated. 
 java.util.Collection<IRDF_SubProperty> getSubPropertyOf(IRDF_Property property)
           
 IRDF_SubProperty getSubPropertyWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
 java.util.Collection<IRDF_SubClass> getSuperClassOf(IRDF_Class rdf_class)
          Retrieves the Collection of RDF_SubClass objects in which rdf_class "participates" as the superclass
 java.util.Collection<IRDF_SubProperty> getSuperProperty(IRDF_Property property)
          Deprecated. 
 java.util.Collection<IRDF_SubProperty> getSuperPropertyOf(IRDF_Property rdf_property)
          Retrieves the subproperties of this property
 java.util.Collection<IRDF_Type> getType(IRDF_Resource resource)
          Retrieves the Collection of RDF_Type objects in which rdf_type "participates"
protected  org.apache.commons.collections.MultiMap getTypes_hashed_on_object()
           
protected  java.util.Map getTypes_hashed_on_subject_object()
           
 org.apache.commons.collections.MultiMap getTypes()
          Retrieves all the type relations stored in main memory
 IRDF_Type getTypeWithSubjectAndObject(IRDF_Resource subject, IRDF_Resource object)
           
 ValidationParams getValidation_params()
          Validation Params essentially pertains parameters related to the namespace fetching, the parser and so on.
 void import_default_namespaces()
          Creates in MM RDFSchema and RDF namespaces and initializes their classes and properties
 void import_graphspaces(java.util.ArrayList import_graphspaces, java.lang.String base_uri)
          This method loads all the graphspaces specified in the import_graphspaces parameter in the model.
protected  void import_namespace(java.lang.String import_namespace, parser rdf_parser)
           
protected  void import_namespace(java.lang.String import_namespace, java.lang.String baseURI)
           
 void import_namespaces(java.util.ArrayList import_namespaces, parser p)
           
 void import_namespaces(java.util.ArrayList import_namespaces, java.lang.String base_uri)
          VRP Comments: Will be called by the parser if he reached the EOF of the current file.
 void import_rdfsuite_namespace()
          Creates in MM RDFSuite namespace and initializes its classes
 void import_xmlschema_namespace()
          Creates in MM the XML Schema namespace and initializes its classes
protected  void initResourceIDs()
           
 boolean isStrict()
           
protected  void read_rdf_xml(java.io.InputStream file, java.lang.String base_uri, boolean fetch_dependencies, boolean strict)
          This method parses an RDF/XML file using vrp parser and creates the corresponding RDF_Namespace and RDF_Graphspace objects
 void read_Trig(java.io.InputStream file, java.lang.String b_uri, boolean fetch_dependencies, boolean strict)
           
 int read_triple(java.lang.String subject, java.lang.String predicate, java.lang.String object, Position pos, java.lang.String graphspace_uri, boolean strict, java.lang.String namespace_uri)
           
 void read(java.io.InputStream file, java.lang.String base_uri, java.lang.String triple_format, boolean fetch_dependencies, boolean strict)
          Receives input from an Input Stream an loads the corresponding namespaces/graphspaces to the model The base_uri given as a parameter should be the same as the one included in the file(if one)
 void read(java.lang.String filename, java.lang.String base_uri, java.lang.String format, boolean fetch_dependencies, boolean strict)
          Receives input from a file an loads the corresponding namespaces/graphspaces to the model The base_uri given as a parameter should be the same as the one included in the file(if one)
 void readAll(java.util.Map<java.lang.String,java.lang.String> files, java.lang.String triple_format, boolean fetch_dependencies, boolean strict)
          Receives all the available files in a Map along with their uris and makes sure they are parsed in the correct order resolving any possible dependencies between them.
protected  void removeSubClassTriplesOf(IRDF_Class rdf_class)
           
 IRDF_Resource retrieveResource(java.lang.String uri)
          Retrieves the resource withthe given uri from its namesapce( if exists)
 java.util.Iterator<IRDF_Triple> retrieveTriples(IRDF_Resource subject, IRDF_Property predicate, java.lang.Object object)
          Retrieves the triples (if any) with the given subject, predicate and/or object In case subject,predicate or object has value null this implies matching any.
 java.util.Iterator<IRDF_Triple> retrieveTriples(java.lang.String subject, java.lang.String predicate, java.lang.String object)
          Retrieves the triples (if any) with the given subject,predicate and/or object In case subject,predicate or object has value null this implies matching any.
 java.util.Iterator<IRDF_Triple> retrieveTriplesByObject(java.lang.Object object)
           
 java.util.Iterator<IRDF_Triple> retrieveTriplesByPredicate(java.lang.String predicate)
           
 java.util.Iterator<IRDF_Triple> retrieveTriplesBySubject(IRDF_Resource subject)
           
 void setAvailableStreams(AvailableStreams avail)
          Sets the available namespace streams for fetching uris for building this model
 void setClass_dag(RDF_DAG class_dag)
           
 void setClassInstances(java.util.HashMap class_instances)
          Sets all the class instances in MM
 void setComments(IRDF_Resource resource, java.util.Collection<IRDF_Comment> comments)
          Sets the comments of a single resource
 void setComments(org.apache.commons.collections.MultiMap comments)
          Sets the comment Relationships defined in this namespace
 void setContainers(java.util.HashMap containers)
          Sets all the containers in MM
 void setDomains(IRDF_Property property, java.util.Collection<IRDF_Domain> domains)
          Sets the domains of a single property
 void setDomains(org.apache.commons.collections.MultiMap domains)
          Sets the domain Relationships defined in this namespace
 void setFetch_all_ns(boolean fetch_all_ns)
           
 void setGraphspaces(java.util.HashMap graphspaces)
          Sets the HashMap of graphspaces in the Main Memory
 void setHlabel(HierarchyLabeler hlabel)
           
 void setIsDefinedBys(IRDF_Resource resource, java.util.Collection<IRDF_IsDefinedBy> is_defined_bys)
          Sets the isDefinedBys of a single resource
 void setIsDefinedBys(org.apache.commons.collections.MultiMap is_defined_bys)
          Sets the isDefinedBy Relationships defined in this namespace
 void setLabels(IRDF_Resource resource, java.util.Collection<IRDF_Label> labels)
          Sets the labels of a single resource
 void setLabels(org.apache.commons.collections.MultiMap labels)
          Sets the label Relationships defined in this namespace
 void setLabelsCreated(boolean created)
          Sets whether labels are created for this model
 void setLiterals(java.util.HashMap<java.lang.String,IRDF_Literal> literals)
           
 void setMembers(IRDF_Container container, java.util.Collection<IRDF_Member> members)
           
 void setMembers(org.apache.commons.collections.MultiMap members)
          Sets the container membership Relationships defined in this namespace
 void setMetaClass_dag(RDF_DAG meta_class_dag)
           
 void setMetaProperty_dag(RDF_DAG meta_property_dag)
           
 void setNamespaces(java.util.HashMap namespaces)
          Sets the HashMap of namespaces in the Main Memory
 void setObjects(java.util.HashMap<IRDF_Statement,IRDF_Object> objects)
          Sets the object Relationships defined in this namespace
 void setPredicates(java.util.HashMap<IRDF_Statement,IRDF_Predicate> predicates)
          Sets the predicate Relationships defined in this namespace
 void setProperty_dag(RDF_DAG property_dag)
           
 void setPropertyInstances(org.apache.commons.collections.MultiMap property_instances)
          Sets all the property instances in MM
 void setRanges(IRDF_Property property, java.util.Collection<IRDF_Range> ranges)
          Sets the ranges of a single property
 void setRanges(org.apache.commons.collections.MultiMap ranges)
          Sets the range Relationships defined in this namespace
protected  void setResources(java.util.HashMap resources)
           
 void setSeeAlsos(IRDF_Resource resource, java.util.Collection<IRDF_SeeAlso> see_alsos)
          Sets the see alsos of a single resource
 void setSeeAlsos(org.apache.commons.collections.MultiMap see_alsos)
          Sets the seeAlso Relationships defined in this namespace
 void setStrict(boolean strict)
           
 void setSubClasses(org.apache.commons.collections.MultiMap sub_classes)
          Sets the subClass Relationships defined in this namespace
 void setSubjects(java.util.HashMap<IRDF_Statement,IRDF_Subject> subjects)
          Sets the subject Relationships defined in this namespace
 void setSubProperties(IRDF_Property property, java.util.Collection<IRDF_SubProperty> sub_properies)
          Sets the superproperties of a single property
 void setSubProperties(org.apache.commons.collections.MultiMap sub_properies)
          Sets the subProperty Relationships defined in this namespace
 void setSuperClassesOf(IRDF_Class rdf_class, java.util.Collection<IRDF_SubClass> sub_classes)
          Sets the superclasses of a single class
 void setTypes(IRDF_Resource resource, java.util.Collection<IRDF_Type> types)
          Sets the types of a single resource
 void setTypes(org.apache.commons.collections.MultiMap types)
          Sets the type Relationships defined in this namespace
 void setValidation_params(ValidationParams validation_params)
           
 java.util.Iterator<IRDF_Triple> toTriples()
           
 java.util.Collection toTriples(boolean setOnly)
          This method produces the statements(triples) that derive out of the Collection of namespaces and graphspaces constituting this model by calling the corresponding toTriples() methods from each namespace/graphspace in the Collections accordingly.
 java.util.Collection<RDF_Triple> toTriples(java.lang.String uri)
          This method produces the statements(triples) that derive out of the namespace or graphspace described by the given uri
protected  void updateResourceReferencesInTriples(IRDF_Resource original_rdf_resource, IRDF_Resource new_rdf_resource)
          Replaces rdf_class with rdf_meta_class in all triples that rdf_class occures
 void validate()
          Performs a validation of the schema and data loaded in main memory
 java.util.Map<java.lang.String,java.io.File> write_file(java.lang.String output_path, java.lang.String triple_format, java.lang.String base_uri, boolean setOnly, boolean multiple)
          This method outputs the the namespaces/graphspaces correlated to this model in one or more output files according to the value of parameter multiple.
 java.util.Map<java.lang.String,java.io.File> write_original_and_inferred_in_file(java.lang.String output_path, java.lang.String triple_format, java.lang.String base_uri, boolean setOnly, boolean multiple)
          This method writes in files both the original triples steming from the source files and the inferred triples created arbitrarily from the model to make it complete( in case the original files were not complete) Example: If a file contains only triple A subClassOf B, the model will add A type Class and B type Class triples.
 java.util.Map write_original_and_inferred_in_string(java.lang.String format, java.lang.String base_uri, boolean setOnly, boolean multiple)
          This method writes in strings both the original triples steming from the source files and the inferred triples created arbitrarily from the model to make it complete( in case the original files were not complete) Example: If a file contains only triple A subClassOf B, the model will add A type Class and B type Class triples.
 java.util.Map write_string(java.lang.String format, java.lang.String base_uri, boolean setOnly, boolean multiple)
          This method outputs the namespaces/graphspaces correlated to this model in a HashMap of pairs where the key is the namespace/graphspace uri and the value is the actual namespace/graphspace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRIG

public static java.lang.String TRIG

RDF_XML

public static java.lang.String RDF_XML

PLAIN_TRIPLES

public static java.lang.String PLAIN_TRIPLES

class_instances

protected java.util.HashMap<java.lang.String,IRDF_Individual> class_instances
RDF object variables


property_instances

protected org.apache.commons.collections.MultiMap property_instances

property_instances_hashed_on_subject

protected org.apache.commons.collections.MultiMap property_instances_hashed_on_subject

property_instances_hashed_on_object

protected org.apache.commons.collections.MultiMap property_instances_hashed_on_object

property_instances_hashed_on_subject_predicate

protected org.apache.commons.collections.MultiMap property_instances_hashed_on_subject_predicate

property_instances_hashed_on_predicate_object

protected org.apache.commons.collections.MultiMap property_instances_hashed_on_predicate_object

property_instances_hashed_on_subject_object

protected org.apache.commons.collections.MultiMap property_instances_hashed_on_subject_object

property_instances_hashed_on_all

protected java.util.Map property_instances_hashed_on_all

containers

protected java.util.HashMap<java.lang.String,IRDF_Container> containers

namespaces

protected java.util.HashMap<java.lang.String,IRDF_Namespace> namespaces

graphspaces

protected java.util.HashMap<java.lang.String,IRDF_Graphspace> graphspaces

subclasses

protected org.apache.commons.collections.MultiMap subclasses

subclasses_hashed_on_object

protected org.apache.commons.collections.MultiMap subclasses_hashed_on_object

subclasses_hashed_on_subject_object

protected java.util.Map subclasses_hashed_on_subject_object

subproperties

protected org.apache.commons.collections.MultiMap subproperties

subproperties_hashed_on_object

protected org.apache.commons.collections.MultiMap subproperties_hashed_on_object

subproperties_hashed_on_subject_object

protected java.util.Map subproperties_hashed_on_subject_object

domains

protected org.apache.commons.collections.MultiMap domains

domains_hashed_on_object

protected org.apache.commons.collections.MultiMap domains_hashed_on_object

domains_hashed_on_subject_object

protected java.util.Map domains_hashed_on_subject_object

ranges

protected org.apache.commons.collections.MultiMap ranges

ranges_hashed_on_object

protected org.apache.commons.collections.MultiMap ranges_hashed_on_object

ranges_hashed_on_subject_object

protected java.util.Map ranges_hashed_on_subject_object

subjects

protected java.util.HashMap<IRDF_Statement,IRDF_Subject> subjects

subjects_hashed_on_object

protected java.util.HashMap<IRDF_Resource,IRDF_Subject> subjects_hashed_on_object

subjects_hashed_on_subject_object

protected java.util.HashMap<MultiKey,IRDF_Subject> subjects_hashed_on_subject_object

predicates

protected java.util.HashMap<IRDF_Statement,IRDF_Predicate> predicates

predicates_hashed_on_object

protected java.util.HashMap<IRDF_Resource,IRDF_Predicate> predicates_hashed_on_object

predicates_hashed_on_subject_object

protected java.util.HashMap<MultiKey,IRDF_Predicate> predicates_hashed_on_subject_object

objects

protected java.util.HashMap<IRDF_Statement,IRDF_Object> objects

objects_hashed_on_object

protected java.util.HashMap<java.lang.Object,IRDF_Object> objects_hashed_on_object

objects_hashed_on_subject_object

protected java.util.HashMap<MultiKey,IRDF_Object> objects_hashed_on_subject_object

comments

protected org.apache.commons.collections.MultiMap comments

comments_hashed_on_object

protected org.apache.commons.collections.MultiMap comments_hashed_on_object

comments_hashed_on_subject_object

protected java.util.Map comments_hashed_on_subject_object

labels

protected org.apache.commons.collections.MultiMap labels

labels_hashed_on_object

protected org.apache.commons.collections.MultiMap labels_hashed_on_object

labels_hashed_on_subject_object

protected java.util.Map labels_hashed_on_subject_object

seealsos

protected org.apache.commons.collections.MultiMap seealsos

seealsos_hashed_on_object

protected org.apache.commons.collections.MultiMap seealsos_hashed_on_object

seealsos_hashed_on_subject_object

protected java.util.Map seealsos_hashed_on_subject_object

isdefinedbys

protected org.apache.commons.collections.MultiMap isdefinedbys

isdefinedbys_hashed_on_object

protected org.apache.commons.collections.MultiMap isdefinedbys_hashed_on_object

isdefinedbys_hashed_on_subject_object

protected java.util.Map isdefinedbys_hashed_on_subject_object

members

protected org.apache.commons.collections.MultiMap members

members_hashed_on_object

protected org.apache.commons.collections.MultiMap members_hashed_on_object

members_hashed_on_subject_object

protected java.util.Map members_hashed_on_subject_object

types

protected org.apache.commons.collections.MultiMap types

types_hashed_on_object

protected org.apache.commons.collections.MultiMap types_hashed_on_object

types_hashed_on_subject_object

protected java.util.Map types_hashed_on_subject_object

resources

protected java.util.HashMap<java.lang.String,IRDF_Resource> resources

literals

protected java.util.HashMap<java.lang.String,IRDF_Literal> literals

predicatesMaps

protected java.util.Map<java.lang.String,java.util.List<java.util.Map>> predicatesMaps

time

public static long time

class_dag

protected RDF_DAG class_dag
Utility variables


meta_class_dag

protected RDF_DAG meta_class_dag

meta_property_dag

protected RDF_DAG meta_property_dag

property_dag

protected RDF_DAG property_dag

available_streams

protected AvailableStreams available_streams

log

protected static final org.apache.log4j.Logger log

monitor

public static final gr.forth.ics.taskmonitor.Monitor monitor

hlabel

public HierarchyLabeler hlabel

validation_params

protected ValidationParams validation_params

fetch_all_ns

protected boolean fetch_all_ns

strict

protected boolean strict

label_created

protected boolean label_created
Constructor Detail

RDF_Model

public RDF_Model()
Method Detail

addClassInstance

public void addClassInstance(IRDF_Individual class_instance)
Description copied from interface: IRDF_Model
Adds a class instance in MM

Specified by:
addClassInstance in interface IRDF_Model
Parameters:
class_instance - An RDF_ClassInstance object

addContainer

public void addContainer(IRDF_Container container)
Description copied from interface: IRDF_Model
Adds a container in MM

Specified by:
addContainer in interface IRDF_Model
Parameters:
container - An RDF_Container object

addGraphspace

public void addGraphspace(IRDF_Graphspace graphspace)
Description copied from interface: IRDF_Model
Adds an RDF_Graphspace object in the HashMap of RDF_Graphspace objects with key its uri

Specified by:
addGraphspace in interface IRDF_Model

addNamespace

public void addNamespace(IRDF_Namespace namespace)
Description copied from interface: IRDF_Model
Adds an RDF_Namespace object in the HashMap of RDF_Namespace objects with key its uri

Specified by:
addNamespace in interface IRDF_Model
Parameters:
namespace - An RDF_Namespace object

addPropertyInstance

public void addPropertyInstance(IRDF_PropertyInstance property_instance)
Description copied from interface: IRDF_Model
Adds a property instance in MM

Specified by:
addPropertyInstance in interface IRDF_Model
Parameters:
property_instance - An RDF_PropertyInstance object

getClassInstance

public IRDF_Individual getClassInstance(java.lang.String class_instance_uri)
Description copied from interface: IRDF_Model
Retrieves a class instance given its uri

Specified by:
getClassInstance in interface IRDF_Model
Parameters:
class_instance_uri - A String
Returns:
An RDF_ClassInstance object

getClassInstances

public java.util.HashMap<java.lang.String,IRDF_Individual> getClassInstances()
Description copied from interface: IRDF_Model
Retrieves all class instances from MM

Specified by:
getClassInstances in interface IRDF_Model
Returns:
A HashMap with keys (String) class instance uris and values RDF_ClassInstance objects

getContainer

public IRDF_Container getContainer(java.lang.String container_uri)
Description copied from interface: IRDF_Model
Retrieves a container given its uri

Specified by:
getContainer in interface IRDF_Model
Parameters:
container_uri - A String
Returns:
An RDF_Container object

getContainers

public java.util.HashMap<java.lang.String,IRDF_Container> getContainers()
Description copied from interface: IRDF_Model
Retrieves all containers from MM

Specified by:
getContainers in interface IRDF_Model
Returns:
A HashMap with keys (String) container uris and values RDF_Container objects

getGraphspace

public IRDF_Graphspace getGraphspace(java.lang.String graphspace_uri)
Description copied from interface: IRDF_Model
Retrieves an RDF_Graphspace from the MM using the given graphspace uri as a key

Specified by:
getGraphspace in interface IRDF_Model
Parameters:
graphspace_uri - The String graphspace uri of the desired graphspace
Returns:

getGraphspaces

public java.util.HashMap<java.lang.String,IRDF_Graphspace> getGraphspaces()
Description copied from interface: IRDF_Model
Retrieves all the Graphspaces stored in Main Memory(MM)

Specified by:
getGraphspaces in interface IRDF_Model
Returns:
A HashMap with key graphspace_uri and value the RDF_Graphspace objects

getNamespace

public IRDF_Namespace getNamespace(java.lang.String namespace_uri)
Description copied from interface: IRDF_Model
Retrieves an RDF_Namespace from the MM using the given namespace uri as a key

Specified by:
getNamespace in interface IRDF_Model
Parameters:
namespace_uri - The String namespace uri of the desired namespace
Returns:

getNamespaces

public java.util.HashMap<java.lang.String,IRDF_Namespace> getNamespaces()
Description copied from interface: IRDF_Model
Retrieves all the Namespaces stored in Main Memory(MM)

Specified by:
getNamespaces in interface IRDF_Model
Returns:
A HashMap with key namespace_uri and value the RDF_Namespace objects

getPropertyInstanceWithSubjectPredicateAndObject

public IRDF_PropertyInstance getPropertyInstanceWithSubjectPredicateAndObject(java.lang.String subject,
                                                                              java.lang.String property_instance_uri,
                                                                              java.lang.String object)
                                                                       throws gr.forth.ics.rdfsuite.services.exceptions.TripleCreationException
Description copied from interface: IRDF_Model
Retrieves all the property instances with the given subject,predicate,object

Specified by:
getPropertyInstanceWithSubjectPredicateAndObject in interface IRDF_Model
Returns:
An IRDF_PropertyInstance
Throws:
gr.forth.ics.rdfsuite.services.exceptions.TripleCreationException - if some of the elements of the property instance cannot be found in the model

getPropertyInstanceWithSubjectAndObject

public java.util.Collection<IRDF_PropertyInstance> getPropertyInstanceWithSubjectAndObject(java.lang.String subject,
                                                                                           java.lang.String object)
Description copied from interface: IRDF_Model
Retrieves all the property instances with the given subject and object

Specified by:
getPropertyInstanceWithSubjectAndObject in interface IRDF_Model
Returns:
A Collection

getPropertyInstanceWithSubject

public java.util.Collection getPropertyInstanceWithSubject(java.lang.String subject,
                                                           java.lang.String property_instance_uri)

getPropertyInstanceWithObject

public java.util.Collection getPropertyInstanceWithObject(java.lang.String object,
                                                          java.lang.String property_instance_uri)

getPropertyInstance

public java.util.Collection<IRDF_PropertyInstance> getPropertyInstance(java.lang.String property_instance_uri)
Description copied from interface: IRDF_Model
Retrieves a property instance given its uri

Specified by:
getPropertyInstance in interface IRDF_Model
Parameters:
property_instance_uri - A String
Returns:
An Collection object

getPropertyInstances

public org.apache.commons.collections.MultiMap getPropertyInstances()
Description copied from interface: IRDF_Model
Retrieves all the property instances stored in MM

Specified by:
getPropertyInstances in interface IRDF_Model
Returns:
A MultiMap with keys (String) property instance uris and values RDF_PropertyInstance objects.The reason for the use of multimap is that there may be more than one property instances wuth the same uri "connecting" different resources

setClassInstances

public void setClassInstances(java.util.HashMap class_instances)
Description copied from interface: IRDF_Model
Sets all the class instances in MM

Specified by:
setClassInstances in interface IRDF_Model
Parameters:
class_instances - A HashMap with (String)class instance uris as keys and RDF_ClassInstance objects as values

setContainers

public void setContainers(java.util.HashMap containers)
Description copied from interface: IRDF_Model
Sets all the containers in MM

Specified by:
setContainers in interface IRDF_Model
Parameters:
containers - A HashMap with (String)container uris as keys and RDF_Container objects as values

setGraphspaces

public void setGraphspaces(java.util.HashMap graphspaces)
Description copied from interface: IRDF_Model
Sets the HashMap of graphspaces in the Main Memory

Specified by:
setGraphspaces in interface IRDF_Model
Parameters:
graphspaces - A HashMap with key String graphspace_uris and values RDF_Graphspace objects

setNamespaces

public void setNamespaces(java.util.HashMap namespaces)
Description copied from interface: IRDF_Model
Sets the HashMap of namespaces in the Main Memory

Specified by:
setNamespaces in interface IRDF_Model
Parameters:
namespaces - A HashMap with key String namespace_uris and values RDF_Namespace objects

setPropertyInstances

public void setPropertyInstances(org.apache.commons.collections.MultiMap property_instances)
Description copied from interface: IRDF_Model
Sets all the property instances in MM

Specified by:
setPropertyInstances in interface IRDF_Model
Parameters:
property_instances - A MultiMap with (String)property instance uris as keys and RDF_PropertyInstance objects as values The reason for the use of multimap is that there may be more than one property instances wuth the same uri "connecting" different resources

readAll

public void readAll(java.util.Map<java.lang.String,java.lang.String> files,
                    java.lang.String triple_format,
                    boolean fetch_dependencies,
                    boolean strict)
             throws java.sql.SQLException,
                    java.lang.ClassNotFoundException,
                    java.io.IOException,
                    gr.forth.ics.rdfsuite.services.exceptions.ParsingException,
                    gr.forth.ics.rdfsuite.services.exceptions.TrigException,
                    gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException,
                    java.io.IOException
Receives all the available files in a Map along with their uris and makes sure they are parsed in the correct order resolving any possible dependencies between them. Developers who want to load in a Model a set of files and do not actually know their "correct" order are highly encouraged to use this method

Specified by:
readAll in interface IRDF_Model
Parameters:
files - An Map with the input files. Key of the Map should be the uri and value an String with the file(CAUTION:This is not the path to the file but the file itself).
triple_format - RDF_Model.RDF_XML( For rdf/xml files),RDF_Model.TRIG( for trig files)
fetch_dependencies - If true all the dependent namespacies will be fetched from their actual location(Requires a valid uri to be set)
strict - boolean If true the model will perform all the necessary cross checks while building. In the other case it will perform a "good will" building supposing that the input files are already tested!
Throws:
java.sql.SQLException - For compliance to RDFDB_Model.read
java.lang.ClassNotFoundException - For compliance to RDFDB_Model.read
java.io.IOException - In case some input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - In case something went wrong in the parsing of the file
gr.forth.ics.rdfsuite.services.exceptions.TrigException - In case the trig parser throws an Exception
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException - in case parameter triple format is not one of the predefined values

read

public void read(java.io.InputStream file,
                 java.lang.String base_uri,
                 java.lang.String triple_format,
                 boolean fetch_dependencies,
                 boolean strict)
          throws java.sql.SQLException,
                 java.lang.ClassNotFoundException,
                 java.io.IOException,
                 gr.forth.ics.rdfsuite.services.exceptions.ParsingException,
                 gr.forth.ics.rdfsuite.services.exceptions.TrigException,
                 gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException
Description copied from interface: IRDF_Model
Receives input from an Input Stream an loads the corresponding namespaces/graphspaces to the model The base_uri given as a parameter should be the same as the one included in the file(if one)

Specified by:
read in interface IRDF_Model
Parameters:
file -
base_uri - If null then we retrieve the base uri from the file itself
triple_format -
fetch_dependencies -
strict - If true all the necessary checks will be performed while if it is false we will perform a good will building
Throws:
java.sql.SQLException - For compliance to RDFDB_Model.read
java.lang.ClassNotFoundException - For compliance to RDFDB_Model.read
java.io.IOException - In case the input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - In case something went wrong in the parsing of the file
gr.forth.ics.rdfsuite.services.exceptions.TrigException - In case the trig parser throws an Exception
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException - in case parameter triple format is not one of the predefined values

read_Trig

public void read_Trig(java.io.InputStream file,
                      java.lang.String b_uri,
                      boolean fetch_dependencies,
                      boolean strict)
               throws java.io.IOException,
                      gr.forth.ics.rdfsuite.services.exceptions.TrigException,
                      gr.forth.ics.rdfsuite.services.exceptions.IncompatibleUrisException
Parameters:
file -
b_uri -
fetch_dependencies -
strict - If true all the necessary checks will be performed while if it is false we will perform a good will building
Throws:
java.io.IOException - in case the input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.TrigException - in case the trig parser throws an Exception
gr.forth.ics.rdfsuite.services.exceptions.IncompatibleUrisException - if the base uri of a file and the base uri passed as a parameter are different

import_graphspaces

public void import_graphspaces(java.util.ArrayList import_graphspaces,
                               java.lang.String base_uri)
                        throws gr.forth.ics.rdfsuite.services.exceptions.ParsingException
Description copied from interface: IRDF_Model
This method loads all the graphspaces specified in the import_graphspaces parameter in the model.

Specified by:
import_graphspaces in interface IRDF_Model
Parameters:
import_graphspaces -
base_uri -
Throws:
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - if a graphspace fetched from available streams cannot be parsed with neither the rdf/xml nor with the trig parser

import_namespaces

public void import_namespaces(java.util.ArrayList import_namespaces,
                              parser p)
                       throws gr.forth.ics.rdfsuite.services.exceptions.ParsingException
Throws:
gr.forth.ics.rdfsuite.services.exceptions.ParsingException

import_namespaces

public void import_namespaces(java.util.ArrayList import_namespaces,
                              java.lang.String base_uri)
                       throws gr.forth.ics.rdfsuite.services.exceptions.ParsingException
VRP Comments: Will be called by the parser if he reached the EOF of the current file. The explicit stated namespaces are inside the Array List. The idea is to include everything in advance and do not allow to fetch during validation to provide a determinitic result of the validator. new since 08. Aug 2001 entered by Karsten Tolle My comments: When a a namespace imports other namespaces in its header these namespaces must be fetched in advance For these namespaces to be fetched a new parser instance must be created that will fetch them, so this work must be done in the level of the model 16/10/2006 The fetch namespace handling changes Details in the two relevant documents original name:public void fetch_all(ArrayList ex_ns, parser par)

Specified by:
import_namespaces in interface IRDF_Model
Parameters:
import_namespaces - the namespaces to be loaded in the model
base_uri - the base uri
Throws:
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - if a namespace cannot be parsed neither with the rdf/xml not with the trig parser

import_namespace

protected void import_namespace(java.lang.String import_namespace,
                                parser rdf_parser)
                         throws gr.forth.ics.rdfsuite.services.exceptions.UnresolvedDependencyException,
                                gr.forth.ics.rdfsuite.services.exceptions.RdfFileFormatException,
                                gr.forth.ics.rdfsuite.services.exceptions.ParsingException
Parameters:
import_namespace -
rdf_parser -
Throws:
gr.forth.ics.rdfsuite.services.exceptions.UnresolvedDependencyException - If a namespace cannot be fetched from its actual location
gr.forth.ics.rdfsuite.services.exceptions.RdfFileFormatException - If an rdf file contains a structure that does not break vrp but is unaccepted,like
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - if a namespace cannot be parsed neither with the rdf/xml not with the trig parser a null namesapace prefix

import_namespace

protected void import_namespace(java.lang.String import_namespace,
                                java.lang.String baseURI)
                         throws gr.forth.ics.rdfsuite.services.exceptions.UnresolvedDependencyException,
                                gr.forth.ics.rdfsuite.services.exceptions.RdfFileFormatException,
                                gr.forth.ics.rdfsuite.services.exceptions.ParsingException
Parameters:
import_namespace -
baseURI -
Throws:
gr.forth.ics.rdfsuite.services.exceptions.UnresolvedDependencyException - If a namespace cannot be fetched from its actual location
gr.forth.ics.rdfsuite.services.exceptions.RdfFileFormatException - If an rdf file contains a structure that does not break vrp but is unaccepted,like
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - if a namespace cannot be parsed neither with the rdf/xml not with the trig parser a null namesapace prefix

import_xmlschema_namespace

public void import_xmlschema_namespace()
Creates in MM the XML Schema namespace and initializes its classes

Specified by:
import_xmlschema_namespace in interface IRDF_Model

import_rdfsuite_namespace

public void import_rdfsuite_namespace()
Creates in MM RDFSuite namespace and initializes its classes

Specified by:
import_rdfsuite_namespace in interface IRDF_Model

import_default_namespaces

public void import_default_namespaces()
Creates in MM RDFSchema and RDF namespaces and initializes their classes and properties

Specified by:
import_default_namespaces in interface IRDF_Model

read_rdf_xml

protected void read_rdf_xml(java.io.InputStream file,
                            java.lang.String base_uri,
                            boolean fetch_dependencies,
                            boolean strict)
                     throws java.io.IOException
This method parses an RDF/XML file using vrp parser and creates the corresponding RDF_Namespace and RDF_Graphspace objects

Parameters:
strict - If true all the necessary checks will be performed while if it is false we will perform a good will building
Throws:
java.io.IOException - if the input stream is malformed

read

public void read(java.lang.String filename,
                 java.lang.String base_uri,
                 java.lang.String format,
                 boolean fetch_dependencies,
                 boolean strict)
          throws gr.forth.ics.rdfsuite.services.exceptions.ParsingException,
                 java.sql.SQLException,
                 java.lang.ClassNotFoundException,
                 java.io.IOException,
                 gr.forth.ics.rdfsuite.services.exceptions.TrigException,
                 gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException
Description copied from interface: IRDF_Model
Receives input from a file an loads the corresponding namespaces/graphspaces to the model The base_uri given as a parameter should be the same as the one included in the file(if one)

Specified by:
read in interface IRDF_Model
Parameters:
filename -
base_uri -
format -
fetch_dependencies -
strict - If true all the necessary checks will be performed while if it is false we will perform a "good will" building
Throws:
java.sql.SQLException - For compliance to RDFDB_Model.read
java.lang.ClassNotFoundException - For compliance to RDFDB_Model.read
java.io.IOException - In case the input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - In case something went wrong in the parsing of the file
gr.forth.ics.rdfsuite.services.exceptions.TrigException - In case the trig parser throws an Exception
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException - in case parameter triple format is not one of the predefined values

getValidation_params

public ValidationParams getValidation_params()
Validation Params essentially pertains parameters related to the namespace fetching, the parser and so on.

Returns:

setValidation_params

public void setValidation_params(ValidationParams validation_params)

getFetch_all_ns

public boolean getFetch_all_ns()

setFetch_all_ns

public void setFetch_all_ns(boolean fetch_all_ns)

getOrCreateNamespace

public IRDF_Namespace getOrCreateNamespace(java.lang.String namespace_uri)
This method retrieves an RDF_Namespace with a given uri from MM. If it does not exist it creates it

Specified by:
getOrCreateNamespace in interface IRDF_Model
Parameters:
namespace_uri - the uri of the namespace
Returns:
the IRDF_Namespace that was retrieved or created

getOrCreateGraphspace

public IRDF_Graphspace getOrCreateGraphspace(java.lang.String graphspace_uri)
This method retrieves an RDF_Graphspace with a given uri. If it does not exist it creates it

Specified by:
getOrCreateGraphspace in interface IRDF_Model
Parameters:
graphspace_uri - the uri of the graphspace
Returns:
the IRDF_Graphspace that was retrieved or created

getAvailableStreams

public AvailableStreams getAvailableStreams()
Description copied from interface: IRDF_Model
Retrieves the Available namespace streams for building this model

Specified by:
getAvailableStreams in interface IRDF_Model
Returns:
An AvailableStreams object

setAvailableStreams

public void setAvailableStreams(AvailableStreams avail)
Description copied from interface: IRDF_Model
Sets the available namespace streams for fetching uris for building this model

Specified by:
setAvailableStreams in interface IRDF_Model
Parameters:
avail - An AvailableStreams object

isStrict

public boolean isStrict()

setStrict

public void setStrict(boolean strict)

addStatement

public boolean addStatement(java.lang.String subject,
                            java.lang.String predicate,
                            java.lang.String object,
                            java.lang.String namespace_uri,
                            java.lang.String graphspace_uri,
                            Position pos)
                     throws gr.forth.ics.rdfsuite.services.exceptions.TripleCreationException
Description copied from interface: IRDF_Model
Explicitly adds a string triple in the given namespace,graphspace When this method is not called iternally by the model, the default namespaces, rdf_scheme,rdf.xml_schema,rdfsuite should be imported using the appropriate import methods in the model. If not an exception is thrown

Specified by:
addStatement in interface IRDF_Model
Parameters:
subject - The subject of the triple
predicate - The predicate of the triple
object - The object of the triple
namespace_uri - The namespace to add the triple
graphspace_uri - The graphspace to add the triple
pos - The position of the triple in the file, null if the method is used to explicitly add a triple to the model
Throws:
gr.forth.ics.rdfsuite.services.exceptions.TripleCreationException - if the default namespaces (RDFSchema,RDF,XMLSchema,RDFSuite)have not yet been imported

read_triple

public int read_triple(java.lang.String subject,
                       java.lang.String predicate,
                       java.lang.String object,
                       Position pos,
                       java.lang.String graphspace_uri,
                       boolean strict,
                       java.lang.String namespace_uri)
Parameters:
subject -
predicate -
object -
pos -
graphspace_uri -
strict -
namespace_uri -
Returns:
0 for false,needs to be fed to model, 1 for true, 2 for false and should not be fed to model(error)

enter_property_instance

protected int enter_property_instance(java.lang.String subject,
                                      java.lang.String predicate,
                                      java.lang.String object,
                                      Position pos,
                                      java.lang.String graphspace_uri,
                                      java.lang.String namespace_uri,
                                      boolean strict)
                               throws gr.forth.ics.rdfsuite.services.exceptions.ParsingException
Parameters:
subject -
predicate -
object -
pos -
graphspace_uri -
namespace_uri -
strict -
Returns:
0 for false,needs to be fed to model, 1 for true, 2 for false and should not be fed to model(error)
Throws:
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - if a namespace cannot be parsed with neither the rdf/xml nor the trig parser

createPropertyInstance

protected RDF_PropertyInstance createPropertyInstance(java.lang.String uri,
                                                      IRDF_Resource subject_resource,
                                                      java.lang.Object object,
                                                      Position pos)

enter_type

protected int enter_type(java.lang.String subject,
                         java.lang.String predicate,
                         java.lang.String object,
                         Position pos,
                         java.lang.String graphspace_uri,
                         boolean strict,
                         java.lang.String namespace_uri)
Parameters:
subject -
predicate -
object -
pos -
graphspace_uri -
strict -
namespace_uri -
Returns:
0 for false,needs to be fed to model, 1 for true, 2 for false and should not be fed to model(error)

enter_class_instance

protected void enter_class_instance(java.lang.String subject,
                                    Position pos,
                                    java.lang.String graphspace_uri,
                                    IRDF_Class object_class,
                                    java.lang.String namespace_uri)

enter_alt

protected void enter_alt(java.lang.String subject,
                         Position pos,
                         java.lang.String graphspace_uri,
                         java.lang.String namespace_uri)

enter_bag

protected void enter_bag(java.lang.String subject,
                         Position pos,
                         java.lang.String graphspace_uri,
                         java.lang.String namespace_uri)

enter_sequence

protected void enter_sequence(java.lang.String subject,
                              Position pos,
                              java.lang.String graphspace_uri,
                              java.lang.String namespace_uri)

createContainer

protected IRDF_Container createContainer(java.lang.String container_uri,
                                         int kind,
                                         Position pos)

createClassInstance

protected IRDF_Individual createClassInstance(java.lang.String class_instance_uri,
                                              Position pos)

createClassDag

public RDF_DAG createClassDag()
Description copied from interface: IRDF_Model
Creates the subsumption dag for all the model's classes

Specified by:
createClassDag in interface IRDF_Model
Returns:
An RDF_DAG

createClassDag

public RDF_DAG createClassDag(boolean createAlways)
getDirectAncestors returns the class itself which has to be removed in order for no loops to appear


createMetaClassDag

public RDF_DAG createMetaClassDag()
Description copied from interface: IRDF_Model
Creates the subsumption dag for all the model's metaclass

Specified by:
createMetaClassDag in interface IRDF_Model
Returns:
An RDF_DAG

createMetaClassDag

public RDF_DAG createMetaClassDag(boolean createAlways)

createMetaPropertyDag

public RDF_DAG createMetaPropertyDag()
Description copied from interface: IRDF_Model
Creates the subsumprion dag for all the model's metaproperties

Specified by:
createMetaPropertyDag in interface IRDF_Model
Returns:
An RDF_DAG

createMetaPropertyDag

public RDF_DAG createMetaPropertyDag(boolean createAlways)

createLabels

public void createLabels()
                  throws gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException
Description copied from interface: IRDF_Model
Given the class dag,property dag,metaclass dag nad metaproperty dag for this model assignes a unique label to each resource of the model

Specified by:
createLabels in interface IRDF_Model
Throws:
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException

createPostorder

protected void createPostorder(RDF_DAG subClassDag,
                               RDF_DAG subPropertyDag,
                               RDF_DAG subMetaClassDag,
                               RDF_DAG subMetaPropertyDag)
                        throws gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException
Throws:
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException

createDags

public void createDags()
Description copied from interface: IRDF_Model
Creates the subsumption dags for classes,proeprties,metaclasses,metaproperties. The creation of the dags is necessary for the label creation

Specified by:
createDags in interface IRDF_Model

createPropertyDag

public RDF_DAG createPropertyDag()
Description copied from interface: IRDF_Model
Creates the subsumprion dag for all the model's properties

Specified by:
createPropertyDag in interface IRDF_Model
Returns:
An RDF_DAG

getHlabel

public HierarchyLabeler getHlabel()

setHlabel

public void setHlabel(HierarchyLabeler hlabel)

getOrCreateTypeTriple

protected IRDF_Type getOrCreateTypeTriple(IRDF_Resource subject_resource,
                                          IRDF_Resource object_resource,
                                          boolean inferred,
                                          IRDF_Namespace ns)

addComment

public void addComment(IRDF_Resource resource,
                       IRDF_Comment comment)
Description copied from interface: IRDF_Model
Adds a comment relation in Main Memory

Specified by:
addComment in interface IRDF_Model

addDomain

public void addDomain(IRDF_Property property,
                      IRDF_Domain domain)
Description copied from interface: IRDF_Model
Adds a domain relation in Main Memory

Specified by:
addDomain in interface IRDF_Model

addIsDefinedBy

public void addIsDefinedBy(IRDF_Resource resource,
                           IRDF_IsDefinedBy isdefinedby)
Description copied from interface: IRDF_Model
Adds a isDefinedBy relation in Main Memory

Specified by:
addIsDefinedBy in interface IRDF_Model

addLabel

public void addLabel(IRDF_Resource resource,
                     IRDF_Label label)
Description copied from interface: IRDF_Model
Adds a label relation in Main Memory

Specified by:
addLabel in interface IRDF_Model

addMember

public void addMember(IRDF_Container container,
                      IRDF_Member member)
Description copied from interface: IRDF_Model
Adds a member relation in Main Memory

Specified by:
addMember in interface IRDF_Model

addObject

public void addObject(IRDF_Statement statement,
                      IRDF_Object object)
Description copied from interface: IRDF_Model
Adds a object relation in Main Memory

Specified by:
addObject in interface IRDF_Model

addPredicate

public void addPredicate(IRDF_Statement statement,
                         IRDF_Predicate predicate)
Description copied from interface: IRDF_Model
Adds a predicate relation in Main Memory

Specified by:
addPredicate in interface IRDF_Model

addRange

public void addRange(IRDF_Property property,
                     IRDF_Range range)
Description copied from interface: IRDF_Model
Adds a range relation in Main Memory

Specified by:
addRange in interface IRDF_Model

addSeeAlso

public void addSeeAlso(IRDF_Resource resource,
                       IRDF_SeeAlso seealso)
Description copied from interface: IRDF_Model
Adds a seeAlso relation in Main Memory

Specified by:
addSeeAlso in interface IRDF_Model

addSubClass

public void addSubClass(IRDF_Class rdf_class,
                        IRDF_SubClass subclass)
Description copied from interface: IRDF_Model
Adds a subClass relation in Main Memory

Specified by:
addSubClass in interface IRDF_Model

addSubProperty

public void addSubProperty(IRDF_Property property,
                           IRDF_SubProperty subproperty)
Description copied from interface: IRDF_Model
Adds a subProperty relation in Main Memory

Specified by:
addSubProperty in interface IRDF_Model

addSubject

public void addSubject(IRDF_Statement statement,
                       IRDF_Subject subject)
Description copied from interface: IRDF_Model
Adds a subject relation in Main Memory

Specified by:
addSubject in interface IRDF_Model

addType

public void addType(IRDF_Resource resource,
                    IRDF_Type type)
Description copied from interface: IRDF_Model
Adds a type relation in Main Memory

Specified by:
addType in interface IRDF_Model

getComment

public java.util.Collection getComment(IRDF_Resource rdf_resource)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Comment objects in which rdf_resource "participates"

Specified by:
getComment in interface IRDF_Model
Parameters:
rdf_resource - An RDF_Resource
Returns:
An Collection object

getComments

public org.apache.commons.collections.MultiMap getComments()
Description copied from interface: IRDF_Model
Retrieves all the comment relations stored in main memory

Specified by:
getComments in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Resource objects and values collections of RDF_Comment objects

getDomains

public org.apache.commons.collections.MultiMap getDomains()
Description copied from interface: IRDF_Model
Retrieves all the domain relations stored in main memory

Specified by:
getDomains in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Property objects and values collections of RDF_Domains objects

getDomain

public java.util.Collection getDomain(IRDF_Property rdf_property)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Domains objects in which rdf_property "participates"

Specified by:
getDomain in interface IRDF_Model
Parameters:
rdf_property - An RDF_Property
Returns:
An Collection object

getIsDefinedBy

public java.util.Collection getIsDefinedBy(IRDF_Resource rdf_resource)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_IsDefinedBy objects in which rdf_resource "participates"

Specified by:
getIsDefinedBy in interface IRDF_Model
Parameters:
rdf_resource - An IRDF_Resource
Returns:
An Collection object

getIsDefinedBys

public org.apache.commons.collections.MultiMap getIsDefinedBys()
Description copied from interface: IRDF_Model
Retrieves all the isDefinedBy relations stored in main memory

Specified by:
getIsDefinedBys in interface IRDF_Model
Returns:
A MultiMap with keys IRDF_Resource objects and values collections of RDF_IsDefinedBy objects

getLabel

public java.util.Collection getLabel(IRDF_Resource rdf_resource)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Label objects in which rdf_resource "participates"

Specified by:
getLabel in interface IRDF_Model
Parameters:
rdf_resource - An RDF_Resource
Returns:
An Collection object

getLabels

public org.apache.commons.collections.MultiMap getLabels()
Description copied from interface: IRDF_Model
Retrieves all the label relations stored in main memory

Specified by:
getLabels in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Resource objects and values collections of RDF_Label objects

getMember

public java.util.Collection getMember(IRDF_Container container)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Member objects in which rdf_container "participates"

Specified by:
getMember in interface IRDF_Model
Parameters:
container - An RDF_Container
Returns:
An Collection object

getMembers

public org.apache.commons.collections.MultiMap getMembers()
Description copied from interface: IRDF_Model
Retrieves all the container membership relations stored in main memory

Specified by:
getMembers in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Container objects and values collections of RDF_Member objects

getObject

public IRDF_Object getObject(IRDF_Statement rdf_statement)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Object objects in which rdf_statement "participates"

Specified by:
getObject in interface IRDF_Model
Parameters:
rdf_statement - An IRDF_Statement
Returns:
An Collection object

getObjects

public java.util.HashMap<IRDF_Statement,IRDF_Object> getObjects()
Description copied from interface: IRDF_Model
Retrieves all the object relations stored in main memory

Specified by:
getObjects in interface IRDF_Model
Returns:
A MultiMap with keys IRDF_Statement objects and values collections of RDF_Object objects

getPredicate

public IRDF_Predicate getPredicate(IRDF_Statement statement)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Predicate objects in which statement "participates"

Specified by:
getPredicate in interface IRDF_Model
Parameters:
statement - An IRDF_Statement
Returns:
An Collection object

getPredicates

public java.util.HashMap<IRDF_Statement,IRDF_Predicate> getPredicates()
Description copied from interface: IRDF_Model
Retrieves all the predicate relations stored in main memory

Specified by:
getPredicates in interface IRDF_Model
Returns:
A MultiMap with keys IRDF_Statement objects and values collections of RDF_Predicate objects

getRange

public java.util.Collection getRange(IRDF_Property rdf_property)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Range objects in which rdf_property "participates"

Specified by:
getRange in interface IRDF_Model
Parameters:
rdf_property - An IRDF_Property
Returns:
An Collection object

getRanges

public org.apache.commons.collections.MultiMap getRanges()
Description copied from interface: IRDF_Model
Retrieves all the range relations stored in main memory

Specified by:
getRanges in interface IRDF_Model
Returns:
A MultiMap with keys IRDF_Property objects and values collections of RDF_Range objects

getSeeAlso

public java.util.Collection getSeeAlso(IRDF_Resource rdf_resource)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_SeeAlso objects in which rdf_resource "participates"

Specified by:
getSeeAlso in interface IRDF_Model
Parameters:
rdf_resource - An IRDF_Resource
Returns:
An Collection object

getSeeAlsos

public org.apache.commons.collections.MultiMap getSeeAlsos()
Description copied from interface: IRDF_Model
Retrieves all the seeAlso relations stored in main memory

Specified by:
getSeeAlsos in interface IRDF_Model
Returns:
A MultiMap with keys IRDF_Resource objects and values collections of RDF_SeeAlso objects

getSuperClassOf

public java.util.Collection<IRDF_SubClass> getSuperClassOf(IRDF_Class rdf_class)
Retrieves the Collection of RDF_SubClass objects in which rdf_class "participates" as the superclass

Specified by:
getSuperClassOf in interface IRDF_Model
Parameters:
rdf_class - An RDF_Class
Returns:
An Collection object

getSubClassOf

public java.util.Collection<IRDF_SubClass> getSubClassOf(IRDF_Class rdf_class)
Retrieves the Collection of RDF_SubClass objects in which rdf_class "participates" as the subClass!!!

Specified by:
getSubClassOf in interface IRDF_Model
Parameters:
rdf_class - An RDF_Class
Returns:
An Collection object

getSubClasses

public org.apache.commons.collections.MultiMap getSubClasses()
Description copied from interface: IRDF_Model
Retrieves all the subClass relations stored in main memory

Specified by:
getSubClasses in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Class objects and values collections of RDF_SubClass objects

getSubProperties

public org.apache.commons.collections.MultiMap getSubProperties()
Description copied from interface: IRDF_Model
Retrieves all the subProperty relations stored in main memory

Specified by:
getSubProperties in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Property objects and values collections of RDF_SubProperty objects

getSubProperty

@Deprecated
public java.util.Collection<IRDF_SubProperty> getSubProperty(IRDF_Property rdf_property)
Deprecated. 

Description copied from interface: IRDF_Model
Retrieves the subproperties of this class

Specified by:
getSubProperty in interface IRDF_Model
Parameters:
rdf_property - An RDF_Property
Returns:
An Collection object

getSuperPropertyOf

public java.util.Collection<IRDF_SubProperty> getSuperPropertyOf(IRDF_Property rdf_property)
Retrieves the subproperties of this property


getSuperProperty

@Deprecated
public java.util.Collection<IRDF_SubProperty> getSuperProperty(IRDF_Property property)
Deprecated. 

Retrieves the superproperties of this property Use RDF_Model.getSuperPropertyOf instead

Specified by:
getSuperProperty in interface IRDF_Model
Parameters:
property - An RDF_Property
Returns:
An Collection object
See Also:
IRDF_Model.getSuperProperty(gr.forth.ics.rdfsuite.swkm.model.IRDF_Property)

getSubPropertyOf

public java.util.Collection<IRDF_SubProperty> getSubPropertyOf(IRDF_Property property)

getSubject

public IRDF_Subject getSubject(IRDF_Statement rdf_statement)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Subject objects in which rdf_statement "participates"

Specified by:
getSubject in interface IRDF_Model
Parameters:
rdf_statement - An RDF_Statement
Returns:
An Collection object

getSubjects

public java.util.HashMap<IRDF_Statement,IRDF_Subject> getSubjects()
Description copied from interface: IRDF_Model
Retrieves all the subject relations stored in main memory

Specified by:
getSubjects in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Statement objects and values collections of RDF_Subject objects

getType

public java.util.Collection<IRDF_Type> getType(IRDF_Resource resource)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Type objects in which rdf_type "participates"

Specified by:
getType in interface IRDF_Model
Parameters:
resource - An RDF_Resource
Returns:
An Collection object

getInstances

public java.util.Collection<IRDF_Type> getInstances(IRDF_Class rdf_class)
Description copied from interface: IRDF_Model
Retrieves the Collection of RDF_Type objects in which the given class "participates" as the type class. In other words retrieves the instance triples of this class

Specified by:
getInstances in interface IRDF_Model
Parameters:
rdf_class - An IRDF_Class
Returns:
An Collection object

getTypeWithSubjectAndObject

public IRDF_Type getTypeWithSubjectAndObject(IRDF_Resource subject,
                                             IRDF_Resource object)

getMemberWithSubjectAndObject

public IRDF_Member getMemberWithSubjectAndObject(IRDF_Resource subject,
                                                 java.lang.Object object)

getIsDefinedByWithSubjectAndObject

public IRDF_IsDefinedBy getIsDefinedByWithSubjectAndObject(IRDF_Resource subject,
                                                           IRDF_Resource object)

getSeeAlsoWithSubjectAndObject

public IRDF_SeeAlso getSeeAlsoWithSubjectAndObject(IRDF_Resource subject,
                                                   IRDF_Resource object)

getLabelWithSubjectAndObject

public IRDF_Label getLabelWithSubjectAndObject(IRDF_Resource subject,
                                               IRDF_Literal object)

getMemberWithSubjectAndObject

public IRDF_Member getMemberWithSubjectAndObject(IRDF_Container subject,
                                                 java.lang.Object object)

getCommentWithSubjectAndObject

public IRDF_Comment getCommentWithSubjectAndObject(IRDF_Resource subject,
                                                   IRDF_Literal object)

getRangeWithSubjectAndObject

public IRDF_Range getRangeWithSubjectAndObject(IRDF_Resource subject,
                                               IRDF_Resource object)

getDomainWithSubjectAndObject

public IRDF_Domain getDomainWithSubjectAndObject(IRDF_Resource subject,
                                                 IRDF_Resource object)

getSubPropertyWithSubjectAndObject

public IRDF_SubProperty getSubPropertyWithSubjectAndObject(IRDF_Resource subject,
                                                           IRDF_Resource object)

getSubClassWithSubjectAndObject

public IRDF_SubClass getSubClassWithSubjectAndObject(IRDF_Resource subject,
                                                     IRDF_Resource object)

getTypes

public org.apache.commons.collections.MultiMap getTypes()
Description copied from interface: IRDF_Model
Retrieves all the type relations stored in main memory

Specified by:
getTypes in interface IRDF_Model
Returns:
A MultiMap with keys RDF_Resource objects and values collections of RDF_Type objects

setComments

public void setComments(org.apache.commons.collections.MultiMap comments)
Description copied from interface: IRDF_Model
Sets the comment Relationships defined in this namespace

Specified by:
setComments in interface IRDF_Model
Parameters:
comments - A MultiMap with keys RDF_Resource objects and values collections of RDF_Comment objects

setDomains

public void setDomains(org.apache.commons.collections.MultiMap domains)
Description copied from interface: IRDF_Model
Sets the domain Relationships defined in this namespace

Specified by:
setDomains in interface IRDF_Model
Parameters:
domains - A MultiMap with keys RDF_Property objects and values collections of RDF_Domains objects

setIsDefinedBys

public void setIsDefinedBys(org.apache.commons.collections.MultiMap is_defined_bys)
Description copied from interface: IRDF_Model
Sets the isDefinedBy Relationships defined in this namespace

Specified by:
setIsDefinedBys in interface IRDF_Model
Parameters:
is_defined_bys - A MultiMap with keys IRDF_Resource objects and values collections of RDF_IsDefinedBy objects

setLabels

public void setLabels(org.apache.commons.collections.MultiMap labels)
Description copied from interface: IRDF_Model
Sets the label Relationships defined in this namespace

Specified by:
setLabels in interface IRDF_Model
Parameters:
labels - A MultiMap with keys RDF_Resource objects and values collections of RDF_Label objects

setMembers

public void setMembers(org.apache.commons.collections.MultiMap members)
Description copied from interface: IRDF_Model
Sets the container membership Relationships defined in this namespace

Specified by:
setMembers in interface IRDF_Model
Parameters:
members - A MultiMap with keys RDF_Container objects and values collections of RDF_Member objects

setObjects

public void setObjects(java.util.HashMap<IRDF_Statement,IRDF_Object> objects)
Description copied from interface: IRDF_Model
Sets the object Relationships defined in this namespace

Specified by:
setObjects in interface IRDF_Model
Parameters:
objects - A MultiMap with keys IRDF_Statement objects and values collections of RDF_Object objects

setPredicates

public void setPredicates(java.util.HashMap<IRDF_Statement,IRDF_Predicate> predicates)
Description copied from interface: IRDF_Model
Sets the predicate Relationships defined in this namespace

Specified by:
setPredicates in interface IRDF_Model

setRanges

public void setRanges(org.apache.commons.collections.MultiMap ranges)
Description copied from interface: IRDF_Model
Sets the range Relationships defined in this namespace

Specified by:
setRanges in interface IRDF_Model
Parameters:
ranges - A MultiMap with keys IRDF_Property objects and values collections of RDF_Range objects

setSeeAlsos

public void setSeeAlsos(org.apache.commons.collections.MultiMap see_alsos)
Description copied from interface: IRDF_Model
Sets the seeAlso Relationships defined in this namespace

Specified by:
setSeeAlsos in interface IRDF_Model
Parameters:
see_alsos - A MultiMap with keys IRDF_Resource objects and values collections of RDF_SeeAlso objects

setSubClasses

public void setSubClasses(org.apache.commons.collections.MultiMap sub_classes)
Description copied from interface: IRDF_Model
Sets the subClass Relationships defined in this namespace

Specified by:
setSubClasses in interface IRDF_Model
Parameters:
sub_classes - A MultiMap with keys RDF_Class objects and values collections of RDF_SubClass objects

setSubProperties

public void setSubProperties(org.apache.commons.collections.MultiMap sub_properies)
Description copied from interface: IRDF_Model
Sets the subProperty Relationships defined in this namespace

Specified by:
setSubProperties in interface IRDF_Model
Parameters:
sub_properies - A MultiMap with keys RDF_Property objects and values collections of RDF_SubProperty objects

setSubjects

public void setSubjects(java.util.HashMap<IRDF_Statement,IRDF_Subject> subjects)
Description copied from interface: IRDF_Model
Sets the subject Relationships defined in this namespace

Specified by:
setSubjects in interface IRDF_Model
Parameters:
subjects - A MultiMap with keys RDF_Statement objects and values collections of RDF_Subject objects

setTypes

public void setTypes(org.apache.commons.collections.MultiMap types)
Description copied from interface: IRDF_Model
Sets the type Relationships defined in this namespace

Specified by:
setTypes in interface IRDF_Model
Parameters:
types - A MultiMap with keys RDF_Resource objects and values collections of RDF_Type objects

setComments

public void setComments(IRDF_Resource resource,
                        java.util.Collection<IRDF_Comment> comments)
Description copied from interface: IRDF_Model
Sets the comments of a single resource

Specified by:
setComments in interface IRDF_Model

setDomains

public void setDomains(IRDF_Property property,
                       java.util.Collection<IRDF_Domain> domains)
Description copied from interface: IRDF_Model
Sets the domains of a single property

Specified by:
setDomains in interface IRDF_Model

setRanges

public void setRanges(IRDF_Property property,
                      java.util.Collection<IRDF_Range> ranges)
Description copied from interface: IRDF_Model
Sets the ranges of a single property

Specified by:
setRanges in interface IRDF_Model

setIsDefinedBys

public void setIsDefinedBys(IRDF_Resource resource,
                            java.util.Collection<IRDF_IsDefinedBy> is_defined_bys)
Description copied from interface: IRDF_Model
Sets the isDefinedBys of a single resource

Specified by:
setIsDefinedBys in interface IRDF_Model

setLabels

public void setLabels(IRDF_Resource resource,
                      java.util.Collection<IRDF_Label> labels)
Description copied from interface: IRDF_Model
Sets the labels of a single resource

Specified by:
setLabels in interface IRDF_Model

setMembers

public void setMembers(IRDF_Container container,
                       java.util.Collection<IRDF_Member> members)

setSeeAlsos

public void setSeeAlsos(IRDF_Resource resource,
                        java.util.Collection<IRDF_SeeAlso> see_alsos)
Description copied from interface: IRDF_Model
Sets the see alsos of a single resource

Specified by:
setSeeAlsos in interface IRDF_Model

setSuperClassesOf

public void setSuperClassesOf(IRDF_Class rdf_class,
                              java.util.Collection<IRDF_SubClass> sub_classes)
Description copied from interface: IRDF_Model
Sets the superclasses of a single class

Specified by:
setSuperClassesOf in interface IRDF_Model

setSubProperties

public void setSubProperties(IRDF_Property property,
                             java.util.Collection<IRDF_SubProperty> sub_properies)
Description copied from interface: IRDF_Model
Sets the superproperties of a single property

Specified by:
setSubProperties in interface IRDF_Model

setTypes

public void setTypes(IRDF_Resource resource,
                     java.util.Collection<IRDF_Type> types)
Description copied from interface: IRDF_Model
Sets the types of a single resource

Specified by:
setTypes in interface IRDF_Model

toTriples

public java.util.Collection toTriples(boolean setOnly)
Description copied from interface: IRDF_Model
This method produces the statements(triples) that derive out of the Collection of namespaces and graphspaces constituting this model by calling the corresponding toTriples() methods from each namespace/graphspace in the Collections accordingly.

Specified by:
toTriples in interface IRDF_Model
Parameters:
setOnly - If true does not create the default namespaces' triples else it creates them too
Returns:
A Collection of Collection objects. By convention the subject of the first triple can be assumed to be in get(0).get(0),the predicate in get(0).get(1) and the object in get(0).get(2)

toTriples

public java.util.Collection<RDF_Triple> toTriples(java.lang.String uri)
                                           throws gr.forth.ics.rdfsuite.services.exceptions.UnknownUriException
Description copied from interface: IRDF_Model
This method produces the statements(triples) that derive out of the namespace or graphspace described by the given uri

Specified by:
toTriples in interface IRDF_Model
Parameters:
uri - The uri of the namespace/graphspace whose triples are wanted
Returns:
A Collection of Collection objects. By convention the subject of the first triple can be assumed to be in get(0).get(0),the predicate in get(0).get(1) and the object in get(0).get(2)
Throws:
gr.forth.ics.rdfsuite.services.exceptions.UnknownUriException

getClass_dag

public RDF_DAG getClass_dag()

setClass_dag

public void setClass_dag(RDF_DAG class_dag)

getMetaClass_dag

public RDF_DAG getMetaClass_dag()

setMetaClass_dag

public void setMetaClass_dag(RDF_DAG meta_class_dag)

getMetaProperty_dag

public RDF_DAG getMetaProperty_dag()

setMetaProperty_dag

public void setMetaProperty_dag(RDF_DAG meta_property_dag)

getProperty_dag

public RDF_DAG getProperty_dag()

setProperty_dag

public void setProperty_dag(RDF_DAG property_dag)

validate

public void validate()
              throws gr.forth.ics.rdfsuite.services.exceptions.ValidationException
Description copied from interface: IRDF_Model
Performs a validation of the schema and data loaded in main memory

Specified by:
validate in interface IRDF_Model
Throws:
gr.forth.ics.rdfsuite.services.exceptions.ValidationException - if the schema or data of a model are not valid

castResourcesToClassInstances

protected void castResourcesToClassInstances(IRDF_Class rdf_class)
This method iterates over the type triples and casts to class instances all resources that are subjects of triples with object this class

Parameters:
rdf_class -

castResourcesToClasses

protected void castResourcesToClasses(IRDF_MetaClass rdf_meta_class)
This method iterates over the type triples and casts to classes all resources that are subjects of triples with object this metaclass

Parameters:
rdf_meta_class -

castResourcesToProperties

protected void castResourcesToProperties(IRDF_MetaClass rdf_meta_class)
This method iterates over the type triples and casts to properties all resources that are subjects of triples with object this metaclass(of properties)

Parameters:
rdf_meta_class -

updateResourceReferencesInTriples

protected void updateResourceReferencesInTriples(IRDF_Resource original_rdf_resource,
                                                 IRDF_Resource new_rdf_resource)
Replaces rdf_class with rdf_meta_class in all triples that rdf_class occures

Parameters:
original_rdf_resource -
new_rdf_resource -

addResource

protected void addResource(IRDF_Resource resource)

getResource

protected IRDF_Resource getResource(java.lang.String resource_uri)

getResources

protected java.util.HashMap getResources()

setResources

protected void setResources(java.util.HashMap resources)

createResource

public IRDF_Resource createResource(java.lang.String resource_uri,
                                    Position pos)

getOrCreateResource

protected IRDF_Resource getOrCreateResource(java.lang.String resource_uri,
                                            Position pos)

initResourceIDs

protected void initResourceIDs()

retrieveResource

public IRDF_Resource retrieveResource(java.lang.String uri)
Description copied from interface: IRDF_Model
Retrieves the resource withthe given uri from its namesapce( if exists)

Specified by:
retrieveResource in interface IRDF_Model
Parameters:
uri - The String uri of the resource
Returns:
An IRDF_Resource

toTriples

public java.util.Iterator<IRDF_Triple> toTriples()

retrieveTriplesByPredicate

public java.util.Iterator<IRDF_Triple> retrieveTriplesByPredicate(java.lang.String predicate)

retrieveTriplesBySubject

public java.util.Iterator<IRDF_Triple> retrieveTriplesBySubject(IRDF_Resource subject)

retrieveTriplesByObject

public java.util.Iterator<IRDF_Triple> retrieveTriplesByObject(java.lang.Object object)

retrieveTriples

public java.util.Iterator<IRDF_Triple> retrieveTriples(IRDF_Resource subject,
                                                       IRDF_Property predicate,
                                                       java.lang.Object object)
Description copied from interface: IRDF_Model
Retrieves the triples (if any) with the given subject, predicate and/or object In case subject,predicate or object has value null this implies matching any.

Specified by:
retrieveTriples in interface IRDF_Model
Parameters:
subject - The subject of the triple
predicate - The predicate of the triple
object - The object of the triple
Returns:
An Iterator of IRDF_Triples. The triples that match the criteria.

retrieveTriples

public java.util.Iterator<IRDF_Triple> retrieveTriples(java.lang.String subject,
                                                       java.lang.String predicate,
                                                       java.lang.String object)
Description copied from interface: IRDF_Model
Retrieves the triples (if any) with the given subject,predicate and/or object In case subject,predicate or object has value null this implies matching any.

Specified by:
retrieveTriples in interface IRDF_Model
Parameters:
subject - String The subject of the triple
predicate - String The predicate of the triple
object - String The object of the triple
Returns:
An Iterator of IRDF_Triples. The triples that match the criteria.

write_file

public java.util.Map<java.lang.String,java.io.File> write_file(java.lang.String output_path,
                                                               java.lang.String triple_format,
                                                               java.lang.String base_uri,
                                                               boolean setOnly,
                                                               boolean multiple)
                                                        throws java.io.FileNotFoundException,
                                                               java.io.IOException
Description copied from interface: IRDF_Model
This method outputs the the namespaces/graphspaces correlated to this model in one or more output files according to the value of parameter multiple. The files are written in the given output_path and have as name the local_name of the the namespaces/graphpspaces The alternative values for the format of the generated triples are RDF_Model.RDF_XML(unimplemented), RDF_Model.TRIG

Specified by:
write_file in interface IRDF_Model
Parameters:
output_path - The file system path where the file(s)
triple_format - A String containing the format of the output that will be created(RDF_Model.RDF_XML(unimplemented) or RDF_Model.TRIG)
base_uri - output_base_uri The uri describing the output string in case we want all namespaces/graphspaces outputed in one single string which is the case when parameter multiple takes value false. If parameter multiple takes value true this uri is ignored because the actual namespace/graphspace uris are used
setOnly - false if you want ALL the triples of the model including RDFSchema,RDFNS,XMLSchema else true be outputed to a single one.
multiple - If true each namespace and graphspace will be outputed to a different String else they will all be outputed to a single one.
Returns:
Map A Map with key the URI of the namespace/graphspace written in the file and as value the File pointer
Throws:
java.io.FileNotFoundException - if the given file path does not exist
java.io.IOException - if it is not possible to write to the buffered writed

write_string

public java.util.Map write_string(java.lang.String format,
                                  java.lang.String base_uri,
                                  boolean setOnly,
                                  boolean multiple)
                           throws gr.forth.ics.rdfsuite.services.exceptions.UnsupportedFormatException
Description copied from interface: IRDF_Model
This method outputs the namespaces/graphspaces correlated to this model in a HashMap of pairs where the key is the namespace/graphspace uri and the value is the actual namespace/graphspace. The alternative values for the format of the generated triples are RDF_Model.TRIG

Specified by:
write_string in interface IRDF_Model
Parameters:
format - A String containing the format of the output that will be created(RDF_Model.RDF_XML(unimplemented) or RDF_Model.TRIG)
base_uri - The uri describing the output string in case we want all namespaces/graphspaces outputed in one single string which is the case when parameter multiple takes value false. If parameter multiple takes value true this uri is ignored because the actual namespace/graphspace uris are used
setOnly - false if you want ALL the triples of the model including RDFSchema,RDFNS,XMLSchema else true
multiple - If true each namespace and graphspace will be outputed to a different String else they will all be outputed to a single one.
Throws:
gr.forth.ics.rdfsuite.services.exceptions.UnsupportedFormatException - if the format is not one of the predefined in RDF_Model

write_original_and_inferred_in_file

public java.util.Map<java.lang.String,java.io.File> write_original_and_inferred_in_file(java.lang.String output_path,
                                                                                        java.lang.String triple_format,
                                                                                        java.lang.String base_uri,
                                                                                        boolean setOnly,
                                                                                        boolean multiple)
                                                                                 throws java.io.FileNotFoundException,
                                                                                        java.io.IOException,
                                                                                        gr.forth.ics.rdfsuite.services.exceptions.UnsupportedFormatException
Description copied from interface: IRDF_Model
This method writes in files both the original triples steming from the source files and the inferred triples created arbitrarily from the model to make it complete( in case the original files were not complete) Example: If a file contains only triple A subClassOf B, the model will add A type Class and B type Class triples. The first is considered as original while the two last as inferred This method outputs the the namespaces/graphspaces correlated to this model in one or more output files according to the value of parameter multiple. The files are written in the given output_path and have as name the local_name of the the namespaces/graphpspaces The alternative values for the format of the generated triples are RDF_Model.RDF_XML(unimplemented), RDF_Model.TRIG

Specified by:
write_original_and_inferred_in_file in interface IRDF_Model
Parameters:
output_path - The file system path where the file(s)
triple_format - A String containing the format of the output that will be created(RDF_Model.RDF_XML(unimplemented) or RDF_Model.TRIG)
base_uri - output_base_uri The uri describing the output string in case we want all namespaces/graphspaces outputed in one single string which is the case when parameter multiple takes value false. If parameter multiple takes value true this uri is ignored because the actual namespace/graphspace uris are used
setOnly - false if you want ALL the triples of the model including RDFSchema,RDFNS,XMLSchema else true be outputed to a single one.
multiple - If true each namespace and graphspace will be outputed to a different String else they will all be outputed to a single one.
Returns:
Map A Map with key the URI of the namespace/graphspace written in the file and as value the File pointer If the returned is a graphspace the key will be of the form a#graph_name. Notice that the returned file/string cannot be "redirected" to RDF_Model.read method with base_uri the key of the map, since the graph_uri is not the base_uri of the file.
Throws:
java.io.FileNotFoundException - if the given file path does not exist
java.io.IOException - if it is not possible to write to the buffered writed UnsupportedFormatException if the format is not one of the predefined in RDF_Model
gr.forth.ics.rdfsuite.services.exceptions.UnsupportedFormatException

write_original_and_inferred_in_string

public java.util.Map write_original_and_inferred_in_string(java.lang.String format,
                                                           java.lang.String base_uri,
                                                           boolean setOnly,
                                                           boolean multiple)
                                                    throws java.io.IOException
Description copied from interface: IRDF_Model
This method writes in strings both the original triples steming from the source files and the inferred triples created arbitrarily from the model to make it complete( in case the original files were not complete) Example: If a file contains only triple A subClassOf B, the model will add A type Class and B type Class triples. The first is considered as original while the two last as inferred This method outputs the namespaces/graphspaces correlated to this model in a HashMap of pairs where the key is the namespace/graphspace uri and the value is the actual namespace/graphspace. The alternative values for the format of the generated triples are RDF_Model.TRIG

Specified by:
write_original_and_inferred_in_string in interface IRDF_Model
Parameters:
format - A String containing the format of the output that will be created(RDF_Model.RDF_XML(unimplemented) or RDF_Model.TRIG)
base_uri - The uri describing the output string in case we want all namespaces/graphspaces outputed in one single string which is the case when parameter multiple takes value false. If parameter multiple takes value true this uri is ignored because the actual namespace/graphspace uris are used
setOnly - false if you want ALL the triples of the model including RDFSchema,RDFNS,XMLSchema else true
multiple - If true each namespace and graphspace will be outputed to a different String else they will all be outputed to a single one.
Throws:
gr.forth.ics.rdfsuite.services.exceptions.UnsupportedFormatException - if the format is not one of the predefined in RDF_Model
java.io.IOException - if it is not possible to write to the buffered writed

getClasses

public java.util.Collection<IRDF_Class> getClasses(boolean considerRDFNS,
                                                   boolean considerXSDNS)
                                            throws gr.forth.ics.rdfsuite.services.exceptions.EmptyModelException
Specified by:
getClasses in interface IRDF_Model
Throws:
gr.forth.ics.rdfsuite.services.exceptions.EmptyModelException

getProperties

public java.util.Collection<IRDF_Property> getProperties(boolean considerRDFNS,
                                                         boolean considerXSDNS)
Specified by:
getProperties in interface IRDF_Model

getLiterals

public java.util.HashMap<java.lang.String,IRDF_Literal> getLiterals()

setLiterals

public void setLiterals(java.util.HashMap<java.lang.String,IRDF_Literal> literals)

addLiteral

public void addLiteral(IRDF_Literal literal)

getLiteral

public IRDF_Literal getLiteral(java.lang.String literal)

getOrCreateLiteral

protected IRDF_Literal getOrCreateLiteral(java.lang.String literal)

enter_label

protected int enter_label(java.lang.String subject,
                          java.lang.String predicate,
                          java.lang.String object,
                          Position pos,
                          java.lang.String graphspace_uri,
                          boolean strict)
Parameters:
subject -
predicate -
object -
pos -
graphspace_uri -
strict -
Returns:
0 for false,needs to be fed to model, 1 for true, 2 for false and should not be fed to model(error)

enter_comment

protected boolean enter_comment(java.lang.String subject,
                                java.lang.String predicate,
                                java.lang.String object,
                                Position pos,
                                java.lang.String graphspace_uri,
                                boolean strict)

getOrCreateCommentTriple

protected IRDF_Comment getOrCreateCommentTriple(IRDF_Resource subject_resource,
                                                IRDF_Literal comment,
                                                boolean inferred)

getOrCreateLabelTriple

protected IRDF_Label getOrCreateLabelTriple(IRDF_Resource subject_resource,
                                            IRDF_Literal label,
                                            boolean inferred)
If a subclass triple for subject class and object_class already exists it retrieves it ore else it creates a new one


getOrCreateMemberTriple

protected IRDF_Member getOrCreateMemberTriple(IRDF_Container subject_resource,
                                              java.lang.Object member,
                                              int member_index,
                                              boolean inferred)

eliminateRedundancies

public void eliminateRedundancies()
                           throws gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException
Eliminates redundant triples in model. This is performed using the hierarchy dags we retain in main memory.

Specified by:
eliminateRedundancies in interface IRDF_Model
Throws:
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException

removeSubClassTriplesOf

protected void removeSubClassTriplesOf(IRDF_Class rdf_class)

getTypes_hashed_on_object

protected org.apache.commons.collections.MultiMap getTypes_hashed_on_object()

getTypes_hashed_on_subject_object

protected java.util.Map getTypes_hashed_on_subject_object()

getLabelsCreated

public boolean getLabelsCreated()
Returns true if labels are created for this model

Specified by:
getLabelsCreated in interface IRDF_Model

setLabelsCreated

public void setLabelsCreated(boolean created)
Sets whether labels are created for this model

Specified by:
setLabelsCreated in interface IRDF_Model
Parameters:
created - true if labels are created else false