Sparql EndPoint Interface.

SPARQL

La interfaz SPARQL es un servicio que permite realizar consultas sobre datos almacenados en RDF mediante el lenguaje SPARQL. De esta forma la información de NAP DGT puede ser accesible y transformada según los principios de Linked Data facilitando su reutilización.

Para poder realizar consultas es necesario conocer el lenguaje SPARQL, definido por el W3C aquí. Para facilitar las consultas es recomendable revisar los vocabularios:


Los datos (datasets) sobre carreteras, unidades administrativas e incidencias se encuentran disponibles en el catálogo.

Algunos ejemplos:


    · Información sobre el catálogo de datos:


  1. SELECT  DISTINCT ?g 
    WHERE  { GRAPH ?g {?s ?p ?o}
    # FILTER regex(?g, "^http://localhost")
    }
    ORDER BY  ?g
    

  2. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    
    SELECT DISTINCT ?Graph ?Class ?LabelC ?Property ?LabelP  
    {
    	GRAPH ?Graph {
    	?Property a rdf:Property. 
    	?s ?Property  ?o;
    	a          ?Class.
    	?Class rdfs:label ?LabelC.
    	?Property rdfs:label ?LabelP.
    }
    # Depends on the URL
    VALUES ?Graph { <http://localhost:8890/CARRETERAS> }
    }
    ORDER BY  ?Graph ?Class ?Property
    LIMIT 20
    

  3. · Consultas directas sobre los datos:


  4. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    
    SELECT distinct ?Situation ?Confidentiality ?InformationStatus ?SituationRecord
    WHERE
    {
    	OPTIONAL {?Situation dtx_srti:hasHeaderInformation / dtx_srti:hasConfidentiality ?Confidentiality.}
    	OPTIONAL {?Situation dtx_srti:hasHeaderInformation / dtx_srti:hasInformationStatus ?InformationStatus.}
    	OPTIONAL {?Situation dtx_srti:hasSituationRecord ?SituationRecord.}                      
    }
    LIMIT 20
    

  5. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX time: <http://www.w3.org/2006/time#>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
    
    SELECT distinct ?situationRecord  ?Version ?VersionTime ?CreationTime ?FirstSupplierVersionTime ?Type ?SourceCountry ?SourceId ?Severity ?ImpactDelaysType 
     ?ProbabilityOfOccurrence  
    CONCAT(?RoadNumberSingle, ?RoadNumberLinear) AS ?RoadNumber 
    MAX(?GeometriesWKT) as ?GeometryInWKT 
    CONCAT(?AdmAreaOfPoint,?AdmAreaOfLinearSection) AS ?AdmArea 
    
    CONCAT(?OverallStartPeriod," ",?OverallEndPeriod) AS ?Validity  ?ValidityStatus 
    ?MobilityType ?MobilityObstructionType 
    # CONCAT(?SpeedValue," ", ?SpeedObstructionValue) AS ?ValueOfSpeed 
    # CONCAT(?Unit," ", ?Unit2) AS ?Units 
    ?SubjectTypeOfWorks # ?SRTI 
    
    WHERE 
    {
    	?situationRecord a  ?Type;
    	dtx_srti:situationRecordVersion ?Version.
    
    	### ¿SRTI?
    	OPTIONAL {?situationRecord dtx_srti:safetyRelatedMessage  ?SRTI.}     
    
    	### TIME CREATION, VERSIONS
    	OPTIONAL {?situationRecord dtx_srti:situationRecordCreationTime ?CreationTime.}
    	OPTIONAL {?situationRecord dtx_srti:situationRecordFirstSupplierVersionTime ?FirstSupplierVersionTime.}
    	OPTIONAL {?situationRecord dtx_srti:situationRecordVersionTime ?VersionTime.}
    
    	### SOURCE with Source Country and Source Identification
    	OPTIONAL {?situationRecord dtx_srti:hasSource / dtx_srti:sourceCountry  ?SourceCountry.}
    	OPTIONAL {?situationRecord dtx_srti:hasSource / dtx_srti:sourceIdentification  ?SourceId.}  
    
    	### PROBABILITYofOCCURRENCE
    	OPTIONAL {?situationRecord dtx_srti:hasProbabilityOfOccurrence ?ProbabilityOfOccurrence.}
    
    
    	### SEVERITY
    	OPTIONAL {?situationRecord dtx_srti:hasSeverityEnum ?Severity.} 
    
    
    	### MOBILITY with  Mobility Type and Speed. Is it mobile or stationary?
    	OPTIONAL {?situationRecord dtx_srti:hasMobility / dtx_srti:hasMobilityType  ?MobilityType.}
    	OPTIONAL {?situationRecord dtx_srti:hasMobility / dtx_srti:speed  ?Speed.
    		?Speed qudt:numericValue  ?SpeedValue ;
    		qudt:unit ?Unit.
    	}
    
    	### MOBILITY OBSTRUCTION with  Mobility Obstruction Type and Speed .Is it mobile or stationary?
    	OPTIONAL {?situationRecord  dtx_srti:hasMobilityOfObstruction / dtx_srti:hasMobilityType  ?MobilityObstructionType.}
    	OPTIONAL {?situationRecord  dtx_srti:hasMobilityOfObstruction / dtx_srti:speed  ?SpeedObstruction.
    		?SpeedObstruction qudt:numericValue  ?SpeedObstructionValue ;
    		qudt:unit ?Unit2.
    	}
    
    	### SUBJECTS The subjects with which the ROADWORKS are associated.
    	OPTIONAL {?situationRecord dtx_srti:hasSubject / dtx_srti:hasSubjectTypeOfWorks  ?SubjectTypeOfWorks.}
    
    	### IMPACT with DelayTimeValue and DelaysType
    	OPTIONAL {?situationRecord dtx_srti:hasImpact / dtx_srti:hasDelays / dtx_srti:delayTimeValue ?ImpactDelayTimeValue.}
    	OPTIONAL {?situationRecord dtx_srti:hasImpact / dtx_srti:hasDelays / dtx_srti:delaysType ?ImpactDelaysType.}  
    
    	### IMPACTonOPOSSITEDIRECTION with Delay Time Value and DelaysType
    	OPTIONAL {?situationRecord dtx_srti:hasImpactOnOppositeDirection / dtx_srti:hasDelays / dtx_srti:delayTimeValue ?ImpactDelayTimeValueOD.}
    	OPTIONAL {?situationRecord dtx_srti:hasImpactOnOppositeDirection / dtx_srti:hasDelays / dtx_srti:delaysType ?ImpatDelaysTypeOD.} 
    
    	### VALIDITY: OverallStartPeriod, OverallEndPeriod
    	OPTIONAL {
    		?situationRecord dtx_srti:hasValidity ?Validity.  
    		?Validity dtx_srti:hasValidityStatus ?ValidityStatus; 
    		dtx_srti:validityTimeSpecification ?OverallPeriod .
    		?OverallPeriod time:hasBeginning ?instant .
    		?instant  time:inXSDDateTime ?OverallStartPeriod 
    
    		OPTIONAL ### OverallEndPeriod is not mandatory
    		{
    			?OverallPeriod time:hasEnd ?instant2 .
    			?instant2  time:inXSDDateTime ?OverallEndPeriod. 
    		}
    	}
    							### LOCATION REFERENCE ###
    	### GEOMETRY GEOSPARQL WKT
    	OPTIONAL {?situationRecord geosparql:hasGeometry / geosparql:asWKT ?GeometriesWKT.}
    	
    	### ADMINISTRATIVE AREA
    	
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasAdministrativeAreaOfPoint  ?AdmAreaOfPoint.  }      
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:hasAdministrativeAreaOfLinearSection  ?AdmAreaOfLinearSection.}
    	
    	### ROAD NUMBER
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberSingle .}  
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberLinear.}
    	
    	
    }
    ORDER BY ASC (?Type)
    LIMIT 20
    

  6. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX qudt: <http://qudt.org/schema/qudt#>
    PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
    
    SELECT DISTINCT ?SituationRecord  ?RoadNumberSingle  ?linkNameDescriptor_SinglePoint (CONCAT(?Longitude,'  ',?Latitude) AS ?LOCATION_WGS84) ?DistanceAlong ?Unit 
    
    WHERE
    {
    	{
    		?SituationRecord dtx_srti:hasLocationReference ?Point.
    		?Point dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasPointCoordinates / geo:lon ?Longitude;
    		dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasPointCoordinates / geo:lat ?Latitude.
    	}
    
    	{
    		{?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberSingle .}
    
    		OPTIONAL 
    		{
    			{?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasTpegOtherPointDescriptor ?A.
    			?A dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#linkName>. 
    			?A dtx_srti:descriptor ?linkNameDescriptor_SinglePoint.}
    		}
    
    		{?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasDistanceAlongLinearElement  / dtx_srti:distanceAlong ?hasDistanceAlong .
    
    		?hasDistanceAlong qudt:numericValue  ?DistanceAlong .
    		?hasDistanceAlong qudt:unit ?Unit.}
    	}
    
    }
    LIMIT 20
    

  7. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    
    SELECT DISTINCT ?SituationRecord  ?RoadNumberSingle ?RoadNumberLinear ?linkNameDescriptor_SinglePoint  ?linkNameDescriptor_FROM ?linkNameDescriptor_TO 
    WHERE
    {
    	{
    		{?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberLinear.}
    
    		OPTIONAL
    		{
    		?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasTpegOtherPointDescriptor ?B.
    		?B dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#linkName>.
    		?B dtx_srti:descriptor ?linkNameDescriptor_TO. 
    
    		?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointFrom / dtx_srti:hasTpegOtherPointDescriptor ?C.
    		?C dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#linkName>.
    		?C dtx_srti:descriptor ?linkNameDescriptor_FROM.
    		}
    	}
    	UNION
    	{
    		{
    			?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberSingle .
    		}
    
    		OPTIONAL
    		{
    		?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasTpegOtherPointDescriptor ?A.
    		?A dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#linkName>.
    		?A dtx_srti:descriptor ?linkNameDescriptor_SinglePoint.
    		}
    	}
    }
    LIMIT 20
    

  8. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
    PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
    
    SELECT DISTINCT ?SituationRecord ?Type ?VersionTime MAX(?GeometriesWKT) AS ?GeometryWKT (CONCAT(?Longitude,'  ',?Latitude) AS ?Location_Point_WGS84) (CONCAT(?Longitude_To,'  ',?Latitude_To) AS ?Location_Point_TO__WGS84) (CONCAT(?Longitude_From,'  ',?Latitude_From) AS ?Location_Point_FROM__WGS84)
    
    WHERE
    {
    	?SituationRecord a  ?Type;
    	dtx_srti:situationRecordVersionTime ?VersionTime;
    	geosparql:hasGeometry / geosparql:asWKT ?GeometriesWKT.
    	{
    		?SituationRecord dtx_srti:hasLocationReference ?Linear.
    		{?Linear dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasPointCoordinates / geo:lon ?Longitude_To;
    		dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasPointCoordinates / geo:lat ?Latitude_To.}
    		{?Linear dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointFrom / dtx_srti:hasPointCoordinates / geo:lon ?Longitude_From;
    		dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointFrom / dtx_srti:hasPointCoordinates / geo:lat ?Latitude_From.}
    	}
    	UNION
    	{
    		?SituationRecord dtx_srti:hasLocationReference ?Point.
    		?Point dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasPointCoordinates / geo:lon ?Longitude;
    		dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasPointCoordinates / geo:lat ?Latitude.
    	}
    }
    LIMIT 20
    

  9. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX time: <http://www.w3.org/2006/time#>
    PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
    
    SELECT DISTINCT ?SituationRecord  ?VersionTime  
    (CONCAT(?Longitude,'  ',?Latitude) AS ?Location_Point_WGS84) 
    (CONCAT(?Longitude_To,'  ',?Latitude_To) AS ?Location_Point_TO__WGS84) 
    (CONCAT(?Longitude_From,'  ',?Latitude_From) AS ?Location_Point_FROM__WGS84) 
    ?PoorEnvironmentType ?WeatherRelatedRoadConditionType ?NonWeatherRelatedRoadConditionType ?ProbabilityOfOccurence   ?OverallStartPeriod ?OverallEndPeriod 
    
    WHERE
    {	{
    	?SituationRecord a  <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#NonWeatherRelatedRoadConditions>;
    	dtx_srti:hasNonWeatherRelatedRoadConditionTypeEnum ?NonWeatherRelatedRoadConditionType.
    	}
    	UNION  ### Depend on the type of Situation Record Conditions, the enumeration is different 
    	{
    	?SituationRecord a  <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#WeatherRelatedRoadConditions>;
    	dtx_srti:hasWeatherRelatedRoadConditionTypeEnum ?WeatherRelatedRoadConditionType.
    	}
     
    	UNION  ### Depend on the type of Situation Record Conditions, the enumeration is different 
    	{
    	?SituationRecord a  <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#PoorEnvironmentConditions>;
    	dtx_srti:hasPoorEnvironmentTypeEnum ?PoorEnvironmentType.
    	}
    	### Common attributes for all types                        
    	{
    		{
    		?SituationRecord dtx_srti:hasLocationReference ?Linear.
    		{?Linear dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasPointCoordinates / geo:lon ?Longitude_To;
    		dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasPointCoordinates / geo:lat ?Latitude_To.}
    		{?Linear dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointFrom / dtx_srti:hasPointCoordinates / geo:lon ?Longitude_From;
    		dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointFrom / dtx_srti:hasPointCoordinates / geo:lat ?Latitude_From.}
    	}
    	UNION
    	{
    		?SituationRecord dtx_srti:hasLocationReference ?Point.
    		?Point dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasPointCoordinates / geo:lon ?Longitude;
    		dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasPointCoordinates / geo:lat ?Latitude.
    	}
    	
    		OPTIONAL {?SituationRecord dtx_srti:hasProbabilityOfOccurrence ?ProbabilityOfOccurence.}
    		OPTIONAL {?SituationRecord dtx_srti:hasValidity ?Validity.}
    		OPTIONAL {?SituationRecord dtx_srti:situationRecordVersionTime ?VersionTime.}
    		
    	
    		### VALIDITY: OverallStartPeriod, OverallEndPeriod
    		OPTIONAL {
    		?SituationRecord dtx_srti:hasValidity ?Validity.  
    		?Validity dtx_srti:hasValidityStatus ?ValidityStatus; 
    		dtx_srti:validityTimeSpecification ?OverallPeriod .
    		?OverallPeriod time:hasBeginning ?instant .
    		?instant  time:inXSDDateTime ?OverallStartPeriod 
    
    			OPTIONAL ### OverallEndPeriod is not mandatory
    			{
    			?OverallPeriod time:hasEnd ?instant2 .
    			?instant2  time:inXSDDateTime ?OverallEndPeriod. 
    			} }
    	
    	}
    } 
    

  10. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    
    SELECT DISTINCT ?SituationRecord  ?hasAdmAreaOfPoint ?hasAdmAreaOfLinearSection 
    ?ADM_Descriptor_SinglePoint 
    (strbefore(?ADM_Descriptor_SinglePoint,",") as ?LINK_SinglePoint_TownName) (strafter(?ADM_Descriptor_SinglePoint,",") as ?LINK_SinglePoint_Other)
    ?ADM_Descriptor_TO
    (strbefore(?ADM_Descriptor_TO,",") as ?LINK_To_TownName) (strafter(?ADM_Descriptor_TO,",") as ?LINK_To_Other)
    ?ADM_Descriptor_FROM
    (strbefore(?ADM_Descriptor_FROM,",") as ?LINK_From_TownName) (strafter(?ADM_Descriptor_FROM,",") as ?LINK_FROM_Other)
    
    
    {SELECT DISTINCT ?SituationRecord ?hasAdmAreaOfPoint ?hasAdmAreaOfLinearSection 
    GROUP_CONCAT(DISTINCT ?ADM_POINT; SEPARATOR = ',')  AS ?ADM_Descriptor_SinglePoint  
    GROUP_CONCAT(DISTINCT ?ADM_LINEAR_TO; SEPARATOR = ',')  AS ?ADM_Descriptor_TO
    GROUP_CONCAT(DISTINCT ?ADM_LINEAR_FROM; SEPARATOR =',')  AS ?ADM_Descriptor_FROM 
    
    WHERE
    {
    	{ {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegPointLocation / dtx_srti:hasTpegPoint / dtx_srti:hasTpegOtherPointDescriptor ?A.
    
    	{ { ?A dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#townName>. } 
    	UNION {?A dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#other>. }
    	UNION {?A dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#regionName>. }
    	UNION {?A dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#administrativeAreaName>. } }
    
    	?A dtx_srti:descriptor ?ADM_POINT. } OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasAdministrativeAreaOfPoint  ?hasAdmAreaOfPoint.  } }
    
    	UNION 
    
    	{ {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasTpegOtherPointDescriptor ?B.
    
    	{ { ?B dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#townName>. } 
    	UNION {?B dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#other>. }
    	UNION {?B dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#regionName>. }
    	UNION {?B dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#administrativeAreaName>. } }
    
    	?B dtx_srti:descriptor ?ADM_LINEAR_TO.} 
    
    	UNION
    
    	{?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegLinearLocation / dtx_srti:hasTpegPointTo / dtx_srti:hasTpegOtherPointDescriptor ?C.
    
    	{ { ?C dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#townName>. } 
    	UNION {?C dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#other>. }
    	UNION {?C dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#regionName>. }
    	UNION {?C dtx_srti:hasTpegOtherPointDescriptorType <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#administrativeAreaName>. } }
    
    	?C dtx_srti:descriptor ?ADM_LINEAR_FROM.} 
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:hasAdministrativeAreaOfLinearSection  ?hasAdmAreaOfLinearSection.  } }
    } }
    LIMIT 20
    

  11. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX time: <http://www.w3.org/2006/time#>
    
    SELECT distinct ?situationRecord ?VersionTime ?CreationTime ?ProbabilityOfOccurrence ?OverallStartPeriod 
    WHERE 
    	{
    		?situationRecord a  ?type;
    		dtx_srti:hasProbabilityOfOccurrence ?ProbabilityOfOccurrence;
    		dtx_srti:hasValidity ?Validity;
    		dtx_srti:situationRecordCreationTime ?CreationTime;
    		dtx_srti:situationRecordVersionTime ?VersionTime.
    		
    		?Validity   dtx_srti:validityTimeSpecification ?OverallPeriod .
    		?OverallPeriod time:hasBeginning ?instant .
    		?instant  time:inXSDDateTime ?OverallStartPeriod 
    
    		FILTER (?OverallStartPeriod > "2021-11-29T08:26:04.963+01:00"^^xsd:dateTime).
    	}
    ORDER BY ?OverallStartPeriod
    

  12. PREFIX roads: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti/roads#>
    PREFIX qudt: <http://qudt.org/schema/qudt#>
    SELECT distinct  ?RoadSection ?Road  ?Road_Denomination ?Road_Itinerary ?Province ?Init ?End ?PK_Initial ?PK_End ?TypeOfRoad ?TypeOfAccess   ?Length_In_Km  
    WHERE 
    {
    	?RoadSection  a roads:TramosRCE;
    	roads:tramos_carretera_COD ?Road.
    	?Road roads:carretera_COD ?CodeOfRoad;
    	roads:carretera_Denominacion ?Road_Denomination;
    	roads:carretera_Itinerario ?Road_Itinerary.
    	?RoadSection  roads:tramos_CCAA  <https://cef.uv.es/lodroadtran18/recurso/transporte/dtx_srti/administrativeUnit/ComunidadAutonoma/aragon> ;
    	roads:tramos_Provincia  ?Province;
    	roads:tramos_Inicio ?Init;
    	roads:tramos_Fin ?End;
    	roads:tramos_PK_Inicio ?PK_Initial;
    	roads:tramos_PK_Fin ?PK_End;
    	roads:tramos_Tipo_Via ?TypeOfRoad;
    	roads:tramos_Tipo_Acceso ?TypeOfAccess;
    	roads:tramos_Long ?RoadSectionLong.
    	?RoadSectionLong qudt:numericValue  ?Length_In_Km.
    FILTER (?Length_In_Km >5)
    }
    ORDER BY DESC (?Length_In_Km)
    LIMIT 20
    


  13. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX time: <http://www.w3.org/2006/time#>
    
    SELECT  DISTINCT ?SituationRecord  ?Type  ?OverallStartPeriod ?OverallEndPeriod CONCAT((hours(?OverallStartPeriod)),":",(minutes(?OverallStartPeriod))) AS ?StartPeriodValidity 
    
    WHERE
    {
    	?SituationRecord a  ?Type;
    	dtx_srti:hasValidity ?Validity.
    
    	?Validity   dtx_srti:validityTimeSpecification ?OverallPeriod .
    	?OverallPeriod time:hasBeginning ?instant .
    	?instant  time:inXSDDateTime ?OverallStartPeriod
    
    	FILTER (hours(?OverallStartPeriod) >= 00 && hours(?OverallStartPeriod) <=08).
    
    	OPTIONAL
    	{
    		?OverallPeriod time:hasEnd ?instant2 .
    		?instant2  time:inXSDDateTime ?OverallEndPeriod
    	}
    }
    
    ORDER BY ?StartPeriodValidity
    LIMIT 20
    


  14. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
    
    SELECT distinct ?SituationRecord  ?Type  CONCAT(?RoadNumberSingle, ?RoadNumberLinear) AS ?RoadNumber ?Direction    MAX(?GeometriesWKT) as ?GeometryInWKT ?SimplePointLocationType CONCAT(?AdmAreaOfPoint,?AdmAreaOfLinearSection) AS ?AdmArea ?ValueDistanceAlong  ?UnitDistanceAlong ?LinearDirection ?directionRelativeOnLinearSection ?Carriageway
    WHERE
    {
    	?SituationRecord a  ?Type;
    	geosparql:hasGeometry / geosparql:asWKT ?GeometriesWKT.
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegPointLocation / dtx_srti:tpegSimplePointLocationType  ?SimplePointLocationType.}
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasTpegPointLocation / dtx_srti:tpegDirection ?Direction.}
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:directionRelativeAtPoint  ?LinearDirection .}
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasDistanceAlongLinearElement  / dtx_srti:distanceAlong ?hasDistanceAlong .
    	?hasDistanceAlong qudt:numericValue  ?ValueDistanceAlong .
    	?hasDistanceAlong qudt:unit ?UnitDistanceAlong.}     
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasAdministrativeAreaOfPoint  ?AdmAreaOfPoint.  }     
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:hasAdministrativeAreaOfLinearSection  ?AdmAreaOfLinearSection.}
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:directionRelativeOnLinearSection  ?directionRelativeOnLinearSection.}
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasPointAlongLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberSingle .} 
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasSupplementaryPositionalDescription / dtx_srti:hasCarriageway  / dtx_srti:hasCarriagewayEnum ?Carriageway .} 
    	OPTIONAL {?SituationRecord dtx_srti:hasLocationReference / dtx_srti:hasLinearWithinLinearElement / dtx_srti:hasLinearElement  / dtx_srti:hasRoadNumber ?RoadNumberLinear.  }
    }
    ORDER BY ?Type
    


  15. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
    
    SELECT DISTINCT ?SituationRecord ?Type ?VersionTime   #?Version MAX(?GeometriesWKT) AS ?GeometryWKT
    CONCAT(?AlertCAffectedDirectionLinear, ?AlertCAffectedDirectionPoint) AS ?AffectedDirection 
    CONCAT(?AlertCDirectionCodedLinear,?AlertCDirectionCodedPoint) AS ?DirectionCoded 
    CONCAT(?alertCLocationTableVersionLinear,?alertCLocationTableVersionPoint) AS ?LocationTableVersion 
    CONCAT(?alertCLocationTableNumberLinear,?alertCLocationTableNumberPoint) AS ?LocationTableNumber
    CONCAT(?alertCLocationCountryCodeLinear,?alertCLocationCountryCodePoint) AS ?LocationCountryCode
    CONCAT(?PrimarySpecificLocationLinear,?PrimarySpecificLocationPoint) AS ?PrimarySpecificLocation
    CONCAT(?PrimaryOffsetDistanceValueLinear,?PrimaryOffsetDistanceValuePoint) AS ?PrimaryOffsetDistanceValue
    CONCAT(?PrimaryOffsetDistanceUnitLinear,?PrimaryOffsetDistanceUnitPoint) AS ?PrimaryOffsetDistanceUnit
    ?SecondarySpecificLocation ?SecondaryOffsetDistanceValue  ?SecondaryOffsetDistanceUnit 
    
    WHERE
    {
    	?SituationRecord a  ?Type;
    	dtx_srti:situationRecordVersionTime ?VersionTime;
    	# dtx_srti:situationRecordVersion ?Version;
    	geosparql:hasGeometry / geosparql:asWKT ?GeometriesWKT.
    	{
    		?SituationRecord dtx_srti:hasLocationReference ?Linear.
    		?Linear dtx_srti:hasAlertCLinear / dtx_srti:hasAlertCDirection / dtx_srti:hasAlertCAffectedDirection ?AlertCAffectedDirectionLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:hasAlertCDirection / dtx_srti:hasAlertCDirectionCoded ?AlertCDirectionCodedLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:alertCLocationTableVersion ?alertCLocationTableVersionLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:alertCLocationTableNumber ?alertCLocationTableNumberLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:alertCLocationCountryCode ?alertCLocationCountryCodeLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:hasAlertCMethod4PrimaryPointLocation / dtx_srti:hasAlertCLocation / dtx_srti:specificLocation ?PrimarySpecificLocationLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:hasAlertCMethod4PrimaryPointLocation / dtx_srti:hasOffsetDistance / dtx_srti:offsetDistance ?PrimaryOffsetDistanceLinear;
    		dtx_srti:hasAlertCLinear / dtx_srti:hasAlertCMethod4SecondaryPointLocation / dtx_srti:hasAlertCLocation / dtx_srti:specificLocation ?SecondarySpecificLocation;
    		dtx_srti:hasAlertCLinear / dtx_srti:hasAlertCMethod4SecondaryPointLocation / dtx_srti:hasOffsetDistance / dtx_srti:offsetDistance ?SecondaryOffsetDistanceLinear.
    		?PrimaryOffsetDistanceLinear qudt:numericValue  ?PrimaryOffsetDistanceValueLinear ;
    		qudt:unit ?PrimaryOffsetDistanceUnitLinear.
    		?SecondaryOffsetDistanceLinear qudt:numericValue  ?SecondaryOffsetDistanceValue ;
    		qudt:unit ?SecondaryOffsetDistanceUnit.
    		
    	}
    	UNION
    	{
    		?SituationRecord dtx_srti:hasLocationReference ?Point.
    		?Point dtx_srti:hasAlertCPoint / dtx_srti:hasAlertCDirection / dtx_srti:hasAlertCAffectedDirection ?AlertCAffectedDirectionPoint;
    		dtx_srti:hasAlertCPoint / dtx_srti:hasAlertCDirection / dtx_srti:hasAlertCDirectionCoded ?AlertCDirectionCodedPoint;
    		dtx_srti:hasAlertCPoint / dtx_srti:alertCLocationTableVersion ?alertCLocationTableVersionPoint;
    		dtx_srti:hasAlertCPoint / dtx_srti:alertCLocationTableNumber ?alertCLocationTableNumberPoint;
    		dtx_srti:hasAlertCPoint / dtx_srti:alertCLocationCountryCode ?alertCLocationCountryCodePoint;
    		dtx_srti:hasAlertCPoint / dtx_srti:hasAlertCMethod4PrimaryPointLocation / dtx_srti:hasAlertCLocation / dtx_srti:specificLocation ?PrimarySpecificLocationPoint;
    		dtx_srti:hasAlertCPoint / dtx_srti:hasAlertCMethod4PrimaryPointLocation / dtx_srti:hasOffsetDistance / dtx_srti:offsetDistance ?PrimaryOffsetDistancePoint.
    		?PrimaryOffsetDistancePoint qudt:numericValue  ?PrimaryOffsetDistanceValuePoint ;
    		qudt:unit ?PrimaryOffsetDistanceUnitPoint.
    	}
    }
    LIMIT 20
    


  16. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX qudt: <http://qudt.org/schema/qudt#>
    
    SELECT DISTINCT ?situationRecord ?TypeOfRoadWorks ?RoadMaintenanceType ?ConstructionWorkType ?SubjectTypeOfWorks ?Carriageway  ?InfrastructureDescriptor ?MobilityType ?SpeedValue ?Unit  
    WHERE
    {	
    	?situationRecord a  ?TypeOfRoadWorks.
    	
    	###  RoadMaintenance or ConstructionWork
    	{ {?situationRecord dtx_srti:hasRoadMaintenanceType ?RoadMaintenanceType.}
    	UNION
    	{?situationRecord dtx_srti:hasConstructionWorkType ?ConstructionWorkType.} }
    	
    
    	### MOBILITY with  Mobility Type and Speed. Is it mobile or stationary?
    	OPTIONAL {?situationRecord dtx_srti:hasMobility / dtx_srti:hasMobilityType  ?MobilityType.}
    	OPTIONAL {?situationRecord dtx_srti:hasMobility / dtx_srti:speed  ?Speed.
    	?Speed qudt:numericValue  ?SpeedValue ;
    	qudt:unit ?Unit.
    	}
    	
    	### SUBJECTS The subjects with which the roadworks are associated.
    	OPTIONAL {?situationRecord dtx_srti:hasSubject / dtx_srti:hasSubjectTypeOfWorks  ?SubjectTypeOfWorks.}
    	
    	### SUPPLEMENTARY POSITIONAL DESCRIPTION, INFRASTRUCTURE DESCRIPTOR. CARRIAGEWAY.
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference /dtx_srti:hasSupplementaryPositionalDescription / dtx_srti:hasInfrastructureDescriptor  ?InfrastructureDescriptor.}
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference /dtx_srti:hasSupplementaryPositionalDescription / dtx_srti:hasCarriageway / dtx_srti:hasCarriagewayEnum ?Carriageway.}
    
    } ORDER BY ASC (?TypeOfRoadWorks)
    LIMIT 20
    


  17. PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX qudt: <http://qudt.org/schema/qudt#>
    
    SELECT DISTINCT ?situationRecord ?TypeOfObstruction ?AnimalPresenceType ?EnvironmentalObstructionType ?ObstructionType ?InfrastructureDamageType ?VehicleObstructionType ?MobilityObstructionType ?SpeedObstructionValue ?Unit ?TrafficConstriction   ?Carriageway  ?InfrastructureDescriptor
    WHERE
    {	
    	?situationRecord a  ?TypeOfObstruction.
    	
    	###  AnimalPresence, EnvironmentalObstructionType, General Obstruction, InfrastructureDamage or VehicleObstruction
    	{
    	{?situationRecord dtx_srti:hasAnimalPresenceTypeEnum ?AnimalPresenceType.}
    	UNION
    	{?situationRecord dtx_srti:hasEnvironmentalObstructionTypeEnum ?EnvironmentalObstructionType.} 
    	UNION
    	{?situationRecord dtx_srti:hasObstructionTypeEnum ?ObstructionType.} 
    	UNION
    	{?situationRecord dtx_srti:hasInfrastructureDamageType ?InfrastructureDamageType.}
    	UNION
    	{?situationRecord dtx_srti:hasVehicleObstructionTypeEnum ?VehicleObstructionType.}
    	
    	}
    	
    	
    	### MOBILITY OBSTRUCTION with  Mobility Obstruction Type and Speed .Is it mobile or stationary?
    	OPTIONAL {?situationRecord  dtx_srti:hasMobilityOfObstruction / dtx_srti:hasMobilityType  ?MobilityObstructionType.}
    	OPTIONAL {?situationRecord  dtx_srti:hasMobilityOfObstruction / dtx_srti:speed  ?SpeedObstruction.
    	?SpeedObstruction qudt:numericValue  ?SpeedObstructionValue ;
    	qudt:unit ?Unit.
    	}
    	
    	### TRAFFIC CONSTRICTION
    	OPTIONAL {?situationRecord  dtx_srti:hasTrafficConstrictionTypeEnum ?TrafficConstriction.}
    	
    	### SUPPLEMENTARY POSITIONAL DESCRIPTION, INFRASTRUCTURE DESCRIPTOR. CARRIAGEWAY.
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference /dtx_srti:hasSupplementaryPositionalDescription / dtx_srti:hasInfrastructureDescriptor  ?InfrastructureDescriptor.}
    	OPTIONAL {?situationRecord dtx_srti:hasLocationReference /dtx_srti:hasSupplementaryPositionalDescription / dtx_srti:hasCarriageway / dtx_srti:hasCarriagewayEnum ?Carriageway.}
    	
    } ORDER BY (?TypeOfObstruction)
    LIMIT 20
    


  18. · Consultas Federadas con la Base Topográfica Nacional 1:100.000 (BTN100) de IGN:

    (https://datos.ign.es/btn100.html)

  19. PREFIX btn100:<https://datos.ign.es/def/btn100#>
    PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
    PREFIX dc: <http://purl.org/dc/terms/>
    
    SELECT DISTINCT ?situationRecord ?uriHospital ?name bif:st_distance( ?geoHospitalLocali,?asWKT ) AS ?Distance
    
    WHERE 
    	{
    		?situationRecord a dtx_srti:WeatherRelatedRoadConditions;
    		geosparql:hasGeometry ?Geometry.
    		?Geometry geosparql:asWKT ?asWKT.
    
    		SERVICE <https://datos.ign.es/sparql>
    		{ 
    			?uriHospital a btn100:Hospital ;
    			dc:title ?name ;
    			geosparql:hasGeometry ?geoHospital .
    			?geoHospital geosparql:asWKT ?geoHospitalLocali .
    
    		}
    		FILTER (bif:st_intersects(?geoHospitalLocali, ?asWKT,5)) 
    	}
    

  20. PREFIX btn100:<https://datos.ign.es/def/btn100#>
    PREFIX dtx_srti: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti#>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
    PREFIX dc: <http://purl.org/dc/terms/>
    
    SELECT DISTINCT ?situationRecord ?uriTrainStation ?name bif:st_distance( ?geoTrainStationLocali,?asWKT ) AS ?Distance
    WHERE 
    	{
    		?situationRecord a dtx_srti:WeatherRelatedRoadConditions;
    		geosparql:hasGeometry ?Geometry.
    		?Geometry geosparql:asWKT ?asWKT.
    	 
    		SERVICE <https://datos.ign.es/sparql>
    		{ 
    			?uriTrainStation a btn100:EstacionDeFerrocarril ;
    			dc:title ?name ;
    			geosparql:hasGeometry ?geoTrainStation .
    			?geoTrainStation geosparql:asWKT ?geoTrainStationLocali .
    		}
    
    		FILTER (bif:st_intersects(?geoTrainStationLocali, ?asWKT,10))
    	}
    


  21. PREFIX roads: <http://cef.uv.es/lodroadtran18/def/transporte/dtx_srti/roads#>
    PREFIX qudt: <http://qudt.org/schema/qudt#>
    PREFIX dcterms: <http://purl.org/dc/terms/>
    PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
     
    SELECT DISTINCT ?RoadSection  ?Community ?CodeOfRoad ?length ?unit ?Road ?geoRoad
    WHERE
    {
    	?RoadSection  a roads:TramosRCE.
    	?RoadSection roads:tramos_CCAA ?Community.
    	?RoadSection roads:tramos_carretera_COD ?URIOfRoad.
    	?URIOfRoad roads:carretera_COD ?CodeOfRoad.
    	?RoadSection  roads:tramos_Long ?RoadSectionLong.
    	?RoadSectionLong qudt:numericValue  ?length.
    	?RoadSectionLong qudt:unit ?unit.
    
    	SERVICE <https://datos.ign.es/sparql>
    	{
    		?Road dcterms:title ?CodeOfRoad   .
    		?Road geosparql:hasGeometry ?geoRoad .
    	}
    FILTER (?length= 159)
    }
    LIMIT 100
    


  22. · Editor de consultas SPARQL:



    Loading