@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns1: <http://www.openlinksw.com/schemas/graphql#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dt: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix wdrs: <http://www.w3.org/2007/05/powder-s#> .
@prefix openvocab: <http://open.vocab.org/terms/> .

ns1:Array
    a ns1:MappingObject ;
    rdfs:comment "Class representing GraphQL type `LIST`" ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "Array"@en .

ns1:Boolean
    a ns1:MappingObject ;
    rdfs:comment "Object for scalar type `Boolean`, when a field is not present defaults to `false`" ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "Boolean"@en .

ns1:Function
    a ns1:MappingObject ;
    rdfs:comment "Class representing `SPARQL` query" ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "Function"@en .

ns1:Map
    a owl:Class ;
    rdfs:comment "The root object of GraphQL/SPARQL bridge annotation properties" ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "Map"@en .

ns1:MappingObject
    a owl:Class ;
    rdfs:comment """
        This is a core mapping class, all objects representing GraphQL objects and fields are instance of this class. 
        All instance denotations MUST be scoped to the namespace prefix `gql: <http://www.openlinksw.com/schemas/graphql#>`. 
        Example: query { planet { order_num } } will use `gql:planet` and `gql:order_num` to find associated RDF class and property. 
        RDF terms mappings should be defined using the form:  `gql:planet gql:rdfClass ex:Planet` and `ex:planetOrder gql:field gql:order_num`. 
        """ ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "MappingObject"@en .

ns1:Object
    a ns1:MappingObject ;
    rdfs:comment "Class representing GraphQL type `OBJECT`" ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "Object"@en .

ns1:Scalar
    a ns1:MappingObject ;
    rdfs:comment "Common object for all scalar types e.g. String, Int, Float etc., if a field is not present defaults to `null`" ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "Scalar"@en .

ns1:dataGraph
    a owl:DatatypeProperty ;
    rdfs:comment "The IRI of graph containing the RDF Dataset." ;
    rdfs:domain ns1:Map ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "dataGraph"@en ;
    rdfs:range rdf:Resource .

ns1:field
    a owl:ObjectProperty ;
    rdfs:comment """Mapping of a RDF property to a GraphQL field name.
     This property is used to match a given input field from a GraphQL query 
     to a property associated with matching OWL/RDF class""" ;
    rdfs:domain owl:DatatypeProperty, owl:ObjectProperty ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "field"@en ;
    rdfs:range rdfs:MappingObject .

ns1:inferenceName
    a owl:DatatypeProperty ;
    rdfs:comment "The label of RDF inference rule used to query RDF data" ;
    rdfs:domain ns1:Map ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "inferenceName"@en ;
    rdfs:range dt:string .

ns1:iriPattern
    a owl:DatatypeProperty ;
    rdfs:comment "A `sprintf` format string that denotes instances of `this` class" ;
    rdfs:domain owl:Class ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "iriPattern"@en ;
    rdfs:range dt:string .

ns1:mutationType
    a owl:DatatypeProperty ;
    rdfs:comment "Type of operation used to perform basic mutation operations on instances of `this` class, `INSERT` or `DELETE`" ;
    rdfs:domain owl:Class ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "mutationType"@en ;
    rdfs:range dt:string .

ns1:rdfClass
    a owl:ObjectProperty ;
    rdfs:comment "Mapping between an OWL/RDF class and GraphQL mapping object listed in `schemaObjects` " ;
    rdfs:domain rdfs:MappingObject ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "rdfClass"@en ;
    rdfs:range owl:Class .

ns1:schema
    openvocab:defines ns1:Array, ns1:Boolean, ns1:Function, ns1:Map, ns1:MappingObject, ns1:Object, ns1:Scalar, ns1:dataGraph, ns1:field, ns1:inferenceName, ns1:iriPattern, ns1:mutationType, ns1:rdfClass, ns1:schemaGraph, ns1:schemaObjects, ns1:sparqlQuery, ns1:type ;
    dcterms:created "2022-07-03"^^dt:date ;
    dcterms:modified "2022-07-14"^^dt:date ;
    a owl:Ontology ;
    rdfs:comment """
    This ontology descibe terms for annotating classes and properties that inform the behavior of our GraphQL/SPARQL bridge.
    These annotations can be used with a dataset-specific OWL/RDF ontology to enabled data access using GraphQL payloads via HTTP.
    """ ;
    rdfs:label "RDF Ontology to GraphQL mappings schema" ;
    wdrs:describedby <http://www.openlinksw.com/DAV/data/turtle/graphql-schema.ttl> .

ns1:schemaGraph
    a owl:DatatypeProperty ;
    rdfs:comment "The IRI of the schema (`self`)." ;
    rdfs:domain ns1:Map ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "schemaGraph"@en ;
    rdfs:range rdfs:Resource .

ns1:schemaObjects
    a owl:ObjectProperty ;
    rdfs:comment "List of mappings between GraphQL and RDF objects and fields." ;
    rdfs:domain ns1:Map ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "schemaObjects"@en ;
    rdfs:range ns1:MappingObject .

ns1:sparqlQuery
    a owl:DatatypeProperty ;
    rdfs:comment "`SPARQL` query text for `gql:Function` field types" ;
    rdfs:domain owl:Class ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "sparqlQuery"@en ;
    rdfs:range dt:string .

ns1:type
    a owl:ObjectProperty ;
    rdfs:comment """Mapping of a RDF property to `SCALAR`, `OBJECT` and `LIST` GraphQL types. 
    This property is used in output serialisation (for ex. `JSON`) to represent nodes and leafs in the results tree""" ;
    rdfs:domain owl:DatatypeProperty, owl:ObjectProperty ;
    rdfs:isDefinedBy ns1:schema ;
    rdfs:label "type"@en ;
    rdfs:range ns1:Array, ns1:Object, ns1:Scalar .

