
it.uniroma2.art.owlart.models.RDFModel Maven / Gradle / Ivy
/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http//www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is ART OWL API.
*
* The Initial Developer of the Original Code is University of Roma Tor Vergata.
* Portions created by University of Roma Tor Vergata are Copyright (C) 2009.
* All Rights Reserved.
*
* The ART OWL API were developed by the Artificial Intelligence Research Group
* (art.uniroma2.it) at the University of Roma Tor Vergata
* Current information about the ART OWL API can be obtained at
* http://art.uniroma2.it/owlart
*
*/
package it.uniroma2.art.owlart.models;
import it.uniroma2.art.owlart.exceptions.ModelAccessException;
import it.uniroma2.art.owlart.exceptions.ModelUpdateException;
import it.uniroma2.art.owlart.model.ARTBNode;
import it.uniroma2.art.owlart.model.ARTResource;
import it.uniroma2.art.owlart.model.ARTURIResource;
import it.uniroma2.art.owlart.navigation.ARTResourceIterator;
import it.uniroma2.art.owlart.navigation.ARTURIResourceIterator;
/**
* Interface for basic RDF models
* Also, contains extensions to the {@link TripleQueryModel} which allows for more flexible management of
* query parameters
*
* @author Armando Stellato
*
*/
public interface RDFModel extends BaseRDFTripleModel, SPARQLQueryModel {
/**
* adds a resource with uri=uri
to the specified graphs
* The resource is automatically typized with class cls
*
* @param uri
* @param cls
* @param graphs
* @throws ModelUpdateException
*/
public abstract void addInstance(String uri, ARTResource cls, ARTResource... graphs)
throws ModelUpdateException;
/**
* adds a resource with uri=propertyURI
as an rdf:Property
* The new property is defined as subproperty of suprtProperty
(unless this last is
* null
)
*
* @param propertyURI
* @param superProperty
* @param graphs
* @throws ModelUpdateException
*/
public abstract void addProperty(String propertyURI, ARTURIResource superProperty, ARTResource... graphs)
throws ModelUpdateException;
/**
* adds a type to resource res
*
* @param res
* @param cls
* @param graphs
* @throws ModelUpdateException
*/
public abstract void addType(ARTResource res, ARTResource cls, ARTResource... graphs)
throws ModelUpdateException;
/**
* creates a triple for the given subject
, predicate
and value
* by using a plain literal with no language tag as the object
*
* @param subject
* @param predicate
* @param value
* @param graphs
* @throws ModelUpdateException
*/
public abstract void instantiatePropertyWithPlainLiteral(ARTResource subject, ARTURIResource predicate,
String value, ARTResource... graphs) throws ModelUpdateException;
/**
* creates a triple for the given subject
, predicate
and value
* by using a plain literal with a language tag as the object
*
* @param subject
* @param predicate
* @param value
* @param graphs
* @throws ModelUpdateException
*/
public abstract void instantiatePropertyWithPlainLiteral(ARTResource subject, ARTURIResource predicate,
String value, String lang, ARTResource... graphs) throws ModelUpdateException;
/**
* creates a triple for the given subject
, predicate
and object, which is
* described by its label (value
) and (datatype
)
*
* @param subject
* @param property
* @param value
* @param lang
* @throws ModelUpdateException
*/
public abstract void instantiatePropertyWithTypedLiteral(ARTResource subject, ARTURIResource property,
String value, ARTURIResource datatype, ARTResource... graphs) throws ModelUpdateException;
/**
* creates a triple for the given subject
, predicate
and object
* just a mere rewriting of addTriple with the object constrained to be a Resource
*
* @param subject
* @param predicate
* @param object
* @param graphs
* @throws ModelUpdateException
*/
public abstract void instantiatePropertyWithResource(ARTResource subject, ARTURIResource predicate,
ARTResource object, ARTResource... graphs) throws ModelUpdateException;
/**
* list all properties declared in graphs graphs
* If available, reasoning is activated by default, so all kind of properties should be returned by this
* method
*
* @param graphs
* @return
* @throws ModelAccessException
*/
public abstract ARTURIResourceIterator listProperties(ARTResource... graphs) throws ModelAccessException;
/**
* Contract for this method is:
* If there exist a triple in the specified graphs graphs
where a resource with uri=
* uri
is mentioned, then return that resource, otherwise return null
*
* @param uri
* @param graphs
* @return
* @throws ModelAccessException
*/
public abstract ARTURIResource retrieveURIResource(String uri, ARTResource... graphs)
throws ModelAccessException;
public abstract boolean existsResource(ARTResource res, ARTResource... graphs)
throws ModelAccessException;
/**
* Contract for this method is:
* If there exist a triple in the specified graphs graphs
where a blank node with id=
* ID
is mentioned, then return that blank node, otherwise return null
*
* @param uri
* @param graphs
* @return
* @throws ModelAccessException
*/
public abstract ARTBNode retrieveBNode(String ID, ARTResource... graphs) throws ModelAccessException;
/**
* retrieves all classes which are types for resource res
*
* @param res
* @param inferred
* @param graphs
* @return
* @throws ModelAccessException
*/
public ARTResourceIterator listTypes(ARTResource res, boolean inferred, ARTResource... graphs)
throws ModelAccessException;
/**
* retrieves all instances of class type
*
* @param type
* @param inferred
* @param graphs
* @return
* @throws ModelAccessException
*/
public ARTResourceIterator listInstances(ARTResource type, boolean inferred, ARTResource... graphs)
throws ModelAccessException;
public abstract ARTURIResourceIterator listNamedInstances(ARTResource... graphs)
throws ModelAccessException;;
/**
* checks if resource type
is a type for resource res
*
* @param res
* @param type
* @param inferred
* @param graphs
* @return
* @throws ModelAccessException
*/
public abstract boolean hasType(ARTResource res, ARTResource type, boolean inferred,
ARTResource... graphs) throws ModelAccessException;
/**
* removes the rdf:type relationship between res
and cls
*
* @param res
* @param cls
* @param graphs
* @throws ModelUpdateException
*/
public abstract void removeType(ARTResource res, ARTResource cls, ARTResource... graphs)
throws ModelUpdateException;
/**
* checks that resource prop
is a property
* If available, reasoning is activated by default, so all kind of properties should be properly checked
* by this method
*
* @param prop
* @param graphs
* @return
* @throws ModelAccessException
*/
public abstract boolean isProperty(ARTResource prop, ARTResource... graphs) throws ModelAccessException;
/*************************
* /* DELETE METHODS ***
*
* @throws ModelUpdateException
* @throws ModelAccessException
*************************/
/**
* remove resource
and all information about it from graphs graphs
*
* @param resource
* @param graphs
* @throws ModelUpdateException
*/
public abstract void deleteResource(ARTResource resource, ARTResource... graphs)
throws ModelUpdateException;
/**
* deletes a property
*
* @param individual
* @param graphs
* @throws ModelUpdateException
*/
public abstract void deleteProperty(ARTURIResource property, ARTResource... graphs)
throws ModelUpdateException;
/*************************
* /* RENAME METHODS ***
*
* @throws ModelUpdateException
* @throws ModelAccessException
*************************/
/**
* renames a resource
*
* @param res
* @param newURI
* @throws ModelUpdateException
*/
public abstract void renameResource(ARTURIResource res, String newURI, ARTResource... graphs)
throws ModelUpdateException;
/**
* renames a property (shortcut for {@link #renameResource(ARTURIResource, String, ARTResource...)}, as a
* property has no restriction on where it can appear inside a triple)
*
* @param res
* @param newLocalName
* @throws ModelUpdateException
*/
public abstract void renameProperty(ARTURIResource res, String newLocalName, ARTResource... graphs)
throws ModelUpdateException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy