I Put the code that is shown below in a rdf vaildator
http://www.w3.org/RDF/Validator/
and got an (FatalError: The entity "xsd" was referenced, but not declared) i am not sure why i got this.
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:owl ="http://www.w3.org/2002/07/owl#">
<owl:Restriction>
<owl:onProperty rdf:resource="#hasParent" />
<owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:cardinality>
</owl:Restriction>
</rdf:RDF>
[I got a] (FatalError: The entity "xsd" was referenced, but not declared) i am not sure why i got this.
In this line:
<owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:cardinality>
the entity &xsd;appears. It wasn't defined, though. You could resolve the issue by replacing &xsd; with http://www.w3.org/2001/XMLSchema#. E.g.,
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:owl ="http://www.w3.org/2002/07/owl#">
<owl:Restriction>
<owl:onProperty rdf:resource="#hasParent" />
<owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:cardinality>
</owl:Restriction>
</rdf:RDF>
That said, it looks like you copied a snippet from an OWL ontology. The ontology probably had the entity declaration in the origin. Note that the content you have now is no longer a legal OWL ontology because it doesn't have the property declaration for hasParent, and perhaps because there's no base IRI defined. It can be still legal RDF, though.
Related
Try to set a style in geoserver styles editor.
but the validation fails
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>capitals</Name>
<UserStyle>
<Name>fix_histogram</Name>
<Title>Fix Histogram</Title>
<FeatureTypeStyle>
<Rule>
<Title>Capitals</Title>
<RasterSymbolizer>
<ContrastEnhancement>
<Normalize>
<VendorOption name="algorithm">StretchToMinimumMaximum</VendorOption>
<VendorOption name="minValue">50</VendorOption>
<VendorOption name="maxValue">100</VendorOption>
</Normalize>
</ContrastEnhancement>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
line 19: cvc-complex-type.2.1: Element 'Normalize' must have no character or element information item [children], because the type's content type is empty.
but this code was taken from the example for RasterSymbolizer:
https://docs.geoserver.org/latest/en/user/styling/sld/reference/rastersymbolizer.html
Thanks,
It is possible that the schema that the editor is using has not been updated to recognise the vendor options you are using.
Does the style work if you apply it?
I am seeing some XSD schema documents that declare both a targetNamespace and an xmlns:tns attribute in their top schema element. E.g. the following one taken from here. They also seem to have the same string value. I understand the role of targetNamespace but what does xmlns:tns do on top of that?
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/Product"
xmlns:tns="http://www.example.org/Product"
elementFormDefault="qualified">
...
It lets you refer to the namespace later in the schema. For example, if you declare a named type and then want to also declare an element of that type
<complexType name="someType">
<!-- ... -->
</complexType>
<element name="someElement" type="tns:someType" />
Simply saying type="someType" wouldn't work because that would be referring to the (non-existent) someType in the http://www.w3.org/2001/XMLSchema namespace (the xmlns="..." of the schema file) rather than the one in the http://www.example.org/Product namespace.
i have triples: Fadi eat Apple.
(subject = Fadi, predicate = eat, object = Apple).
and i have the Time when fadi eat the Apple, its: 00:00:13
and i have the time when fadi ate the apple, its: 00:00:50
how can i write a rdf-triples file for this with times as attributes?
and how can i get the startTime and endTime with sparql query request from the rdf file?
i tried to write my rdf like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rdf:RDF [<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>]>
<rdf:RDF xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dnr="http://www.dotnetrdf.org/configuration#"
xml:base="http://www.example.org/"
xmlns:startTime="http://example.org/startTime#"
xmlns:endTime="http://example.org/endTime#">
<rdf:Description rdf:about="Fadi">
<ns:be xmlns:ns="http://example.org/" xmlns:startTime="00:00:13" xmlns:endTime="00:00:16">May</ns:be>
</rdf:Description>
</rdf:RDF>
but the c# gaves me: Invalid URI: The URI scheme is not valid.
and i tried this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rdf:RDF [<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>]>
<rdf:RDF xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dnr="http://www.dotnetrdf.org/configuration#"
xml:base="http://www.example.org/">
<rdf:Description rdf:about="Fadi">
<ns:be xmlns:ns="http://example.org/" xml:startTime="00:00:13" xml:endTime="00:00:16">May</ns:be>
</rdf:Description>
</rdf:RDF>
but i can't get the times with sparql.
how can i write my rdf?!!
You shouldn't be using xmlns to try and define attributes, xmlns is a reserved prefix in XML used for defining namespaces.
Once you have defined your own namespace you can then use it for attributes e.g.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rdf:RDF [<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>]>
<rdf:RDF xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ns="http://yourdomain.com/namespace#"
xml:base="http://www.example.org/">
<rdf:Description rdf:about="Fadi" ns:startTime="00:00:13" ns:endTime="00:00:16">
<ns:be>May</ns:be>
</rdf:Description>
</rdf:RDF>
Here I defined a namespace in the root element like so:
xmlns:ns="http://yourdomain.com/namespace#"
Obviously you should change the namespace URI to something appropriate for you.
Then I can use the newly defined ns prefix to refer to terms in that namespace e.g.
ns:startTime="00:00:13"
Suggestion
However I still don't think this is going to give you the data you are intending to create. I would suggest that your stop trying to write RDF/XML by hand which what your questions imply you are doing.
Instead I would recommend learning a human readable serialization like Turtle since it is significantly easier to understand. Also it is much more triple centric than RDF/XML so it will help you to understand much better the RDF triples you are actually expressing and thus will make it easier for you to understand how to write SPARQL queries that actually return the data you want.
today i've bumped in the following problem. I have the following xml:
<c:docschema xmlns:c="http://www.otr.ru/sufd/document/desc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.otr.ru/sufd/document/desc http://otr-sufd/xmlschema/docschema.xsd">
...
</c:docschema>
And it's validating fina against it's schema. But I don't want namespace prefixes in my xml, so i try to write it like this:
<docschema xmlns="http://www.otr.ru/sufd/document/desc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.otr.ru/sufd/document/desc http://otr-sufd/xmlschema/docschema.xsd">
...
</docschema>
And it's giving me a validation error. My XSD schema i'm validating against is compound of two XSD's, here is the headers:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns="http://www.otr.ru/sufd/document/desc"
targetNamespace="http://www.otr.ru/sufd/document/desc"
xmlns:fieldset="http://www.otr.ru/sufd/document/fieldset"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<xsd:import namespace="http://www.otr.ru/sufd/document/fieldset" schemaLocation="fieldset.xsd"/>
and
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://www.otr.ru/sufd/document/fieldset"
xmlns="http://www.otr.ru/sufd/document/fieldset">
What's wrong there?
EDIT: The question is now, how to change my XSD's in order to make instance document valid?
Given what you write, I imagine that the problem is the following.
Let's consider that there is an a element under your root element.
This first example below is valid because a is unqualified and because you set elementFormDefault to unqualified :
First example
<c:docschema xmlns:c="http://www.otr.ru/sufd/document/desc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.otr.ru/sufd/document/desc http://otr-sufd/xmlschema/docschema.xsd">
<a>...</a>
</c:docschema>
In the second example the file is not valid because you set elementFormDefault to unqualified and you have an element a that is qualified (in the default namespace) :
Second example
<docschema xmlns="http://www.otr.ru/sufd/document/desc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.otr.ru/sufd/document/desc http://otr-sufd/xmlschema/docschema.xsd">
<a>...</a>
</docschema>
The correct XML could be :
<docschema xmlns="http://www.otr.ru/sufd/document/desc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.otr.ru/sufd/document/desc http://otr-sufd/xmlschema/docschema.xsd">
<a xmlns="">...</a>
</docschema>
EDIT
If the children of the root element are defined in the same namespace than the root in your schemas, you just have to change elementFormDefault="unqualified" to elementFormDefault="qualified" to have a schema that validates the XML. If it's not the case : you will surely have to reshape your schema more deeply, in this case, maybe you should post another question dedicated to that with more code (including more part of the schemas and instances).
Looks like you are making the mistake of assuming that the nested elements inside your root <docschema> will inherit the namespace defined on that root. They will not.
If you want to get rid of namespace prefixes you will then have to explicitly declare the namespace at every sub-node in your instance document.
Eg
<Root xmlns="http://www.myns.com">
<MyElement1 xmlns="http://www.myns.com">
... etc
</MyElement1>
</Root>
or
<p:Root xmlns:p="http://www.myns.com">
<p:MyElement1>
... etc
</p:MyElement1>
</p:Root>
Which is nicer? I think the second option.
So I parsed a bunch of XMLs to generate a giant schema file using trang which went fine. However, when I try to generate sources using xjc, I get the following error,
xjc reutersXMLSchema.xsd
parsing a schema...
[ERROR] no-xsi: The {target namespace} of an attribute declaration must not match 'http://www.w3.org/2001/XMLSchema-instance'.
line 11 of file:/Users/cqin/Downloads/trang-20081028/xsi.xsd
Failed to parse a schema.
The schema looks like the following,
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2001/XMLSchema-instance" xmlns:filter="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/filter" xmlns:ns0="http://www.reuters.com/ns/2006/05/01/webservices/rkd/News_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/headlineml" xmlns:cache_1="http://www.reuters.com/ns/2008/03/01/webservices/rkd/Cache_1" xmlns:ns2="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1" xmlns:global="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1" xmlns:a="http://www.w3.org/2005/08/addressing">
<xs:import namespace="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/filter" schemaLocation="filter.xsd"/>
<xs:import namespace="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/headlineml" schemaLocation="ns1.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1" schemaLocation="global.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2006/05/01/webservices/rkd/News_1" schemaLocation="reutersXMLSchema.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1" schemaLocation="ns2.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2008/03/01/webservices/rkd/Cache_1" schemaLocation="cache_1.xsd"/>
<xs:import namespace="http://www.w3.org/2003/05/soap-envelope" schemaLocation="s.xsd"/>
<xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="a.xsd"/>
<xs:attribute name="type" type="xs:NCName"/>
</xs:schema>
Any idea why it won't work?
I've tried changing the targetNameSpace to something unique but I get more errors so I'm wondering if there is something I can do with the original error.
Thanks!
Yes, this isn't right:
targetNamespace="http://www.w3.org/2001/XMLSchema-instance"
This is saying that the target namespace of your schema is actually the namespace of the Schema definition schema itself (i.e. the schema which defines the things like <xs:schema> and <xs:import> actually mean). This schema is fixed, you can't write your own schema targeting it, which is why XJC is rejecting it.
I've tried changing the targetNameSpace to something unique but I get more errors
Keep trying that, you'll get further than with what you have now. However, the fact that trang is generating this bad schema at all is suggestive that you've done something wrong further back along the line. Perhaps you asked it to generate a combined schema which included the http://www.w3.org/2001/XMLSchema-instance schema itself, which is almost certainly not what you want to do.