Package com.github.owlcs.ontapi.internal
Class ReadHelper
java.lang.Object
com.github.owlcs.ontapi.internal.ReadHelper
A collection of helper methods to perform translation of RDF-Graph to the
OWLObjects (i.e. reading from a Graph).
Created by @ssz on 25.11.2016.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ONTObject<? extends org.semanticweb.owlapi.model.OWLClassExpression> calcClassExpression(org.apache.jena.ontapi.model.OntClass ce, ONTObjectFactory of, Set<org.apache.jena.rdf.model.Resource> seen) Calculates anOWLClassExpressionwrapped byONTObject.static ONTObject<? extends org.semanticweb.owlapi.model.OWLDataRange> calcDataRange(org.apache.jena.ontapi.model.OntDataRange dr, ONTObjectFactory of, Set<org.apache.jena.rdf.model.Resource> seen) Calculates anOWLDataRangewrapped byONTObject.static org.semanticweb.owlapi.model.OWLFacetRestrictioncalcOWLFacetRestriction(org.apache.jena.ontapi.model.OntFacetRestriction fr, ONTObjectFactory of) Creates anOWLFacetRestrictioninstance.static ONTObject<? extends org.semanticweb.owlapi.model.SWRLAtom> calcSWRLAtom(org.apache.jena.ontapi.model.OntSWRL.Atom<?> atom, ONTObjectFactory of) static ONTObject<org.semanticweb.owlapi.model.OWLAnnotation> getAnnotation(org.apache.jena.ontapi.model.OntStatement ann, ONTObjectFactory of) static org.semanticweb.owlapi.vocab.OWLFacetGets the facet by ONT-API type.static ONTObject<org.semanticweb.owlapi.model.OWLFacetRestriction> getFacetRestriction(org.apache.jena.ontapi.model.OntFacetRestriction fr, ONTObjectFactory of) MapsOntFacetRestriction=>OWLFacetRestriction.static ONTObject<? extends org.semanticweb.owlapi.model.SWRLIArgument> getSWRLIndividualArg(org.apache.jena.ontapi.model.OntSWRL.IArg arg, ONTObjectFactory of) static ONTObject<? extends org.semanticweb.owlapi.model.SWRLDArgument> getSWRLLiteralArg(org.apache.jena.ontapi.model.OntSWRL.DArg arg, ONTObjectFactory of) static ONTObject<org.semanticweb.owlapi.model.SWRLVariable> getSWRLVariable(org.apache.jena.ontapi.model.OntSWRL.Variable var, ONTObjectFactory of) static booleanisAnnotationAssertionStatement(org.apache.jena.ontapi.model.OntStatement s, AxiomsSettings config) Answers if the givenOntStatementcan be considered as annotation property assertion.static booleanisDeclarationStatement(org.apache.jena.ontapi.model.OntStatement s) Answerstrueif the givenOntStatementis a declaration (predicate =rdf:type) of some OWL entity or anonymous individual.static booleanisEntityOrAnonymousIndividual(org.apache.jena.rdf.model.Resource o) Answerstrueif the givenResourceis an OWL-Entity or Anonymous Individualstatic org.apache.jena.util.iterator.ExtendedIterator<ONTObject<org.semanticweb.owlapi.model.OWLAnnotation>> listAnnotations(org.apache.jena.ontapi.model.OntStatement statement, AxiomsSettings conf, ONTObjectFactory factory) Lists allOWLAnnotations which are associated with the specified statement.static org.apache.jena.util.iterator.ExtendedIterator<ONTObject<org.semanticweb.owlapi.model.OWLAnnotation>> listOWLAnnotations(org.apache.jena.ontapi.model.OntObject obj, ONTObjectFactory of) Lists all annotations related to the object (including assertions).static booleantestAnnotationAxiomOverlaps(org.apache.jena.ontapi.model.OntStatement statement, AxiomsSettings conf, org.semanticweb.owlapi.model.AxiomType<? extends org.semanticweb.owlapi.model.OWLObjectPropertyAxiom> o, org.semanticweb.owlapi.model.AxiomType<? extends org.semanticweb.owlapi.model.OWLDataPropertyAxiom> d) Auxiliary method for simplification code.
-
Constructor Details
-
ReadHelper
public ReadHelper()
-
-
Method Details
-
testAnnotationAxiomOverlaps
public static boolean testAnnotationAxiomOverlaps(org.apache.jena.ontapi.model.OntStatement statement, AxiomsSettings conf, org.semanticweb.owlapi.model.AxiomType<? extends org.semanticweb.owlapi.model.OWLObjectPropertyAxiom> o, org.semanticweb.owlapi.model.AxiomType<? extends org.semanticweb.owlapi.model.OWLDataPropertyAxiom> d) Auxiliary method for simplification code. Used in Annotation Translators. If the specified statement also belongs to the another type of axiom and such situation is prohibited in the config then returnsfalse. This is for three kinds of statements:A1 rdfs:subPropertyOf A2A rdfs:domain UA rdfs:range U
P rdfs:range Ccould be treated asA rdfs:range U, but not vice versa.- Parameters:
statement-OntStatementto test, notnullconf-AxiomsSettings, notnullo-AxiomType.SUB_OBJECT_PROPERTYorAxiomType.OBJECT_PROPERTY_DOMAINorAxiomType.OBJECT_PROPERTY_RANGEd-AxiomType.SUB_DATA_PROPERTYorAxiomType.DATA_PROPERTY_DOMAINorAxiomType.DATA_PROPERTY_RANGE- Returns:
trueif the statement is good to be represented in the form of annotation axiom
-
isDeclarationStatement
public static boolean isDeclarationStatement(org.apache.jena.ontapi.model.OntStatement s) Answerstrueif the givenOntStatementis a declaration (predicate =rdf:type) of some OWL entity or anonymous individual.- Parameters:
s-OntStatementto test- Returns:
- boolean
-
isEntityOrAnonymousIndividual
public static boolean isEntityOrAnonymousIndividual(org.apache.jena.rdf.model.Resource o) Answerstrueif the givenResourceis an OWL-Entity or Anonymous Individual- Parameters:
o-Resource- Returns:
- boolean
-
isAnnotationAssertionStatement
public static boolean isAnnotationAssertionStatement(org.apache.jena.ontapi.model.OntStatement s, AxiomsSettings config) Answers if the givenOntStatementcan be considered as annotation property assertion.- Parameters:
s-OntStatement, notnullconfig-AxiomsSettings, notnull- Returns:
trueif the specified statement is annotation property assertion
-
listAnnotations
public static org.apache.jena.util.iterator.ExtendedIterator<ONTObject<org.semanticweb.owlapi.model.OWLAnnotation>> listAnnotations(org.apache.jena.ontapi.model.OntStatement statement, AxiomsSettings conf, ONTObjectFactory factory) Lists allOWLAnnotations which are associated with the specified statement. AllOWLAnnotations are provided in the form ofONTObject-wrappers.- Parameters:
statement-OntStatement, axiom root statement, notnullconf-AxiomsSettings, notnullfactory-ONTObjectFactory- Returns:
- a set of wraps
ONTObjectaroundOWLAnnotation
-
listOWLAnnotations
public static org.apache.jena.util.iterator.ExtendedIterator<ONTObject<org.semanticweb.owlapi.model.OWLAnnotation>> listOWLAnnotations(org.apache.jena.ontapi.model.OntObject obj, ONTObjectFactory of) Lists all annotations related to the object (including assertions).- Parameters:
obj-OntObjectof-ONTObjectFactory- Returns:
ExtendedIteratorofONTObjects ofOWLAnnotation
-
getAnnotation
public static ONTObject<org.semanticweb.owlapi.model.OWLAnnotation> getAnnotation(org.apache.jena.ontapi.model.OntStatement ann, ONTObjectFactory of) - Parameters:
ann-OntStatementof-ONTObjectFactory- Returns:
ONTObjectaroundOWLAnnotation
-
getFacetRestriction
public static ONTObject<org.semanticweb.owlapi.model.OWLFacetRestriction> getFacetRestriction(org.apache.jena.ontapi.model.OntFacetRestriction fr, ONTObjectFactory of) MapsOntFacetRestriction=>OWLFacetRestriction.- Parameters:
fr-OntFacetRestriction, notnullof-ONTObjectFactory, notnull- Returns:
ONTObjectaroundOWLFacetRestriction
-
calcOWLFacetRestriction
public static org.semanticweb.owlapi.model.OWLFacetRestriction calcOWLFacetRestriction(org.apache.jena.ontapi.model.OntFacetRestriction fr, ONTObjectFactory of) Creates anOWLFacetRestrictioninstance.- Parameters:
fr-OntFacetRestriction, notnullof-ONTObjectFactory, notnull- Returns:
OWLFacetRestriction
-
getFacet
public static org.semanticweb.owlapi.vocab.OWLFacet getFacet(Class<? extends org.apache.jena.ontapi.model.OntFacetRestriction> type) Gets the facet by ONT-API type.- Parameters:
type-Class-type ofOntFacetRestriction- Returns:
OWLFacet- See Also:
-
calcDataRange
public static ONTObject<? extends org.semanticweb.owlapi.model.OWLDataRange> calcDataRange(org.apache.jena.ontapi.model.OntDataRange dr, ONTObjectFactory of, Set<org.apache.jena.rdf.model.Resource> seen) Calculates anOWLDataRangewrapped byONTObject. Note: this method is recursive.- Parameters:
dr-Ontology Data Rangeto mapof-ONTObjectFactoryseen- Set ofResource- Returns:
ONTObjectaroundOWLDataRange- Throws:
OntApiException- if something is wrong.
-
calcClassExpression
public static ONTObject<? extends org.semanticweb.owlapi.model.OWLClassExpression> calcClassExpression(org.apache.jena.ontapi.model.OntClass ce, ONTObjectFactory of, Set<org.apache.jena.rdf.model.Resource> seen) Calculates anOWLClassExpressionwrapped byONTObject. Note: this method is recursive.- Parameters:
ce-Ontology Class Expressionto mapof-ONTObjectFactoryseen- Set ofResource, a subsidiary collection to prevent possible graph recursions (e.g._:b0 owl:complementOf _:b0)- Returns:
ONTObjectaroundOWLClassExpression- Throws:
OntApiException- if something is wrong.
-
getSWRLVariable
public static ONTObject<org.semanticweb.owlapi.model.SWRLVariable> getSWRLVariable(org.apache.jena.ontapi.model.OntSWRL.Variable var, ONTObjectFactory of) - Parameters:
var-OntSWRL.Variableof-ONTObjectFactory- Returns:
ONTObjectaroundSWRLVariable
-
getSWRLLiteralArg
public static ONTObject<? extends org.semanticweb.owlapi.model.SWRLDArgument> getSWRLLiteralArg(org.apache.jena.ontapi.model.OntSWRL.DArg arg, ONTObjectFactory of) - Parameters:
arg-OntSWRL.DArgof-ONTObjectFactory- Returns:
ONTObjectaroundSWRLDArgument
-
getSWRLIndividualArg
public static ONTObject<? extends org.semanticweb.owlapi.model.SWRLIArgument> getSWRLIndividualArg(org.apache.jena.ontapi.model.OntSWRL.IArg arg, ONTObjectFactory of) - Parameters:
arg-OntSWRL.IArgof-ONTObjectFactory- Returns:
ONTObjectaroundSWRLIArgument
-
calcSWRLAtom
public static ONTObject<? extends org.semanticweb.owlapi.model.SWRLAtom> calcSWRLAtom(org.apache.jena.ontapi.model.OntSWRL.Atom<?> atom, ONTObjectFactory of) - Parameters:
atom-OntSWRL.Atomof-ONTObjectFactory- Returns:
ONTObjectaroundSWRLAtom
-