map defined FDP dimensions and attributes
Configure urls and auth when pipeline (re)deployed
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX obeu-operation: <http://data.openbudgets.eu/resource/codelist/operation-character/> PREFIX obeu-budgetphase: <http://data.openbudgets.eu/resource/codelist/budget-phase/> PREFIX obeu: <http://data.openbudgets.eu/ontology/> CONSTRUCT { ?dsd qb:component [ qb:dimension obeu-dimension:currency ] . } WHERE { ?dsd a qb:DataStructureDefinition . { SELECT ( COUNT( DISTINCT ?currencyUri) AS ?numOfCurrencies ) WHERE { ?measureProperty a fdprdf:MeasureProperty ; fdprdf:currency ?currencyUri . } } FILTER(?numOfCurrencies > 1) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX dcat: <http://www.w3.org/ns/dcat#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> CONSTRUCT { ?dataset dcat:distribution ?distribution . ?distribution a dcat:Distribution; dcat:accessURL ?dumpUrl ; dcat:downloadURL ?dumpUrl . } WHERE { ?dataset a qb:DataSet; fdprdf:datasetShortName ?packageName . BIND( URI(CONCAT("http://apps.openbudgets.eu/dumps/fromfdp/", ?packageName, ".nt")) AS ?dumpUrl) BIND( URI(CONCAT(str(?dataset), "/distribution")) AS ?distribution) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX obeu: <http://data.openbudgets.eu/ontology/> PREFIX org: <http://www.w3.org/ns/org#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX schema: <http://schema.org/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> CONSTRUCT { ?dsd qb:component [ qb:dimension ?dimensionProperty; fdprdf:valueType ?fdprdfValueType ]. ?dimensionProperty fdprdf:name ?dimensionName . ?fdpDimensionProperty fdprdf:mappedTo ?dimensionProperty . } WHERE { VALUES (?fdpDimensionProperty ?fdpDimensionType ?dimensionProperty ?dimensionName ?fdprdfValueType ) { (fdp:administrator "entity" obeu-dimension:organization "organization" fdprdf:organization ) (fdp:supplier "entity" obeu-dimension:partner "partner" fdprdf:organization ) } ?dsd a qb:DataStructureDefinition . ?desc fdp:name ?packageName; fdp:model ?model . ?model fdp:dimensions ?dimensions . ?dimensions ?fdpDimensionProperty ?dimension . ?dimension fdp:dimensionType ?fdpDimensionType . }
PREFIX httpList: <http://plugins.linkedpipes.com/ontology/e-httpGetFiles#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> CONSTRUCT { <http://localhost/resource/configuration> a httpList:Configuration ; httpList:reference ?reference . ?reference a httpList:Reference ; httpList:fileUri ?filePath; httpList:fileName ?resourceName. } WHERE { OPTIONAL{fdprdf:metadata fdprdf:packageUrlBase ?definedBaseUrl .} BIND(COALESCE(?definedBaseUrl, "") AS ?baseUrl) ?desc fdp:resources ?resource . ?resource fdp:name ?resourceName; fdp:path ?resourcePath. BIND(IF(REGEX(?resourcePath, "^(ht|f)tps?://.*$"), ?resourcePath, CONCAT(?baseUrl, ENCODE_FOR_URI(?resourcePath))) AS ?filePath) BIND(URI(CONCAT("http://data.openbudgets.eu/fileReference/", ?resourceName)) AS ?reference) }
PREFIX httpList: <http://plugins.linkedpipes.com/ontology/e-httpGetFiles#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX schema: <http://schema.org/> CONSTRUCT { <http://localhost/resource/configuration> a httpList:Configuration ; httpList:reference ?reference . ?reference a httpList:Reference ; httpList:fileUri ?packageUrl ; httpList:fileName ?fileName. fdprdf:metadata fdprdf:packageUrlBase ?packageUrlBase . } WHERE { [] schema:url ?packageUrl . BIND("datapackage.jsonld" AS ?fileName) BIND(URI(CONCAT("http://data.openbudgets.eu/fileReference/", ?fileName)) AS ?reference) BIND(REPLACE(str(?packageUrl), "\\/[^\\/]*$","/") AS ?packageUrlBase) }
PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> CONSTRUCT { ?subject ?predicate ?object . } WHERE { ?subject ?predicate ?object . FILTER (!(strStarts(str(?predicate), "http://data.openbudgets.eu/fdptordf#"))) FILTER (?object != fdprdf:MeasureProperty) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> CONSTRUCT { ?component fdprdf:attribute [ fdprdf:name ?attributeName; fdprdf:source ?attributeSource; fdprdf:iskey ?isKeyAttribute; fdprdf:type ?fieldType; fdprdf:format ?fieldFormat; fdprdf:labelfor ?labelfor; fdprdf:valueProperty ?attributeValueProperty; fdprdf:parentFDPAttribute ?parentAttribute; fdprdf:parentDimension ?dimensionProperty; fdprdf:createdFromFDPAttribute ?someAttribute; fdprdf:sourceColumn ?attributeField; fdprdf:sourceFile ?attributeResourceName; fdprdf:decimalChar ?decimalChar; fdprdf:groupChar ?groupChar ] . ?component fdprdf:valueType ?valueType . } WHERE { ?dsd a qb:DataStructureDefinition . ?desc fdp:name ?packageName; fdp:title ?packageTitle; fdp:resources ?resource; fdp:model ?model . ?resource fdp:name ?attributeResourceName; fdp:schema [ fdp:fields ?resourceField ] . ?resourceField fdp:name ?attributeField . OPTIONAL{?resourceField fdp:type ?fieldType .} OPTIONAL{?resourceField fdp:decimalChar ?decimalChar.} OPTIONAL{?resourceField fdp:groupChar ?groupChar.} OPTIONAL{?resourceField fdp:format ?fieldFormat .} ?model fdp:dimensions ?dimensions . ?dimensions ?fdpDimensionProperty ?dimension . ?dimension fdp:attributes [ ?attributeProperty ?someAttribute ] . ?someAttribute fdp:source ?attributeField . OPTIONAL {?someAttribute fdp:resource ?explicitAttributeResource .} OPTIONAL { ?someAttribute fdp:parent ?parentAttributeName . ?dimension fdp:attributes [ ?parentAttributeProperty ?parentAttribute ] . BIND(strafter(str(?parentAttributeProperty), "#") AS ?parentAttributeJsonProperty) FILTER(?parentAttributeJsonProperty = ?parentAttributeName) } OPTIONAL {?someAttribute fdp:constant ?attributeConstVal .} OPTIONAL {?someAttribute fdp:labelfor ?labelfor .} FILTER(IF(BOUND(?explicitAttributeResource), ?explicitAttributeResource = ?attributeResourceName, TRUE)) BIND(strafter(str(?attributeProperty), "#") AS ?attributeName) OPTIONAL { ?dimension fdp:primaryKey ?attributeName . BIND(TRUE AS ?isKeyAttribute) } BIND(COALESCE(?isKeyAttribute, false) AS ?isKeyAttribute) BIND(IF(BOUND(?explicitAttributeResource), ?explicitAttributeResource, ?attributeResourceName) AS ?attributeResourceNameInPath) BIND(REPLACE(REPLACE(?attributeResourceNameInPath, "^\\s+", ""), "\\s+$", "") AS ?trimmedAttrResource) BIND(REPLACE(REPLACE(?attributeField, "^\\s+", ""), "\\s+$", "") AS ?trimmedAttributeField) BIND(URI(CONCAT("file://",?trimmedAttrResource,"#",REPLACE(REPLACE(ENCODE_FOR_URI(?trimmedAttributeField), "%20","+"), "%2A", "*"))) AS ?attributeSource) OPTIONAL { ?fdpDimensionProperty fdprdf:mappedTo ?mappedDimensionProperty . } BIND(COALESCE(?mappedDimensionProperty,URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName,"/dimension/",ENCODE_FOR_URI(strafter(str(?fdpDimensionProperty), "#"))))) AS ?dimensionProperty) VALUES (?componentLink) { (qb:dimension) (qb:attribute) (qb:componentProperty) } ?component ?componentLink ?dimensionProperty . OPTIONAL { ?component fdprdf:valueType ?componentValType . } BIND(IF(BOUND(?parentAttribute), fdprdf:skos, COALESCE(?componentValType,fdprdf:unknown)) AS ?valueType) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName,"/partialproperty/",ENCODE_FOR_URI(str(?attributeName)))) AS ?attributeValueProperty) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX dcat: <http://www.w3.org/ns/dcat#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> CONSTRUCT { ?dsd a qb:DataStructureDefinition; qb:component [ qb:attribute obeu-attribute:currency ] ; qb:component [ qb:measure obeu-measure:amount ] . ?dataset a qb:DataSet; fdprdf:datasetShortName ?packageName ; qb:structure ?dsd ; dcterms:title ?packageTitle ; rdfs:label ?packageTitle ; dcat:contactPoint ?authorAgent; dcterms:publisher ?authorAgent; dcterms:description ?description; rdfs:comment ?description; dcterms:license ?license . ?authorAgent foaf:name ?author; vcard:fn ?author. fdprdf:metadata fdprdf:datasetShortName ?packageName . ?fiscalPeriodInterval time:hasBeginning ?fiscalPeriodStart; time:hasEnd ?fiscalPeriodEnd . ?dataset obeu-dimension:fiscalPeriod ?fiscalPeriodInterval . ?dsd qb:component ?fiscalPeriodComponent . ?fiscalPeriodComponent qb:dimension obeu-dimension:fiscalPeriod; qb:componentAttachment qb:DataSet . } WHERE { ?desc fdp:name ?packageName ; fdp:model ?model . OPTIONAL {?desc fdp:title ?packageTitleNice . FILTER (?packageTitleNice != "") } OPTIONAL {?desc fdp:license ?license .} OPTIONAL {?desc fdp:description ?description . FILTER (?description != "") } OPTIONAL { ?desc fdp:author ?author . BIND (URI(CONCAT("http://data.openbudgets.eu/resource/agent/", encode_for_uri(?author))) as ?authorAgent) } BIND(COALESCE(?packageTitleNice, ?packageName) AS ?packageTitle) OPTIONAL { ?desc fdp:fiscalPeriod [ fdp:start ?startDateLiteral; fdp:end ?endDateLiteral ] . BIND (URI(CONCAT("http://data.openbudgets.eu/resource/interval/", ?startDateLiteral, "--", ?endDateLiteral)) AS ?fiscalPeriodInterval) BIND (URI(CONCAT("http://reference.data.gov.uk/id/gregorian-instant/",?startDateLiteral,"T00:00:00")) AS ?fiscalPeriodStart) BIND (URI(CONCAT("http://reference.data.gov.uk/id/gregorian-instant/",?endDateLiteral,"T00:00:00")) AS ?fiscalPeriodEnd) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName, "/component/fiscalPeriod")) AS ?fiscalPeriodComponent) } BIND(URI(CONCAT("http://data.openbudgets.eu/resource/dataset/",?packageName)) AS ?dataset) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName)) AS ?dsd) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX obeu-operation: <http://data.openbudgets.eu/resource/codelist/operation-character/> PREFIX obeu-budgetphase: <http://data.openbudgets.eu/resource/codelist/budget-phase/> PREFIX obeu: <http://data.openbudgets.eu/ontology/> CONSTRUCT { ?dsd fdprdf:component [ fdprdf:measure ?measureProperty; fdprdf:source ?measureSource; fdprdf:sourceColumn ?measureField; fdprdf:sourceFile ?measureResourceName; fdprdf:factor ?measureFactor; fdprdf:decimalChar ?decimalChar; fdprdf:groupChar ?groupChar; fdprdf:fieldType ?fieldType ] . ?dsd qb:component ?budgetPhaseComponent . ?budgetPhaseComponent qb:dimension obeu-dimension:budgetPhase . ?dsd qb:component ?operationCharacterComponent . ?operationCharacterComponent qb:dimension obeu-dimension:operationCharacter . ?measureProperty ?budgetPhaseAttribute ?budgetPhaseObeu . ?measureProperty ?operationCharacterAttribute ?operationCharacterObeu . ?measureProperty a fdprdf:MeasureProperty ; fdprdf:currency ?currencyUri ; fdprdf:name ?measureName ; fdprdf:isMeasure true . } WHERE { ?desc fdp:name ?packageName; fdp:resources ?resource; fdp:model ?model . ?resource fdp:name ?measureResourceName; fdp:schema [ fdp:fields ?resourceField ] . ?resourceField fdp:name ?measureField . OPTIONAL{?resourceField fdp:type ?fieldType .} OPTIONAL{?resourceField fdp:format ?fieldFormat .} OPTIONAL{?resourceField fdp:decimalChar ?decimalChar.} OPTIONAL{?resourceField fdp:groupChar ?groupChar.} ?model fdp:measures ?measures . ?measures ?measureAttr ?measure . ?measure fdp:source ?measureField; fdp:currency ?measureCurrency . OPTIONAL {?measure fdp:factor ?definedMeasureFactor . } OPTIONAL { VALUES (?fdpPhase ?budgetPhaseObeu) { ("proposed" obeu-budgetphase:draft) ("approved" obeu-budgetphase:approved) ("adjusted" obeu-budgetphase:revised) ("executed" obeu-budgetphase:executed) } ?measure fdp:phase ?fdpPhase . BIND(fdprdf:budgetPhase AS ?budgetPhaseAttribute) BIND(qb:Observation AS ?budgetPhaseAttachment) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName, "/component/budgetPhase")) AS ?budgetPhaseComponent) } OPTIONAL { VALUES (?fdpDirection ?operationCharacterObeu) { ("expenditure" obeu-operation:expenditure) ("revenue" obeu-operation:revenue) } ?measure fdp:direction ?fdpDirection . BIND(fdprdf:operationCharacter AS ?operationCharacterAttribute) BIND(qb:Observation AS ?operationCharacterAttachment) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName, "/component/operationCharacter")) AS ?operationCharacterComponent) } BIND(COALESCE(?definedMeasureFactor, 1.0) AS ?measureFactor) OPTIONAL {?measure fdp:resource ?explicitMeasureResource .} FILTER(IF(BOUND(?explicitMeasureResource), ?explicitMeasureResource = ?measureResourceName, TRUE)) BIND(IF(BOUND(?explicitMeasureResource), ?explicitMeasureResource, ?measureResourceName) AS ?measureResourceNameInPath) BIND(strafter(str(?measureAttr), "#") AS ?measureName) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/", ?packageName ,"/measure/", ?measureName)) AS ?measureProperty) BIND(URI(CONCAT("file://",?measureResourceNameInPath,"#",REPLACE(ENCODE_FOR_URI(?measureField), "%20","+"))) AS ?measureSource) BIND(URI(CONCAT("http://data.openbudgets.eu/codelist/currency/",?measureCurrency)) AS ?currencyUri) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName)) AS ?dsd) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> CONSTRUCT { ?dsd qb:component [ qb:dimension ?dimensionProperty ; fdprdf:valueType fdprdf:unknown ]. ?dimensionProperty a rdf:Property, qb:DimensionProperty; fdprdf:name ?dimensionName ; rdfs:label ?dimensionName ; rdfs:range owl:Thing . } WHERE { ?dsd a qb:DataStructureDefinition . ?desc fdp:name ?packageName; fdp:model ?model . ?model fdp:dimensions ?dimensions . ?dimensions ?fdpDimensionProperty ?dimension . FILTER NOT EXISTS {?dimension fdp:dimensionType ?dimensionType .} BIND(ENCODE_FOR_URI(strafter(str(?fdpDimensionProperty), "#")) AS ?dimensionName) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName,"/dimension/",?dimensionName)) AS ?dimensionProperty) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> CONSTRUCT { ?dataset dcterms:spatial ?country. } WHERE { VALUES (?nuts ?iso) { ("uk" "gb") ("el" "gr") } ?desc fdp:name ?packageName ; fdp:countryCode ?fdpCountryCode ; fdp:model ?model . ?country skos:notation ?skosCountryCode . FILTER(REGEX(?fdpCountryCode, ?skosCountryCode, "i") || ( REGEX(?iso, ?fdpCountryCode, "i") && REGEX(?nuts, ?skosCountryCode, "i") ) ) BIND(URI(CONCAT("http://data.openbudgets.eu/resource/dataset/",?packageName)) AS ?dataset) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX obeu: <http://data.openbudgets.eu/ontology/> PREFIX org: <http://www.w3.org/ns/org#> PREFIX time: <http://www.w3.org/2006/time#> PREFIX schema: <http://schema.org/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX owl: <http://www.w3.org/2002/07/owl#> CONSTRUCT { ?dsd qb:component [ ?qbDimensionOrAttribute ?dimensionProperty; fdprdf:valueType ?fdprdfValueType ]. ?dimensionProperty a rdf:Property, ?qbParentProperty, ?extraQbParentProperty ; rdfs:subPropertyOf ?obeuParentProperty ; fdprdf:name ?dimensionName ; rdfs:label ?dimensionName ; rdfs:range ?dimPropRange . } WHERE { VALUES (?fdpDimensionType ?fdpDimensionSubType ?obeuParentProperty ?qbDimensionOrAttribute ?qbParentProperty ?extraQbParentProperty ?fdprdfValueType ?dimPropRange) { ("entity" UNDEF obeu-dimension:organization qb:dimension qb:DimensionProperty UNDEF fdprdf:organization org:Organization) ("datetime" UNDEF obeu-dimension:date qb:dimension qb:DimensionProperty UNDEF fdprdf:dateTime time:Interval) ("location" UNDEF obeu-attribute:location qb:attribute qb:AttributeProperty UNDEF fdprdf:location schema:Place) ("fact" UNDEF UNDEF qb:componentProperty obeu:OptionalProperty UNDEF fdprdf:fact owl:Thing ) ("activity" UNDEF obeu-dimension:programmeClassification qb:dimension qb:DimensionProperty qb:CodedProperty fdprdf:skos skos:Concept ) ("classification" "functional" obeu-dimension:functionalClassification qb:dimension qb:DimensionProperty qb:CodedProperty fdprdf:skos skos:Concept ) ("classification" "administrative" obeu-dimension:administrativeClassification qb:dimension qb:DimensionProperty qb:CodedProperty fdprdf:skos skos:Concept ) ("classification" "economic" obeu-dimension:economicClassification qb:dimension qb:DimensionProperty qb:CodedProperty fdprdf:skos skos:Concept ) ("classification" UNDEF obeu-dimension:classification qb:dimension qb:DimensionProperty qb:CodedProperty fdprdf:skos skos:Concept ) ("other" UNDEF UNDEF qb:dimension qb:DimensionProperty UNDEF fdprdf:unknown owl:Thing ) } ?dsd a qb:DataStructureDefinition . ?desc fdp:name ?packageName; fdp:model ?model . ?model fdp:dimensions ?dimensions . ?dimensions ?fdpDimensionProperty ?dimension . ?dimension fdp:dimensionType ?fdpDimensionType . FILTER NOT EXISTS {?fdpDimensionProperty fdprdf:mappedTo [] .} OPTIONAL { ?dimension fdp:classificationType ?fdpClassificationType } FILTER(IF(BOUND(?fdpDimensionSubType), ?fdpClassificationType = ?fdpDimensionSubType, !EXISTS {?dimension fdp:classificationType ?something})) BIND(ENCODE_FOR_URI(strafter(str(?fdpDimensionProperty), "#")) AS ?dimensionName) BIND(URI(CONCAT("http://data.openbudgets.eu/ontology/dsd/",?packageName,"/dimension/",?dimensionName)) AS ?dimensionProperty) }
PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> CONSTRUCT { ?component fdprdf:attributeCount ?attrCount . } WHERE { SELECT ?component (COUNT (DISTINCT ?attr) AS ?attrCount) WHERE { ?component fdprdf:attribute ?attr . } GROUP BY ?component }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX graphstore: <http://plugins.linkedpipes.com/ontology/l-graphStoreProtocol#> CONSTRUCT { <http://localhost/resources/configuration> a graphstore:Configuration; graphstore:graph ?graphIRI . } WHERE { fdprdf:metadata fdprdf:datasetShortName ?datasetName . BIND(CONCAT("http://data.openbudgets.eu/resource/graph/", ?datasetName) AS ?graphIRI) }
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fcsv: <file://budget.csv#> PREFIX obeu-attribute: <http://data.openbudgets.eu/ontology/dsd/attribute/> PREFIX obeu-dimension: <http://data.openbudgets.eu/ontology/dsd/dimension/> PREFIX obeu-measure: <http://data.openbudgets.eu/ontology/dsd/measure/> PREFIX qb: <http://purl.org/linked-data/cube#> PREFIX datasets: <http://data.openbudgets.eu/datasets/> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> CONSTRUCT { ?attribute fdprdf:parentAttribute ?parentAttribute; fdprdf:isHierarchical true . ?parentAttribute fdprdf:isHierarchical true . } WHERE { ?attribute fdprdf:parentFDPAttribute ?parentFDPAttribute . ?parentAttribute fdprdf:createdFromFDPAttribute ?parentFDPAttribute . }
PREFIX fdp: <http://schemas.frictionlessdata.io/fiscal-data-package#> PREFIX fdprdf: <http://data.openbudgets.eu/fdptordf#> PREFIX qb: <http://purl.org/linked-data/cube#> CONSTRUCT { ?dsd fdprdf:foreignKey [ fdprdf:name ?foreignKeyField; fdprdf:source ?foreignKeySource ] . } WHERE { ?dsd a qb:DataStructureDefinition . ?desc fdp:name ?packageName; fdp:title ?packageTitle; fdp:resources ?resource; fdp:model ?model . ?resource fdp:name ?measureResource; fdp:foreignKeys ?foreignKey . ?foreignKey fdp:fields ?foreignKeyField . BIND(REPLACE(REPLACE(?foreignKeyField, "^\\s+", ""), "\\s+$", "") AS ?trimmedForeignKeyField) BIND(URI(CONCAT("file://",?measureResource,"#",REPLACE(ENCODE_FOR_URI(?trimmedForeignKeyField), "%20","+"))) AS ?foreignKeySource) }