Web3.0 Commerce Ontology, Knowledge Graph and NLP Search Engine Experiment

-------------------------------------------  Draft:   starting 6/16/2023 and ending 7/20/2023  ------------------------------------------

This experiment focuses on eCommerce NFT Asset and Offering discoverability.  

Our goal is to develop a working prototype of NFT based eCommerce catalog ontology, catalog knowledge graph, blockchain contracts, and natural language search service (figure below).

 Key Hypotheses:

Capabilities

This experiment incorporates a Natural Language search engine that leverages this NFT ontology, knowledge base, and catalog taxonomy.

We hope that, through this experiment, we can get involved with the POC4Commerce Hackathon. Most parts of this experiment require a robust NFT ontology.

Experiment Design

The Web3.0 and semantic metadata industry has built robust solutions that have many layers of abstraction to support all types of supply chain use-cases.  Many of these solutions see eCommerce as a Supply Chain Variant and expect developers to understand how to leverage these abstract frameworks.

NFT industry has gained popularity because of the simplicity of their solutions and metadata models championed by OpenSea.

We are going make the design and implementation as concrete and simple as possible. This solutions will focus entirely on the eCommerce use-case.

We started our journey by building abstract smart contracts and ontology that could be used for a wider set of supply chain use cases and found that things got complicated quickly.   As we show the software design we will refer back to industry patterns and practices that are used in the larger supply chain industry.

Solutions is not built around a single coin or based on a central service API. 


Approach


Blockchain Contracts

Catalog , category hierarchy, assets and offerings will all be on-chain NFT's. Each NFT Entity (Catalog, Category, Asset, and Offering) will hold off-chain JSON-LD semantic metadata. 

Catalog Contracts all derive from base ERC721 standard extension Contracts to support a Decentralized Category Knowledge Graph (CKG) taxonomy. Our experiment Catalog leverages a more abstract CKG contract framework.

Having these Entities on-chain will allow for 3rd party applications to have full access to the catalog taxonomy and information.

This approach can integrate with opensea seaport approach for offer settlement. Seaport's centralized approach of holding all offering entities off-chain prevent third parties from direct access and discovery of offerings. Opensea also holds catalog and category hierarchy taxonomy off-chain which makes it difficult for collaborative creation of the catalog.

Ontology

NFT off-chain JSON-LD metadata and Decentralized Knowledge Base will follow a standard Ontology. This ontology will follow industry best practices and be derived from schema.org, goodrelations, POC4Commerce schema.


Our ontology creation process follows the recommendations by Noy and McGuiness. 

The modelling and creation of the ontology followed an iterative process and was done using Protégé. The applied steps can be summarised as follows: 


Decentralized Knowledge Base

Our Knowledge Base is a hybrid Ethereum and IPFS solutions. All knowledge base graph nodes are represented as Ethereum NFT Entities where each Entity maintains a collection of children Entities (connections). All NFT Entity metadata is held off-chain in IPFS JSON-LD.

This approach allows 3rd party applications direct access to the full knowledge graph of data. This solution maintains an off-line read-only copy of the catalog graph to RDF online storage.

Natural Language Question and Answer Service

Natural Language QA service will embed Knowledge Base information within a ChatGPT LLM framework using the LangChain platform. We are leveraging the GPT4ALL framework.



Tasks


Write Decentraland items onto blockchain

Off-chain metadata approach

JSON-LD metadata format. link   Basically extend current OpenSea attributes to include JSON-LD information

Address interoperability issues of OpenSea metadata representation.  Need way of presenting intended meaning of data.

{

  "@context": "https://json-ld.org/contexts/person.jsonld",

  "@id": "http://dbpedia.org/resource/John_Lennon",

  "name": "John Lennon",

  "born": "1940-10-09",

  "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"

}



Resource Description Framework (RDF).  

Token metadata reference to RDF storage.


Example, Decentralized Knowledge Graph (DKG) from orgintrail.io.  working with ontochain and tracelabs.  Leverages a layered architecture link.  Everything accessible via a centralized service layer.  TRAC ERC20 token

Issues:


Example, for social network representation. Semantic Soulbound tokens (EIP-6239).  Extends ERC-721 and ERC-5192.

Jessica Chang j.chang@relationlabs.ai 

Companies using this approach

relationlabs.ai


Building Contract Factory and Contracts

Leverage Singleton, Collection, and Item Contract Factory Solution.  There will probably be something like this in the future to support collection hierarchies.

Nested Contracts (Parent and Child Tokens)

good article on nested NFT's link

Building Catalog Developing Knowledge Graph

There are several tools that help you construct Asset NFT JSON-LD from your current product catalog content.

Relation labeling in E-commerce with LLMs 

LLM's to auto-create relationships between products, variants, assets. 

article


Using LLM to drive shopping is an essential element of an eCommerce Digital Experience.

Establishing Customer Shopping Behavior using LLM

Amazon article, FolksScope initiative

NFT Marketplaces

publish or seek for a certain asset with specific supply chains and at certain conditions

Terms

Offering (Order)

An or­der is an ac­count-sub­mit­ted in­tent to buy/sell an as­set. It ex­ists off-chain, and has a type: bid or ask. It also con­tains meta­da­ta that is re­quired to match to NFTs on-chain. There are two par­tic­i­pants in an or­der: a mak­er, who makes liq­uidi­ty and acts as a first mover in a sale by declaring intent to sell or buy/bid on an item, and a tak­er, who takes liq­uid­i­ty and acts as the sec­ond mover in a sale by buying or accepting a bid on the item. Orders can be bundled within a specific collection. 


Offerer (both buyer and seller)


Listings (seller creates orders)

list of orders


Offers (buyer creates orders)

list of orders


Fulfiller


Fulfilling an offer.   Seller providing NFT and stuff to buyer.  Fulfiller account must own the NFT

Fulfilling a listing. Buyer pays for NFT.  The response contains all of the information needed for clients to fulfill a listing directly on chain (pay for NFT) 


Maker/Taker  (either seller or buyer can initiate an order)

Maker initiates the order

Taker fulfills the order 



complete any number of listings at once via a set of fulfillments 

A zone is a contract that performs additional validation before the fulfillment 

A conduit is a type of contract where offerers specify token approvals.


Order types

 

OpenSea seaport protocol (v1.5) 

Seaport is a marketplace contract for safely and efficiently creating and fulfilling orders for ERC721 and ERC1155 items. Each order contains an arbitrary number of items that the offerer is willing to give (the "offer") along with an arbitrary number of items that must be received along with their respective receivers (the "consideration"). 

Single Seaport contracts

To create an order


Fulfilling order (fulfill orders)

Give the whole payload and creates a mirror order (fulfill orders)

Buy an NFT,  Sell an NFT and pay a fee (other type of fulfilling usually used for fee's).  (Fulfill available orders) method

(Match orders).  not utilized that often but used in powerful use-cases. (power feature)


Zones.  check the order prior to fulfillment.  For example Dynamic NFT Metadata.  Owner changes the metadata while your waiting for fulfillment.   


Listing has a ERC712 signature payload

Marketplace capabilities



OpenSea Creatures

OpenSea use of Contract Factory to mint NFT's

https://github.com/ProjectOpenSea/opensea-creatures/blob/master/contracts/ERC721Tradable.sol


Diagram of order flow

https://github.com/ProjectOpenSea/seaport/tree/main/diagrams


Soul bound stuff

Soulbound Badges (EIP-5114) takes a similar strategy of building out a very concrete solution for a particular use-case.


Application Configuration


python.exe -m pip install --upgrade pip

pip install python-dotenv


Blockchain Ontology - Semantic Net (Knowledge Graph)


Some key features of Web 3.0 include:

https://techlabuzz.com/web-3-0-the-next-generation-of-the-world-wide-web/



The goal of the Semantic Web and Linked Data is to create a more intelligent and connected web, where data can be easily shared, integrated, and analyzed. 

https://www.unitcelleducation.com/2023/02/What-is-web-3-future-of-the-Internet.html



Value


Blockchain and the Semantic Web

https://www.delta-h2020.eu/wp-content/uploads/2020/01/Towards-blockchain-and-semantic-web.pdf

Juan Cano-Benito(B) , Andrea Cimmino(B) , and Ra´ul Garc´ıa-Castro(B) Universidad Polit´ecnica de Madrid, Madrid, Spain 




Department of Mathematics and Computer Science, University of Catania, Viale Andrea Doria 6 - 95125 - Catania, Italy

unict.it


Giampaolo Bella, a Domenico Cantone, a Carmelo Fabio Longo, a Marianna Nicolosi Asmundo a and Daniele Francesco Santamaria a,∗ a 

OASIS v2, June 2023



Blondie 1.0 (7 years started, updated 4 years ago)


OASIS V1 Ontology


OASIS V2 Ontology

overview https://arxiv.org/pdf/2306.10061.pdf   June 14, 2023




SPARQL Query of NFT Instance


PREFIX rcether: <http://localhost:5000/owl/rc-ethereum.owl#>

PREFIX rccom: <http://localhost:5000/owl/rc-commerce.owl#>

PREFIX oasis: <http://localhost:5000/owl/oasis.owl#>

PREFIX gr: <http://purl.org/goodrelations/v1#>

PREFIX rcgen-test: <http://localhost:5000/owl/rcgen-test.owl#>


SELECT DISTINCT ?nft ?tokenId ?offering ?priceDetermination ?value ?currency WHERE { 

    ?nft a rcgen-test:EthereumTokenERC721.  

    ?nft rcether:hasTokenID ?tokenId.

    ?offering rccom:isOfferingAbout ?nft.

    ?priceDetermination a rccom:PriceDeterminationActivity.

    ?priceDetermination rccom:priceDeterminationPerformedOn ?offering.

  ?priceDetermination rccom:hasPriceValue ?priceValue.

    ?priceValue gr:hasCurrencyValue ?value.

    ?priceValue gr:hasCurrency ?currency.

}



NFT Ontology

https://rhizomik.net/reports/semantic-nfts



Metaverse Ontology

https://www.frontiersin.org/articles/10.3389/fdata.2022.998648/full



Companies working in this area

Trace Labs

https://tracelabs.io/join/decentralized-knowledge-graph-engineer-Mjg=

 working with ontochain link

46-48 Wyndham St, Central Ljubljana, Slovenia 

$9M annual revenue


Decentralized Knowledge Graph

https://origintrail.io/