-- Cleanup SPARQL CLEAR GRAPH ; SPARQL SELECT COUNT(*) FROM WHERE {?s ?p ?o} ; -- GraphQL Mapping Graph SPARQL PREFIX rdf: PREFIX rdfs: PREFIX owl: PREFIX dbo: PREFIX dbp: PREFIX gql: PREFIX dct: INSERT DATA INTO { # Schema.Org to GraphQL Entity & Property Mappings gql:Map gql:schemaObjects gql:Product, gql:Products, gql:Offer, gql:Offers, gql:WebPage, gql:FAQPage, gql:FAQPages, gql:Question, gql:Questions, gql:Answer, gql:Answers, gql:Images, gql:Actions, gql:Url ; # Target GraphQL Entity Types List gql:dataGraph ; # Instance Data (ABox) Graph gql:schemaGraph . # This Schema and Mappings # Schema.org Product Class to GraphQL Entity Type Mappings # gql:Product gql:type gql:Object ; gql:rdfClass schema:Product . gql:Products gql:type gql:Array ; gql:rdfClass schema:Product . gql:Offer gql:type gql:Object ; gql:rdfClass schema:Offer . gql:Offers gql:type gql:Array ; gql:rdfClass schema:Offer . gql:WebPage gql:type gql:Object ; gql:rdfClass schema:WebPage . gql:FAQPage gql:type gql:Object ; gql:rdfClass schema:FAQPage . gql:FAQPages gql:type gql:Array ; gql:rdfClass schema:FAQPage . gql:Question gql:type gql:Object ; gql:rdfClass schema:Question . gql:Questions gql:type gql:Array ; gql:rdfClass schema:Question . gql:Answer gql:type gql:Object ; gql:rdfClass schema:Answer . gql:Answers gql:type gql:Array ; gql:rdfClass schema:Answer . gql:Images gql:type gql:Array ; gql:rdfClass schema:Image . gql:Actions gql:type gql:Array ; gql:rdfClass schema:Action . gql:Url gql:type gql:Object ; gql:rdfClass schema:URL . # GraphQL Entity Field (Property) to Schema.org Product Property Mappings # schema:offers a owl:ObjectProperty ; rdfs:range schema:Offer ; rdfs:domain schema:Product, schema:FAQPage; gql:type gql:Array ; gql:field gql:offers . schema:mainEntityOfPage a owl:ObjectProperty ; rdfs:range schema:WebPage ; rdfs:domain schema:Product ; # gql:type gql:Array ; gql:type gql:Scalar ; gql:field gql:mainEntityOfPage . schema:mainEntity a owl:ObjectProperty ; rdfs:range schema:Question, schema:acceptedAnswer ; rdfs:domain schema:FAQPage ; gql:type gql:Array ; # gql:type gql:Scalar ; gql:field gql:mainEntity . schema:image a owl:ObjectProperty ; rdfs:range schema:Image ; rdfs:domain schema:Product, schema:FAQPage ; # gql:type gql:Array ; gql:type gql:Scalar ; gql:field gql:image . schema:url a owl:ObjectProperty ; rdfs:range schema:URL ; rdfs:domain schema:Product, schema:FAQPage ; # gql:type gql:Array ; gql:type gql:Scalar ; gql:field gql:url . schema:potentialAction a owl:ObjectProperty ; rdfs:range schema:Action ; rdfs:domain schema:Product, schema:Offer ; # gql:type gql:Array ; gql:type gql:Scalar ; gql:field gql:potentialAction . schema:acceptedAnswer a owl:ObjectProperty ; rdfs:range schema:Answer ; rdfs:domain schema:Question ; # gql:type gql:Array ; gql:type gql:Scalar ; gql:field gql:acceptedAnswer . schema:name a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:domain schema:Product, schema:Offer, schema:FAQPage, schema:Question ; gql:type gql:Scalar ; gql:field gql:name . schema:text a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:domain schema:Answer ; gql:type gql:Scalar ; gql:field gql:text . schema:description a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:domain schema:Product ; gql:type gql:Scalar ; gql:field gql:description . schema:sku a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:domain schema:Product, schema:Offer ; gql:type gql:Scalar ; gql:field gql:sku . schema:brand a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:domain schema:Product ; gql:type gql:Scalar ; gql:field gql:brand . schema:price a owl:DatatypeProperty ; rdfs:range xsd:decimal ; rdfs:domain schema:Product, schema:Offer ; gql:type gql:Scalar ; gql:field gql:price . schema:priceCurrency a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:domain schema:Offer ; gql:type gql:Scalar ; gql:field gql:priceCurrency . schema:lowPrice a owl:DatatypeProperty ; rdfs:range xsd:decimal ; rdfs:domain schema:Offer ; gql:type gql:Scalar ; gql:field gql:lowPrice . schema:highPrice a owl:DatatypeProperty ; rdfs:range xsd:decimal ; rdfs:domain schema:Offer ; gql:type gql:Scalar ; gql:field gql:highPrice . } ; -- Clear Introspection Graph SPARQL CLEAR GRAPH ; -- Update GQL Bridge Type Schema GQL_INIT_TYPE_SCHEMA(); -- Initialize GQL Type Schema for modification GQL_INTRO_DEL ('urn:graphql:intro:schemaorg:products'); -- Delete Instrospection Data from the GQL Bridge Type System Schema --TTLP (GQL_CREATE_TYPE_SCHEMA ('urn:graphql:schemaorg:bridge:products'), '', 'urn:graphql:intro:schemaorg:products'); -- Generate Introspection Data TTLP (GQL_GENERATE_INTRO (' type Query { "Offers Collection" Offers(name:String, iri:IRI, price:Float): [Offer] "Products Collection" Products(name:String, iri:IRI): [Product] "FAQ Pages Collection" FAQPages(name:String, iri:IRI, mainEntity:IRI): [FAQPage] "Questions Collection" Questions(name:String, iri:IRI, mainEntity:IRI): [Question] "Answers Collection" Answers(text:String, iri:IRI): [Answer] } " [Product class](http://schema.org/Product) " type Product { iri: IRI! name: String description: String sku: String brand: String offers: [Offer] mainEntityOfPage: IRI image: IRI url: IRI potentialAction: IRI } " [Offer class](http://schema.org/Offer) " type Offer { iri: IRI! name: String sku: String potentialAction: IRI price: Float priceCurrency: String lowPrice: Float highPrice: Float } " [FAQPage class](http://schema.org/FAQPage) " type FAQPage { iri: IRI! name: String mainEntity: [Question] url: IRI image: IRI offers: [Offer] } " [Question class](http://schema.org/Question) " type Question { iri: IRI! name: String acceptedAnswer: [Answer] } " [Answer class](http://schema.org/Answer) " type Answer { iri: IRI! text: String } '), '', 'urn:graphql:intro:schemaorg:products'); GQL_INTRO_ADD ('urn:graphql:intro:schemaorg:products'); -- Add modified Instrospection Data to GQL Bridge Type System Schema