SPARQL Queries

SPARQL is a W3C query language standard to retrieve and manipulate data stored in Resource Description Framework (RDF) format, thus including OWL ontologies.

The use of SPARQL queries asks for a SPARQL Endpoint, i.e. a server that can handle HTTP requests. SPARQL Endpoints are typically provided by RDF stores.

This section presents examples of SPARQL Queries tailored for the Factory Data Model. These examples must be intended as templates that can be customized by specifying RDF Datasets.

The full set of SPARQL queries is available in this folder.

Get Parts and Part Types

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX fa: <https://w3id.org/ontoeng/factory#> 
SELECT DISTINCT ?parttype ?part ?itsClass
WHERE { 
	{
		?itsClass rdfs:subClassOf* fa:ArtifactType . 
		?parttype rdf:type ?itsClass .
	}
	UNION{
		?itsClass rdfs:subClassOf* fa:Artifact . 
		?part rdf:type ?itsClass .
	}
}

Get Process Plans of Parts/Part types

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX ifc: <https://standards.buildingsmart.org/IFC/DEV/IFC4/ADD1/OWL#> 
PREFIX ifcext: <https://w3id.org/ontoeng/IFC4_ADD1_extension#> 
PREFIX factory: <https://w3id.org/ontoeng/factory#> 
select distinct ?parttype ?pplan 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX ifcext: <https://w3id.org/ontoeng/IFC4_ADD1_extension#> 
PREFIX fa: <https://w3id.org/ontoeng/factory#> 
select distinct ?parttype ?part ?pplan 
WHERE { 

	?pplan rdf:type/rdfs:subClassOf* fa:TaskSelect .
	
	{
		?parttype ifcext:hasAssignedObject|^ifcext:hasAssignmentTo ?pplan .
		?parttype rdf:type/rdfs:subClassOf* fa:ArtifactType .
	}
	UNION{
		{
			?part ifcext:isDefinedByType ?parttype .
			?parttype ifcext:hasAssignedObject|^ifcext:hasAssignmentTo ?pplan .
		}
		UNION{
			?part ifcext:hasAssignedObject|^ifcext:hasAssignmentTo ?pplan .
		}
		?part rdf:type/rdfs:subClassOf* fa:Artifact . 
	}
}

Last updated